[comp.lang.c++] ACCESS SPEAKER ON PC??

zhou@brazil.psych.purdue.edu (Albert Zhou) (11/20/90)

 	I got some digitalized sound data that I want to send to the internal
speaker of PC. Does anyone know of any DOS interrupt for controlling speaker?

epames@eos.ericsson.se (Michael Salmon) (11/20/90)

In article <11521@j.cc.purdue.edu> Albert Zhou writes:
>
> 	I got some digitalized sound data that I want to send to the internal
>speaker of PC. Does anyone know of any DOS interrupt for controlling speaker?

The simple answer is that there is none. The speaker is controlled by a
combination of the timer and the parallel port. One channel of the
timer is set to astable mode and is anded with one bit of the pp. One
changes the tone by altering the divider (input = 1.2MHz) and turns it
on or off with the pp. To make anything other than a monotone you must
provide the speaker with a pulse width modulated bitstream. This can be
achieved in 2 ways. i) use the pp and generate the bitstream in you
programme. This is very hard and extremely unportable. ii) set the
timer in monostable mode and vary the delay time. This also hard but
portable.  The timings mean that you can cope with 6 bit data. You also
need a regular interupt to start each cycle and this can be done by
taking over the clock interrupt. The concept is I think simple but the
details are hard, particularly if you don't want to have to reboot your
computer each time you run it. There are perhaps some PD programmes
around but I don't know of any that come with source.

Michael Salmon
L.M.Ericsson
Stockholm