Playing the Smile song on VESNA
A while back I was writing about wireless microphone simulation with VESNA. The reason back then was to be able to use remotely-accessible sensor nodes as targets for spectrum sensing experiments. However when I was writing the direct digital synthesis code it occurred to me that transmitting just a stationary tone is slightly boring. Basically nothing was preventing me from transmitting something more fun.
Since playing back recorded audio has somewhat prohibitive storage requirements for a low-powered sensor node I decided to try with a software music synthesizer. If microcomputers in the 80's were able to do it, there should be no reason why a modern ARM CPU couldn't. I've never actually written a synthesizer before and as usual when playing with sound or graphics experimenting with this code was incredibly exciting.
In the end I implemented a 6-channel wavetable synthesizer. Since now I was more concerned with audio quality than correct spectral envelope I replaced the 2-bit quantization with 1-bit and added delta-sigma modulation. This way I was able to exploit the high bit-rate supported by the CC1101 transceiver to get 4 effective bits of audio signal resolution since delta-sigma moved some quantization noise above audible frequencies. The best (subjective I guess) compromise between resolution and sample rate was at 25 kHz audio sample rate and 16x oversampling.
The most complicated thing in all of this was actually figuring out how to interpret time information in a MIDI file. There's a lot of information about this floating around but in the end understanding how to convert all of those weird music units into seconds and milliseconds took way more time than I thought.
It turns out that the 72 MHz Cortex M3 CPU on VESNA runs such a synthesizer without a breaking a sweat. The limiting factor was interrupt load because the streaming of data to CC1101 had to be done with software bit-banging. Since this use case wasn't exactly planned for VESNA no integrated serial bus peripherals are connected to GPIO lines that are used by CC1101 for data streaming. The software implementation handles at most 400 kbps while the transceiver goes up to 800 kbps, which would allow for one additional bit of audio signal resolution.
At high bit rates the size of the synthesis buffer also starts getting problematic. Since you want the buffer to cover at least a few periods of the lowest audio frequency you quickly run out of 96 kB of RAM on VESNA if the baseband rate is significantly higher than the audio rate.
Anyway, hacking on this has been seriously enjoyable. It was one of those side projects that give you strange looks at the office and are hard to explain to someone without giving a fair amount of background information. But in the end there's just something fundamentally fun about having at your fingertips the power to convert 50 remote devices into wireless microphones transmitting a happy song sung by a cartoon pink pony (because seriously, what else would you want to transmit over a city-wide sensor network?)

(Click to watch Simulating a wireless microphone with VESNA video)
You can see a short video demonstration above which should give you an idea of what kind of audio quality is possible with this setup.
Audio synthesis source code is hosted on GitHub if you are curious about the details. Also, if you'll be in Köln two weeks from now, look for my lightning talk about this hack at SIGINT 2013.