[LAU] Level Matching

Rob lau at kudla.org
Tue Nov 4 09:45:50 EST 2008


On Tuesday 04 November 2008 02:29, Patrick Shirkey wrote:
> So what the original poster wants is to add a compressor to the output
> path for amarok or whatever audio track player is being used...
> Jack-rack would probably do but surely someone has written a nice
> compressor interface for sc4 by now?

I have a script that makes highly compressed, reduced frequency and bitrate 
mp3s of my entire collection, and for that, plain old sox works fine.  
Normally, I would use a plugin for this sort of thing, but since I most 
often listen to mp3s in the car and no portable mp3 player I've ever owned 
(from a $30 MP3 CD player to my current 160GB Archos jukebox) has had the 
kind of compression I'm looking for, maintaining the second set of mp3s 
works better for me.

Here are the relevant lines:

(where $mp3 is the mp3 file, and $resamp contains a sox resample clause 
when the mp3 isn't 22.05KHz to begin with)

my $maxfac = `sox "$mp3" -e stat 2>&1 | grep Volume.adjustment`;
if ($maxfac =~ /Volume adjustment:\s+(\S+)/) {
       	$maxfac = $1;
} else {
	$maxfac = 1.0;
}
system("sox -v $maxfac \"$mp3\" -r 22050 /tmp/mp3carencode-$$.wav $resamp 
compand 0.1,0.1 -120,-20,-60,-15,-40,-15,-20,-9,0,-8 0 -6 0.1");

I'd paste the whole script, but since it's oriented around traversal of my 
own mp3 tree and creating a second, compressed tree, it wouldn't be of 
general use.  

The above compression values are pretty severe, so someone who just wants 
their collection to all be the same volume will probably want to tweak 
them (the comma-separated values are input and output volumes in dB.)  My 
partner used the same compression settings without a frequency conversion 
for his own listening on headphones and speakers, but his ears started 
going long before he did.

Rob



More information about the Linux-audio-user mailing list