3 ms·
Wouldn't toggling off and on 8000 times per second be the same as playing 8KHz?
by pcthrowaway 5y ago
Wouldn't toggling off and on 8000 times per second be the same as playing 8KHz?
- p1mrx 5y ago"8 kHz audio" usually implies that each sample is an 8-bit or 16-bit value. In the on/off case it's just a 1-bit value.
- ant6n 5y agoPlaying "8KHz audio" is not the same thing as a playing an "8KHz frequency" (which yes in this case is a actually a square wave, so technically its Fourier transform shows other frequencies being played - but the programmer only gets to set the frequency of the square wave).
- dragonwriter 5y ago> Wouldn't toggling off and on 8000 times per second be the same as playing 8KHz? Sure. But its not “tell the speaker to play an 8kHz frequency”. The speaker doesn't inherently play “one frequency”, it just toggles on and off when you tell it to. If you tell it to toggle on and off based on a function driven by the combination of an 8kHz cycle and, say, a 2.5kHz cycle it will do that, too.
- rob74 5y ago...and I think that's exactly the technique the "Monkey Island PC-Speaker coders" used to overlay the percussion over the melody. The IBM PC and its descendants had the advantage of having a relatively fast CPU which could partly make up for the primitive sound system - i.e. it could only play a square wave, but it could be a very complex square wave. Some games even played voice samples - they were extremely distorted, but more or less understandable. Similar to how you can show photos on a monochrome display (like the good old Hercules) - they won't look pretty, but you can do it...