views:

315

answers:

3

I'm trying to write a batch process that can take an MP3 file and mute certain parts of it, ideally in Python or Java.

Take this example: Given a 2 minute MP3, I want to mute the time between 1:20 and 1:30. When saved back to a file, the rest of the MP3 will play normally -- only that portion will be silent.

Any advice for setting this up in a way that's easy to automate/run on the command line would be fantastic!

+1  A: 

SoX is a multi-platform sound editing tool and I've used it a lot in the past. More info at http://sox.sourceforge.net/

I don't think you can mute a section of an MP3 file with a single command though. You could split the file into 3 parts, mute the middle part, then stitch them together again.

Hope that helps

Al
Splicing and re-combining is a great idea and looks quite simple with SoX. Thanks a ton!
Gregor Hochmuth
A: 

Audacity (available for Windows, Mac, Linux) has a plugin (currently for Windows only) that allows it to be scripted. The target language is Perl, but perhaps Python would work.

There's also a built-in XLisp interpreter called Nyquist.

Nosredna
A: 

Or use Xuggler to decode the MP3 file, mute out the audio you care about, and then re-encode.

Xuggle