Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!decwrl!labrea!rutgers!clyde!watmath!watcgl!watmum!smvorkoetter From: smvorkoetter@watmum.waterloo.edu (Stefan M. Vorkoetter) Newsgroups: comp.sys.ibm.pc Subject: Re: Neat voice|gag program Message-ID: <2715@watcgl.waterloo.edu> Date: 15 Dec 87 14:39:53 GMT References: <3692@uwmcsd1.UUCP> <1107@titan.camcon.uucp> Sender: daemon@watcgl.waterloo.edu Reply-To: smvorkoetter@watmum.waterloo.edu (Stefan M. Vorkoetter) Distribution: all Organization: U. of Waterloo, Ontario Lines: 45 In article <1107@titan.camcon.uucp> mb@camcon.uucp (Mike Bell) writes: >in article <3692@uwmcsd1.UUCP>, cmaag@csd4.milw.wisc.edu >(posting to comp.binaries.ibm.pc) says: >> Here is a neat little program I found on a local bbs. It uses the speaker >> to generate a very-realistic (the best I've heard on a PC!) voice that >> says something to the effect of "Help! I'm locked in this computer! >> Let me out! Help!". >I just played it, and was much impressed. Given the rudimentary >nature of IBM PC's, can anybody explain how it achieves its >effect? Someone explained it to me once, so here goes: A speaker, such as the one in the PC, has a vibrating cone, whose displacement from the centre position is somehow proportional to the amount of voltage going through it. Thus, if you have a voltage varying according to a sine function, the displacement of the speaker cone will do likewise. The PC's sound circuitry can only generate fixed amplitude square waves, so a trick is used. Suppose at any given time, we want the speaker to go to only half the displacement that the full square wave voltage would normally drive it to. What we do then is send it a pulse that is so short, that it is over before the speaker cone has a chance to reach full displacement. So, what effectively happens is the speaker cone only goes a certain distance, depending on how wide the pulse is. Thus, we can vary the amplitude of the sound by controlling the pulse width. The sound quality could be much improved if we were to put some sort of a filter between the pulse generator and the circuit. Here is an example of what happens: __-__ _-__ _-__ _-- --__ __-- --__ __-- -- __-- --___ __--- ---___ __-- ---- ---- ---- Above sine wave approximated by square wave below - -- --- -- - -- --- -- - -- --- __ _____ ____ _____ ____ ____ _____ ____ _____ _____ ____ __ Stefan Vorkoetter Symbolic Computation Group University of Waterloo Waterloo, Ontario, CANADA