[comp.music] Books on massaging waveforms...

tonyg@batserver.cs.uq.oz.au (Tony Gedge) (06/27/90)

Can someone point me towards a good starting book in manipulating
sampled sound?  I want to do things like:

  * Raise and lower the pitch of samples without changing the speed
        that samples are played.
  * Mix two or more samples together.
  * Change the sampling rate.

An probably other things as well.

Please e-mail.  If anyone wants a copy of the information I get, send
me e-mail and I'll pass it on.  If there is sufficient interest, I will
summarize to the net.

Tony Gedge.

--
 -------------------------------------------------------------------------
| Computer Science Department,        | tonyg@batserver.cs.uq.oz.au       |
| University of Queensland, Australia.| "cc stands for Cryptic Crossword" |
 -------------------------------------------------------------------------

sandell@ils.nwu.edu (Greg Sandell) (06/28/90)

In article <4090@uqcspe.cs.uq.oz.au>, tonyg@batserver.cs.uq.oz.au (Tony
Gedge) writes:
> Can someone point me towards a good starting book in manipulating
> sampled sound?  I want to do things like:
> 
>   * Raise and lower the pitch of samples without changing the speed
>         that samples are played.
>   * Mix two or more samples together.
>   * Change the sampling rate.
> 

I would get the new book on Computer Music by F. R. Moore which is out
in Prentice-Hall, 1990.  The title is something like (sorry, I don't have it
here in my office) THE ESSENTIALS OF COMPUTER MUSIC.  

The task of changing the pitch of a soundfile without changing its apparant
speed or duration (which is what I think you are trying to describe above)
is a problem which requires large amounts of number crunching; it takes 
quite a long time to make such a conversion (like, maybe 60 seconds for 
a one second soundfile on a powerful computer).  The
algorithm I know of which does this is the Phase Vocoder, for which
C code is provided in Moore's book.

The second two questions I don't know quite as much about, but I believe
if you simply add samples together and then normalize them so you don't
get samples out of range, you get mixed samples.  For changing the
sampling rate, if you are going from a higher sampling rate to a lower
one, you can keep one sample, delete the next (new_samp_rate/old_samp_rate) 
samples, and keep doing this for the rest of the soundfile.  I have done this
in going from 22000k to 8000k and the results sound just fine.  Somehow
I suspect this is not the most HiFi way to do this task, though.  As for going
from a smaller sampling rate to a larger one, the strategy of duplicating
samples in the equivalent way will *definitely* not work!  

alves@alcor.usc.edu (William Alves) (06/30/90)

>In article <4090@uqcspe.cs.uq.oz.au>, tonyg@batserver.cs.uq.oz.au (Tony
>Gedge) writes:
>> Can someone point me towards a good starting book in manipulating
>> sampled sound?  I want to do things like:
>> 
>>   * Raise and lower the pitch of samples without changing the speed
>>         that samples are played.
>>   * Mix two or more samples together.
>>   * Change the sampling rate.
>> 
Try "Programs for Digital Signal Processing" (IEEE press, 1979). It con-
tains many sample programs (unfortunately all in Fortran) to do all of
what you're asking and much more. To mix 2 samples, simply add them, taking
care that the sum doesn't go out of range. The easy (but not optimal) way
to do this is to divide each one by 2 before adding. The optimal way would
be to have a normalization pass.

In article <987@anaxagoras.ils.nwu.edu> sandell@ils.nwu.edu (Greg Sandell) writes:
>For changing the
>sampling rate, if you are going from a higher sampling rate to a lower
>one, you can keep one sample, delete the next (new_samp_rate/old_samp_rate) 
>samples, and keep doing this for the rest of the soundfile.  I have done this
>in going from 22000k to 8000k and the results sound just fine.  Somehow
>I suspect this is not the most HiFi way to do this task, though.  As for going
>from a smaller sampling rate to a larger one, the strategy of duplicating
>samples in the equivalent way will *definitely* not work!  

Your results probably sounded okay because you didn't have too much frequency
information above the new Nyquist frequency. If you did, you would experience
aliasing. Thus your suspicions are correct. One should first apply a low-pass
filter to make sure this doesn't happen. Likewise, when interpolating samples
(smaller to larger sampling rate), one must take care that the new samples
don't introduce unwanted frequencies.

Because this is a fundamental function of samplers, several solutions have
been developed. One of the fastest is detailed in the following paper:
Andy Duncan and Dave Rossum, "Fundamentals of Pitch Shifting," presented 
at the 85th convention of the Audio Engineering Society, preprint #2714 
(1988). These are the fellows who developed the Emulator at Emu.

Bill Alves

mu298ac@sdcc6.ucsd.edu (Philip Marlowe) (07/07/90)

In article <987@anaxagoras.ils.nwu.edu> sandell@ils.nwu.edu (Greg Sandell) writes:
>In article <4090@uqcspe.cs.uq.oz.au>, tonyg@batserver.cs.uq.oz.au (Tony
>Gedge) writes:
>> Can someone point me towards a good starting book in manipulating
>> sampled sound?  I want to do things like:
>
>I would get the new book on Computer Music by F. R. Moore which is out
>in Prentice-Hall, 1990.  The title is something like (sorry, I don't have it
>here in my office) THE ESSENTIALS OF COMPUTER MUSIC.  

	The title is ELEMENTS OF COMPUTER MUSIC by F. Richard Moore
(Prentice Hall, Englewood Cliffs, 1990; ISBN # 0-13-252552-6).  I am
plowing through it right now, at Professor Moore's suggestion.  I have
two caveats about the book:

	1.  It presumes strong familiarity with a programming
language, preferably C.

	2.  The book is laden with misprints.  There are entire
pages of code missing, mislabeled examples, etc.

	My roommate took a course with Moore which used this text.
By the end of the quarter, he had:  designed time-varying filters;
adapted code in Moore's book to write his own phase vocoder;
implemented linear prediction, again based on code supplied in
Moore's book.

	I must stress, however, that there are very serious
misprints.  If you do shell out thirty bucks for the book, be sure to
write the publisher and ask for errata--Moore has been compiling a
list since the book came out.  Once the errors are corrected, the
book will be wonderful!

				Chris Hertzog

gene@dept.csci.unt.edu (Gene De Lisa) (07/07/90)

In article <11785@sdcc6.ucsd.edu> mu298ac@sdcc6.ucsd.edu (Philip Marlowe) writes:
>(Prentice Hall, Englewood Cliffs, 1990; ISBN # 0-13-252552-6).  I am
 ELEMENTS OF COMPUTER MUSIC, 
>plowing through it right now, at Professor Moore's suggestion.  I have
>two caveats about the book:
>
>	2.  The book is laden with misprints.  There are entire
>pages of code missing, mislabeled examples, etc.
>
>	I must stress, however, that there are very serious
>misprints.  If you do shell out thirty bucks for the book, be sure to
>write the publisher and ask for errata--Moore has been compiling a
>list since the book came out.  Once the errors are corrected, the
>book will be wonderful!


Is Prentice hall planning a second ed. (or printing) soon?
-- 
Gene De Lisa

"Ducking for apples--change one letter and it's the story of my life"
Dorothy Parker(1893-1967) (spoken at a halloween party)