Earth.Org.UK
. Here is the first batch of sounds stand-alone. I captured the .wav
intermediate file for each of these too.
Temperatures at my desk (5s) for August 2019 (.wav
):
Playback requires an Internet connection.
Temperatures outside in our porch (4o) for all of 2018 (.wav
):
Playback requires an Internet connection.
Temperatures at my desk (5s) for all of 2018 (.wav
):
Playback requires an Internet connection.
Here are a few more technical details for those who want them. (And to remind me how I did it when I have another go!)
There are 31536000 seconds per (365-day) year.
A conventional sampling rate for music, such as a CD, is 44100 samples per second. That is, 44100 Hertz, often written as 44100Hz.
31536000 / 44100 ~ 715. So I have resampled sensor data every 715s (~12mins). That gets 1s play per data year with a nominal 44100Hz sample rate.
(I should probably be filtering to keep Nyquist happy. Anything changing faster than about once every two samples. I'll consider that.)
FLAC and WAVE both support (small 8/16-bit) values such as used in OpenTRV JSON for temperature and light and RH%. In this case I have converted the sensor readings directly into WAVE (.wav
file) samples. Then I normalised later, manually, in Audacity. Then I exported to MP3 (and FLAC).
I abused the UNIX awk
utility to do much of the grunt work. That included creating the WAVE binaries. That required some swerving around character encoding. (Turning off UTF-8, and using a "C" binary encoding with LANG
.)
The code all runs on my Raspberry Pi. Some of it runs on my Mac. (I ran Audacity on my Mac.)
See conversion script: script/mkaudio/OpenTRVJSONtoWAV.sh
:
gzip -d < data/OpenTRV/pubarchive/remote/201908.json.gz | sh script/mkaudio/OpenTRVJSONtoWAV.sh "T|C16" E091B7DC8FEDC7A9 > ~/tmp/out.wav
For a whole year's data it can be run like this:
xz -d < data/OpenTRV/pubarchive/remote/2018.json.xz | sh script/mkaudio/OpenTRVJSONtoWAV.sh "T|C16" 819C99B4B9BD84BB > ~/tmp/out.wav
There is a lower-level script that converts a text version of the resampled data to a binary WAVE file script/mkaudio/textToWAV.sh
:
sh script/mkaudio/textToWAV.sh script/mkaudio/tinyRawAudio.txt 44100