[gameprogrammer] Re: mixing sounds
- From: David Olofson <david@xxxxxxxxxxx>
- To: gameprogrammer@xxxxxxxxxxxxx
- Date: Tue, 5 Aug 2008 02:19:24 +0200
On Tuesday 05 August 2008, Alan Wolfe wrote:
> Thanks David, I was hoping you would respond to this one hehe
The audio hacker to the rescue! :-D
> I'm actually using double's to work with the sound data before
> converting it back to ints to go on disk. So, could i just add all
> the voices together then scan the samples, looking for the largest
> absolute value and if that's greater than 1.0 divide all samples by
> that largest number to get back into the range -1 to +1?
Ah! You're doing it off-line. That simplifies matters a little bit.
Well, at least you won't have to worry about latency. :-)
Yes, normalizing (or maximizing) like that works just fine, at least
with "nice" sounds and mixes. There is a significant performance
impact for large files, as you'll have to render the whole "track"
and then make another pass to scale it - but that's probably
irrelevant unless you're working on an interactive editor that has to
deal with massive amounts of data.
A problem you might run into is that a single tiny peak somewhere (too
many simultaneous sounds accidentally falling into phase for a
moment) can drastically lower the overall volume of the output. This
is actually the main reason why one uses various forms of dynamic
compressors, regardless of whether it's possible to analyze the
whole "stream" before processing. Doing it off-line just makes it
slightly easier to achieve good results.
> Hey btw do you know any sites that would help in learning how to
> code things like chorus, reverb, echo and other effects?
This place has a lot of info and examples in various forms:
http://musicdsp.org/
The people behind that site tend to hang around the music-dsp mailing
list:
http://music.columbia.edu/cmc/music-dsp/
> Thanks for your help (:
No problem! :-)
//David Olofson - Programmer, Composer, Open Source Advocate
.------- http://olofson.net - Games, SDL examples -------.
| http://zeespace.net - 2.5D rendering engine |
| http://audiality.org - Music/audio engine |
| http://eel.olofson.net - Real time scripting |
'-- http://www.reologica.se - Rheology instrumentation --'
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
- References:
- [gameprogrammer] mixing sounds
- From: Alan Wolfe
- [gameprogrammer] Re: mixing sounds
- From: David Olofson
- [gameprogrammer] Re: mixing sounds
- From: Alan Wolfe
Other related posts:
- » [gameprogrammer] mixing sounds
- » [gameprogrammer] Re: mixing sounds
- » [gameprogrammer] Re: mixing sounds
- » [gameprogrammer] Re: mixing sounds
- [gameprogrammer] mixing sounds
- From: Alan Wolfe
- [gameprogrammer] Re: mixing sounds
- From: David Olofson
- [gameprogrammer] Re: mixing sounds
- From: Alan Wolfe