Path: utzoo!mnetor!uunet!oddjob!gargoyle!ihnp4!cbosgd!clyde!watmath!watcgl!jjboritz
From: jjboritz@watcgl.waterloo.edu (Jim Boritz)
Newsgroups: comp.sys.ibm.pc
Subject: Re: Neat voice|gag program
Message-ID: <2732@watcgl.waterloo.edu>
Date: 16 Dec 87 07:08:29 GMT
References: <3692@uwmcsd1.UUCP> <1107@titan.camcon.uucp> <2715@watcgl.waterloo.edu>
Reply-To: jjboritz@watcgl.waterloo.edu (Jim Boritz)
Distribution: all
Organization: U. of Waterloo, Ontario
Lines: 29

Well if you know how digital sampling works then skip the rest of this
message.  If you don't know how digital sampling works and want a really
simple explanation then try reading what I have to say.

We all know that the only numbers that a computer can deal with is zeroes and
ones.  So how do we get those zeroes and ones to make a human voice like
the little demo software did?  

All sound is made out of sound waves.  If we were to plot a sound wave we
would see that it goes above and below the Y axis.  This is what we are
really concerned with.  Getting the right frequencies out of the thing is
something that we don't even consider, since the waveform for speech is
very complicated and difficult to reproduce by means other than sampling.
Anyways, we monitor the analog electrical signal coming from an audio
device and sample it at regular intervals such as a few thousand Hz, 
(or 40 odd KHz in the case of a CD player).  When we see a negative voltage
we record a zero, a postive voltage a one.  The higher the frequency, the
more zero-one transitions we get, the lower the frequency the fewer zero-one
transitions.  The more zero-one transitions you pump into a speaker during a
fixed interval, the higher the frequency etc.  So all we need to do is send
the zeroes and ones that we recorded, to the speaker, at the same rate as
our sampling frequency, and we can reproduce the original waveform fairly 
well.  CD players are a little more complex since they also need to store 
amplitude information (ie. is a one 2 volts or 3 volts or 10 volts....)
That's about it. 

	--Jim Boritz

	{allegra,decvax,utzoo,clyde}!watmath!watcgl!jjboritz