The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => 16 bit DOS Programming => Topic started by: Sir_Lucious on April 07, 2007, 01:02:30 AM

Title: Frequency change to make sound different
Post by: Sir_Lucious on April 07, 2007, 01:02:30 AM
I need help finding how I can change the frequency of the internal speaker so I can make the sound go from a higher frequency to a lower one and viceversa. Any help would be great.
Title: Re: Frequency change to make sound different
Post by: Sir_Lucious on April 07, 2007, 01:09:19 AM
Just in case I'm a beginner , I 'm a Computer Engineering student so I do not want you guys just to give me the code, not to be harsh, but  I want to know how i can change it, I want to learn :bg. Just to be sure. Thanks
Title: Re: Frequency change to make sound different
Post by: MichaelW on April 07, 2007, 02:56:48 AM
System timer 2 is used to drive the internal speaker. Timer 2 is programmed for mode 3, periodic square wave, and loaded with a 16-bit initial count that is calculated as the timer input frequency (1193182Hz) divided by the desired output frequency. I posted some code that does this here:

http://www.masm32.com/board/index.php?topic=6790.0

The code that sets up system timer 2 is located in the InitFastTimer procedure in fast_tmr.asm, and the code that controls the timer gate and routes the output to the speaker in the Beep procedure in beep.asm.