Path: utzoo!attcan!uunet!steinmetz!control!dixon From: dixon@control.steinmetz (walt dixon) Newsgroups: comp.sys.ibm.pc Subject: Re: Turbo Pascal(4.0) Sound Function Message-ID: <11543@steinmetz.ge.com> Date: 16 Jul 88 00:37:51 GMT References: <45900141@uxe.cso.uiuc.edu> Sender: news@steinmetz.ge.com Reply-To: dixon@control.steinmetz.ge.com (walt dixon) Organization: General Electric CRD, Schenectady, NY Lines: 33 I'm not familiar with the TP library and the Sound routine in particular, but I have messed around with the sound generation hardware. The common way to generate sounds is to use one channel of an 8253 counter/timer chip in mode3. This causes the square wave output of the chip to go to the speaker through a low pass filter. The counter clocks at 1,193,180Hz. You load a counter with a divisor to get specific frequencies. For example, the 440Hz a above middle c requires a counter of 1193180/440. This tone is faithfully reproduced. The accuracy of the resulting note is limited by roundoff/truncation in the division. I don't know how the TP sound function works. I have written a device driver which takes character strings similar to the BASICA sound statement. (My driver also supports key signatures, double sharps/flags, and naturals). To my untrained (more like tone deaf), I was able to get reasonable accurate reproduction in the 3rd octave and above. The most difficult problem I had to deal with was getting accurate note timings. I eventually sped up the system clock to increase timer resolution. This driver is published in chapter 11 of the MS-DOS Papers (Howard Sams, 1988). Take a look at this chapter if you need more information. [I don't get any royalties from book sales -- just citing what I belive to be a good reference.] I hope this helps. Walt Dixon {ARPA: Dixon@ge-crd.arpa } {US Mail: GE CRD } { PO Box 8 } { Schenectady, NY 12345 } {Phone: 518-387-5798 }