### Re: What are the principles behind digitally changing your voice?

Date: Mon Sep 21 12:07:30 1998
Posted By: David Gould, Undergraduate, Computer Engineering, University of Alabama in Huntsville
Area of science: Computer Science
ID: 903546335.Cs
Message:
```
Greetings Jason,

The principles behind using software to digitally alter someone's
voice are rooted in the physics of sound waves.  With sound, you
are dealing fundamentally with a sound wave, even though you have altered
the form of the wave into a digital state, usually by sampling the sound
with analog-to-digital converting hardware such as a sound board you might
find in a PC.

There are really two separate levels to what you most likely
consider altering someone's voice.  At the lower level you are just
applying some mathmatical formula to the amplitude of your sound wave to
cause an effect.  And at a higher level there are specific formulas or sets
of formulas that produce well known effects such as reverberation
(echoing), muffling, etc.

A sound wave, represented digitally, is a set of data points
describing the amplitude of the sound wave as a function of time.  With
stereo sound you have two such sets of data, one for each channel, left and
right.  Surround sound has even more channels.  To alter the sound, you
must pass your data through what is known as a filter or transform, that
takes one or more data points at a time, and converts them into one or more
new data points that represent the altered sound.  Such a function might
look like this in 'C':

(assuming you pass in an array of 44100 samples contained in a 16 bit
short)

void applyFilter(short *inputAmplitude)
{
for(int i = 22050; i < 44100; i++)
inputAmplitude[i] += (inputAmplitude[i-22050] * 0.2);
}

So then applying this filtering function to the last half of your
digital sound, you create a 20% echo of the first half.  Obviously there
are better designs for a filtering function, but this should give you some
ideas.

There are, of course, much more interesting filtering functions.
A large set of example effects can be found in most 'wave' or sound editing
software.  For instance, the SoundBlaster Live! card comes with a
significant set of effects in its sound editing utilities, and allows you
to listen to the effects in real time as you speak into the microphone.

Many effects are mathmatically complex, so be prepared to pull out
a calculus book to understand them.  A good physics book describing wave
mechanics would be the best place to start.  Finally you'll want to be able
to handle whatever file formats your voice data will be stored in, such as
.wav or .au formats.  Below are some links you might find helpful in your
search.  I think you will find that once you have the algorithm and you
know the data format, writing the code to run the algorithm on a sound file
will be fairly easy.  And as a further challenge, you can try writing code
to interface directly with your sound card using a software development kit
such as the one Creative Labs has available for their boards.

http://www.winappslist.com/multimedia/audio_editors.htm

http://www.united-trackers.org/forum/index.php?PHPSESSID=69a0de34ed10d9e5ecd157d2413aa455&board=11.0

http://www.trinity-is.com/freeware/Sound_Utilities2.htm

http://www.soundblaster.com/products/welcome.asp?category=1&subcategory=205
Have fun!
-Dave Gould

```

Current Queue | Current Queue for Computer Science | Computer Science archives