I made a little program to play audio out of the serial port of my computer.
The Linux desktop is complete, now that this application is released…
Notice the image is blurry because of huge quantities of bass produced. (Actually, the sound is barely audible.)
How does it work?
First, the audio is resampled to the baudrate of the serial port.
Look over here for a description of the RS-232 waveform. Good hardware can send bytes “back-to-back”. Two of the bits are determined by the protocol: the Start bit and the Stop bit. I can control the other 8 bits coming out of the serial port.
Sigma-Delta modulation is a way to encode an analog signal into a binary bitstream.
(This image is from http://www.numerix-dsp.com/appsnotes/APR8-sigma-delta.pdf)
To make the serial port play music, I added a block after the one-bit quantizer to account for start and stop bits. This block is still inside the feedback loop, and reduces the audible effect of the start and stop bits.
See the README for more implementation detail.
Mega Nerd, home of libsndfile and libsamplerate, which are both used by this project.
Roman Black’s one bit sound on a PIC. I do not see the modulation details on his page. Some of the analysis on this page appears to be incorrect, or uses nonstandard terminology.
Linux Gazette article on sound from the parallel port.