I've been experimenting with generating SPDIF digital audio signals from the propeller. If you aren't familiar with SPDIF, it's the protocol used by the optical and coax digital audio inputs on all modern stereo systems and home theater receivers.
It's a pretty demanding signal: 6 megabits, precise sampling rate, manchester-like "Biphase Mark" encoding. But, the Propeller is up to the task
The biphase encoding is done using a pretty simple unrolled loop (2 instructions per bit) while the cog's video generator simultaneously clocks out the signal at the proper rate, as determined by the CTRA PLL.
The net result: You can get 48 KHz 16-bit stereo audio, reproduced in digital clarity, using only a Propeller and an LED.
Attached is my "spdifOut" object, and two demos:
- A modified version of HSS, with 48 KHz SPDIF output.
- A simple WAV file player which plays CD-quality audio from an SD card in real-time.
For the HSS demo, all you need is a Propeller, an LED, and of course some kind of audio equipment that has a TOSLINK (optical digital) input. I just used one of the LEDs on the PropRPM board, and pointed the exposed end of a TOSLINK cable at it. For the WAV demo, you'll also need an SD card with some audio on it.
I tested this with an Onkyo receiver, as well as a cheap USB audio adapter based on the PCM2902 chip. Works fine for me, but YMMV. Please be sure to test at a low volume, to avoid damaging your speakers if anything is wrong.