View Single Post
  #6 (permalink)  
Old 02-25-2004, 04:21 AM
Bob Cain
Guest
 
Posts: n/a
Default Re: Is there a quick, not much processing time needed, way to makethe same volume on a 16 signed int stream in real time?

SA Dev wrote:

>
> I'm sorry I'm not giving enough info. I am working with software that
> emulates old arcade games, each arcade game may play its sound at a
> different volume. Most of the games use old antiquated sound chips, or even
> discrete components to generate the sound. What I would like to do is make
> all the games have the same volume. I have access to a function that gets
> each sample and can change it.


Must this be done in real time or is it possible to analyze
the sound produced by each game as it is installed, for
example? If the latter, you can do the root mean square
calculation to determine an average level for each such
game, save it somewhere, and apply a fixed gain (numerical
multiplication factor) to each sample at play time that is a
the ratio of the desired average level to the predetermined
level of the game.

To do this purely in real time will require "automatic level
control" wherein you compute a real time approximation to
the RMS value and adaptively adjust a gain accordingly which
you apply to the samples as you play them. I haven't done
that myself but I'm sure someone here can offer a snippet of
C code that does the ALC sensing and gain application.


Bob
--

"Things should be described as simply as possible, but no
simpler."

A. Einstein
Reply With Quote