[comp.lang.pascal] Adding Effects to Samples w/computers

am42+@andrew.cmu.edu (Alexander Paul Morris) (10/26/90)

I'm interested in taking a digital sound file saved on a PC and adding
(digitally, by means of a program) effects such as echo, reverb, delay,
chorus, distortion, etc.  Does anyone possibly have any code or algorithms
they could share with my that may facilitate my ability to do this?  Also,
would anyone know about any books that may be published that might describe
how a computer program could add such effects to a digital sound file?  I
have two books: Digital Audio Signal Processing and An Intro to Digital
Signal Processing, but they really don't give any useful information on
implementing any effects such as those described above.  Any help will be
VERY MUCH appreciated.  I've tried to find information on this for a long
time.
 
  Alexander Morris
  Carnegie Mellon

lsalomo@hubcap.clemson.edu (lsalomo) (10/26/90)

I have a book titled "Musical Applications of Microprocessors", which (among
the MANY other GREAT topical discussions) describes such as what you want to
do written in 68000 assembler and BASIC (the only detracting thing of the 
entire book).  I'll see if I can remember to find out what the ISBN number is
and post it.

Cheers,
Q - the "Q"uestor for knowledge (, a degree, etc.)

lsalomo@hubcap.clemson.edu
ibmman@prism.clemson.edu
ibmman@clemson.clemson.edu
=============================================================================
"Gee Wally, I think there's something wrong with the Beaver."
=============================================================================

bkuo@nunki.usc.edu (Benjamin Kuo) (10/27/90)

Echo, reverb, and delay are all subsets of just one function -- taking
the original sound and repeating it at correct intervals... They are pretty
easy to implement, it simply involves taking your waveform, feeding it
to a function, mixing in the sound, and progress with lower and lower levels
back into the function.

There is a book "Musical Applications of Microprocessors" published in 1985,
which goes over the basic ways to modify sound. It's a bit outdated (!) now
with all the DSP and other neat digital tools available, but it covers the
basics quite well... I think it is published by Hayden Books.

(Now if you had a Mac, I would just direct you to any sound editing program,
where that stuff is pretty standard... Effects, filters, other neat tools...)

Benjamin Kuo

broehl@watserv1.waterloo.edu (Bernie Roehl) (11/01/90)

In article <gb9uE9_00Uh_E4J58s@andrew.cmu.edu> am42+@andrew.cmu.edu (Alexander Paul Morris) writes:
>
>I'm interested in taking a digital sound file saved on a PC and adding
>(digitally, by means of a program) effects such as echo, reverb, delay,
>chorus, distortion, etc.  Does anyone possibly have any code or algorithms
>they could share with my that may facilitate my ability to do this?

It's actually pretty easy to do most of those things.  You essentially
add the waveform to itself, sample by sample, with an offset and a weight.

Your first output value is the first value of the input.  Your second
output value is your second input value plus half the first input value.
Your third output value is half the second plus a quarter of the first.
And so on.

out[0] = in[0];
out[1] = in[1] + .5 * in[0];

For all subsequent indices (2, 3, 4 etc):

out[i] = in[i] + .5 * in[i-1]  + .25 * in[i - 2];

(The above assumes you're storing values in floating point, which is a bad
idea; the principle is the same, regardless.  And needless to say, you can
use more that just the previous two samples).

Hope this helps.
-- 
	Bernie Roehl, University of Waterloo Electrical Engineering Dept
	Mail: broehl@watserv1.waterloo.edu OR broehl@watserv1.UWaterloo.ca
	BangPath: {allegra,decvax,utzoo,clyde}!watmath!watserv1!broehl
	Voice:  (519) 885-1211 x 2607 [work]

jensenq@iconsys.icon.com (Quinn Jensen) (11/02/90)

Look into csound from the MIT media lab on ems.media.mit.edu.  It does do
reverb and other effects on sound files.  The source code is supplied.
Perhaps more importantly to you, they do document their signal processing
algorithms.

Peter.Becker@f6.n492.z5.fidonet.org (Peter Becker) (11/18/90)

Can't really help - but have you ever seeen a program by the name of 
mushroom that went around some time ago?  It used a huge file of 
digital samplings to produce quite good sound (for a PC speaker) for 
about 20 secs.  You may be able to get some techniques from that.

--  
Peter Becker - via FidoNet 5:494/5
UUCP: uunet!m2xenix!quagga!bberry!492!6!Peter.Becker
ARPA: Peter.Becker@f6.n492.z5.fidonet.org

Peter.Becker@f6.n492.z5.fidonet.org (Peter Becker) (11/18/90)

DIstortion would be achieved by applying a maximum cutoff to the 
sampled waveform.  To acheive a richer effect, you could use Fourier
analysis to decompose the waveform into componenet frequencies, and 
apply different cut off levels to each frequency range.

--  
Peter Becker - via FidoNet 5:494/5
UUCP: uunet!m2xenix!quagga!bberry!492!6!Peter.Becker
ARPA: Peter.Becker@f6.n492.z5.fidonet.org