'Cut and fade at start and end of mp3 with ffmpeg or sox

I've got a folder of mp3 files. They all vary in duration, but otherwise they're all in the same format. For a two minute file, it would look like this:

00:00 Spoken word intro
00:30 Musical intro
00:40 CONTENT
01:30 Musical outro
02:00 End

... but the mp3s can vary in duration, so a 5 minute file would have the musical outro at 04:30.

I would like to remove the first 30 secs and last 20 secs, and fade in and out (5 secs) the remaining sound. Is there a way to do this with either ffmpeg or sox?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source