views:

394

answers:

2

I need to know if it is possible to create a 30 second sample MP3 from a WAV file. The generated MP3 file must feature a fade at the start and end.

Currently using ffmpeg, but can not find any documentation that would support being able to do such a thing.

Could someone please provide me the name of software (CLI, *nix only) that could achieve this?

+4  A: 

Check out SoX - Sound eXchange

I have not used it myself but one of my friends speaks highly of it.

From web page (highlighted my me):

SoX is a cross-platform (Windows, Linux, MacOS X, etc.) command line utility that can convert various formats of computer audio files in to other formats. It can also apply various effects to these sound files, and, as an added bonus, SoX can play and record audio files on most platforms.

Nifle
Yes, SOX does the thing ( take a look at the manual http://linux.die.net/man/1/sox ).
Quamis
A: 

The best way to do this is to apply the 30-second truncation, fade in and fade out to the WAV audio data before converting it to an MP3. If your conversion library has a method that takes an array of samples, this is very easy to do. If the method only accepts a WAV file (either in-memory or on disk), then this is slightly less easy as you have to learn the WAV file format (which is easy to write but somewhat more difficult to read). Either way, applying gain and/or attenuation to time-domain sample data (as in a WAV file) is much easier than trying to apply these effects to frequency-domain data (as in an MP3 file).

Of course, if your conversion library already does all this, it's best to just use that and not worry about it yourself.

MusiGenesis