Recently I participated in an applied electronics seminar at the University of Ruse, which aimed at promoting the electronics "sub-subject" to high school and first-year students. I decided to talk a bit about CMOS integrated circuits and let the students play with the parallel port of a PC and make them play some music over the LPT port through an R2R DAC. It ended-up being quite fun, let me briefly show you what I used and how easy it was :) Below you can watch a video with the very first enlivening of the "player".
I used randomly picked (not even exactly R and 2R) resistors to form an R2R ladder which I then connected to the parallel port's 8-bit data bus. For the rest (LPT control) I used octave and the instrument-control package provided to directly access the LPT port and dump vector streams to it. Unfortunately "instrument-control" does not provide us with sampling rate functions as this is purely OS/octave handling dependent. Nevertheless we can measure it and provide interpolated samples to the DAC to suit our needs, or to keep a somewhat reasonable sample-time base close to the real one in the files which we are playing. Here is a minimalistic code to make things work.
%clc; %clear all; pkg load instrument-control [y0 rate bits] = wavread("/usr/share/skype/sounds/CallRingingIn.wav"); N = 8; y=round(y0*(2^N/2)+(2^N/2)); % scale to 8 bits 0-255 and round to nearest integer nSmpl = length(y); pp = parallel("/dev/parport0", 0); for k = 1:nSmpl pp_data(pp,y(k)); %pp_data(pp,255); % flash port to measure LPT port sampling rate %pp_data(pp,0); end pp_close(pp);
Also, here are some pictures from the seminar we organized.
Warning: require(comments.php): failed to open stream: No such file or directory in /home/transist/public_html/post/stdal/post30.htm on line 188
Fatal error: require(): Failed opening required 'comments.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/transist/public_html/post/stdal/post30.htm on line 188