Thursday, November 19, 2009
Thursday, January 15, 2009
Serial port player – serialplayer
This software lets us play audio through serial port.
Hardware requirement: (below values are for USB-to-serial chip)
- female com port connector
- resistors - 1k
- capacitors 4.4 uF
For laptop, i used this hardware:-
- USB serial converter. I am using Nokia 6600 pc data cable. Which is nothing but a prolific PL2303 usb-to-serial chip with cable utilizing only its TX, RX and GND pins.
- A Linux distro with gcc (GNU's compiler collection) for source compilation.
- serialportplayer – binary OR source code.
[Illustration of project]
Raw audio data => serialportplayer => serial port => low pass filter => speaker(s).
The software collects raw audio data and processes it according to serial port data transfer speed. The processed data is then output through serial port's TX pin. The processing includes oversampling and modulation (sigma-delta is recommended but current version of program doesn't uses it purely).
The data is raw audio. This raw audio data is extracted from audio files using audacity software as -
- Run audacity
- Open any audio file
- Export that file into raw format.
- the raw format must be :- unsigned 8 bit / sample, mono(1channel).
Please note down the samplerate of the original audio file and use it during serial play.
- start your shell – e.g. Konsole, xterm
- execute su command and give root's password.
- Run serial port player as:- ./tplay OR ./serialportplayer
- e.g. ./tplay humdum.raw 16000
if your system can't run the binary you can compile it from source:
cc –o serialplayer serialplayer.c
The following where the sources using which i accomplished the project:
- Linux serial port how to (tldp.org) the Linux documentation project.
- ttyplay: Project made before mine. It helped me a lot.
Any interested person must read about 1 bit audio and sigma-delta modulation.
Please connect 1k resistor to TX pin and capacitor in parallel to TX and GND pins. These values are for USB-to-Serial adapter. Use appropriate values for normal serial port at back of desktop pcs.
Download link: This link has tplay source and binary of ttyUSB, it uses USB-to-Serial device as serial port.