[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Program to modify RMS levels

Mitchell Sommers wrote:
> Does anyone know of software that will allow users to modify (specify)
> RMS levels.  Ideally, it would accept .wav files but this is not a necessity.
> I have several hundred speech files that I'd like to equalize based on RMS
> levels so batch processing would be essential.

you can do this easily with the Praat program (www.praat.org).
It can be automatized with a Praat script, e.g. something like

form Equalize RMS levels
   real New_RMS_level_(Pa) 0.1
   comment Do it for all the WAV files in the source directory:
   text sourceDir d:\my raw stuff
   comment Put the equalized WAV files in the target directory:
   text targetDir d:\my equalized stuff
Create Strings as file list... list 'sourceDir$'\*.wav
numberOfFiles = Get number of strings
for ifile to numberOfFiles
   select Strings list
   filename$ = Get string... ifile
   Read from file... 'sourceDir$'\'filename$'
   oldRmsLevel = Get root-mean-square... 0 0
   Formula... 'new_RMS_level'*self/'oldRmsLevel'
   extremum = Get absolute extremum... 0 0 None
   if extremum > 0.99
      exit We refuse to clip the samples in file "'sourceDir$'\'filename$'"!!!
   Write to WAV file... 'targetDir$'\'filename$'
echo Successfully equalized 'numberOfFiles' WAV files.

This equalizes all the files in the directory "d:\my raw stuff",
or in any other directory that you specify.
By default, it would change all the RMS values to 0.1 "Pascal".
If any sample gets outside the [-1; +1] range,
the procedure is stopped because some samples in the resulting
WAV file would be clipped. One can experiment with the RMS level
setting in order to prevent this from happening.
On the Macintosh, directories have to be specified like
"Macintosh HD:My raw stuff", and the backslash becomes a colon.

Test before use!

Best wishes,

Paul Boersma
Institute of Phonetic Sciences, University of Amsterdam
Herengracht 338, 1016CG Amsterdam, The Netherlands
phone +31-20-5252385