DIGITALIZED SOUND ON PC?

H.L. Stahl hls at rwthbs.uucp
Mon Nov 26 18:38:30 AEST 1990


In article <11516 at j.cc.purdue.edu> zhou at brazil.psych.purdue.edu (Albert Zhou) writes:
>
>   I want to output some digitalized sound signal to the speaker. The key-
>point I figured out is to control the volume of the speaker. While you
>can use "sound" to control frequency, Turbo does not provide direct access
>to the speaker. I searched throughout my DOS manual and could not find
>a interrupt for speaker. Does anybody have any clue on how to access speaker?

It's quite as simple:

   #define PB    0x61  /* adress of port B 	       */
   #define CREG  0x43  /* adress of 8253 command register */
   #define LATCH 0x42  /* adress of 8253 latch register   */

   outp(PB, inp(PB) | 3);  /* start sound */

   outp(CREG,0xB6);          /* send 8253 command */
   outp(LATCH, durn & 0xFF); /* LowByte of duration */
   outp(LATCH, durn >> 8  ); /* HighByte of duration */

   outp(PB, inp(PB) & 0xFC);  /* end sound */

Hope this helps!

 |  _      : Hans-Ludwig Stahl, Lehrstuhl fuer Betriebssysteme, RWTH Aachen
 |_|_`__   : Kopernikusstr. 16, D-5100 Aachen, ..49-(0)241-804374
   | |__)  : Domain:  hls at informatik.rwth-aachen.de
     |__)  : uucp:    ...!{seismo,mcvax,uunet}!unido!rwthinf!hls



More information about the Comp.lang.c mailing list