Earth Notes: Rad Sounds II: Attempting a Higher-fi Home-heating Time-lapseUpdated 2021-03-18 21:12 GMT.
By Damon Hart-Davis.
Hi, I'm Damon Hart-Davis, and this is the Earth Notes podcast episode for 12th October 2019.
I'm trying for even radder sounds from my radiators and temperature data.My colleagues were horrified when I explained the very simple method that I was using to convert temperature data samples into constant-rate 'audio' data. Mainly in how each 715 seconds I took the last valid temperature sample to use as the next output audio sample. A famous (dead) chap called Nyquist may also be spinning given the potential noise injected into the audio by doing that.
Nyquist said that any frequencies above half the sampling rate are not going to be rendered well or at all in the output. They may turn into beat frequencies or disappear, or likely just noise. Such frequencies above half the sample rate should be cut off, ie filtered out, before taking the output samples.
In defence of my simple method, temperature is only internally sampled by the Radbots every minute. Only a subset of stats is sent on each transmission. Transmissions are 2 minutes apart, but typically temperature will only get sent at most [about] once every 4 or 8 minutes. Radbot does try to send a value as soon as possible after it changes, and temperature changes will typically be one unit in the least significant place (1ulp) before rescaling. Thus the resampling method I was using probably wasn't losing much information, for example, or adding much noise. At least for the '4o' outside samples that change relatively smoothly.
I tried instead resampling the data at 60 seconds rather than 715 seconds, so all actual Radbot information should be present in the intermediate
.wav. This gives a nominal 525600Hz sample frequency.
I tried a number of approaches, but settled on loading the data into Audacity, using "Normalize" to get the volume OK, then "Resample" to the final 44100Hz. That leaves a spectrum that rolls off fast enough to make Nyquist happy, and has peaks at around 365Hz and its harmonics, as I would expect.
Before: [twice 2018-4o]
After: [twice 2018-4o-NR]
It doesn't sound much different to me for 4o though.
Nor indeed for 5s, where the low-pass filtering might have been expected to take more roughness off.
Before: [twice 2018-5s]
After: [twice 2018-5s-NR]
Note that the FLAC files are slightly smaller with the cleverer processing, which does imply slightly less noise.
However, perhaps simple is good enough for this simple case. I shall seek more advice!
There's more on my "Earth Notes" Web site at Earth.Org.UK.
From last time: temperatures outside in our porch (4o) for all of 2018 (.wav):
Now with samples (up to) every 60s rather than 715s, ie a nominal 525600Hz, then resampled in Audacity hoping for a better sound (.wav):
Now with the 525600Hz input, in Audacity Normalize then Low-Pass Filter at 22050Hz with 6dB/octave roll-off then Resample to 44100Hz (and set project rate to 44100Hz):
Now with the 525600Hz input, in Audacity Normalize then Resample to (and project rate) 44100Hz (spectrum):
From last time: temperatures at my desk (5s) for all of 2018 (.wav):
Now with the 525600Hz input, in Audacity Normalize then Resample to (and project rate) 44100Hz (.wav):
Sampling 4o (up to) every 60 seconds (Radbot's underlying sampling rate) and therefore at a nominally higher frequency of 525600Hz to achieve 1 year in 1 second. I do some sort of low-pass filtering and resample in Audacity to 44100Hz.
xz -d < data/OpenTRV/pubarchive/remote/2018.json.xz | sh script/mkaudio/OpenTRVJSONtoWAV.sh "T|C16" 819C99B4B9BD84BB 60 525600 > ~/tmp/out.wav