RE: WAV functions

new topic     » topic index » view thread      » older message » newer message

Derek:
I think the best (and standard) way to do it is by adding signed values (in
a .WAV they are integers) to obtain floating values. While doing this,
compute the maximum absolute value of the resulting file. Then, read back
the file and divide the floating numbers into this maximum value, and then
output integers that will span the full range -32767 to 32767 (notice that
usually -32768 will not be available). This is called "normalizing".
Diminishing the volume of individual voices is unavoidable, but this
technique will minimize the effect. The total volume will be at its maximum
possible value.
When processing stereo sound, you have the option of normalizing both
channels using the same maximum, or normalize each channel individually.
This last option will raise the overall volume.
"Lots of tracks" (how many?) will introduce some distortion, but this will
happen also in a real scenario, say an orchestra. Conductors know that, and
the solution is to make all performers to stay in tune ;). This type of
distortion is not what is called "intermodulation", which is an artifact
introduced by analog devices. Digitally processed sound does not introduce
intermodulation, as far as I know.
However, your methods a) and c) will generate intermodulation. Method b)
will result in a sound equivalent to the one obtained by normalizing, but
with a somewhat lower volume.
Methods a) and c) may be used to get interesting effects, mainly to add
harmonics. Ring modulation consists in applying bitwise OR, AND, XOR, etc.
between samples.
I have not tried to apply the delta (not sure about what it is, but I can
imagine it) between adjacent samples, but this seems a good idea for a wave
generator I am working in. I'll try it.
Regards.
----- Original Message -----
From: Derek Parnell <ddparnell at bigpond.com>
To: EUforum <EUforum at topica.com>
Sent: Thursday, May 22, 2003 11:00 PM
Subject: WAV functions


>
>
> To: Daryl van den Brink
>
> Do you know a good algorithm to combine two or more WAV files?
>
> I've written an amusement for myself. Its a little application that I can
> use to write music with. It works on the principle of creating 'voice'
> tracks and then combining them into the final WAV file. The current
> algorithm I use sort of works, but it has the side-effect of diminishing
> the volume of the sound. Also, when working with lots of tracks, some
> distortions are introduced.
>
> In fact I've tried a few algorithms but none have really worked well. The
> ones that have given me the most promising results have been ...
>
> a) Find the geometric mean of the corresponding sample values.
> b) Find the arthimetric mean of the corresponding sample values.
> c) Find the geometric mean of the absolute value of the corresponding
> sample values.
>
> But I'm thinking that I really need to use the delta between adjacent
> samples instead. I haven't tried this yet because I really don't know
> enough about the subject.
>
>
> I'd post the code but its not ready for serious reviewing yet - most is
> very experimental.
>
> --
>
> cheers,
> Derek Parnell
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu