Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: MP3 Concatenation

by andyf (Pilgrim)
on Jun 11, 2004 at 19:34 UTC ( [id://363511]=note: print w/replies, xml ) Need Help??


in reply to MP3 Concatenation

Compression

Sound files come in two distinct flavours, linear and compressed. Linear files are .wav and family, while compressed files include .mp3 and others. The main difference is that you can directly edit a linear sound file, each value in the simple time ordered list is a amplitude value (sample) for that sound. Compressed formats are composed of frames. Even if you can get an edit directly on a frame boundary the results are often terrible clicks because the uncompressed (recovered) value of a frame depends on its predecessors, hence arbitary frame sequences may be illegal. The prefered method in all cases is to convert to a simple time domain form , then edit, then convert back to mp3.

Editing

Practical editing to achieve your first goal, trimming, is called auto-trimming. The Windows application Sound Forge (which also imports and exports .mp3 files) has a very nice built in function to remove silence. You should also look at the open source Audacity which is scriptable in Lisp. Audio editing terminology is generally 'cutting' a piece of audio out and 'splicing' a piece of audio in. 'butt joins' (pure concatenation) is rare, usually you will use a crossfade. The parameters of each audio segment are therefore, start time, end time, and a transfer function which says how the clip you have cut will fade into the next. Removing silence works by scanning the file to find the rms (root mean square) of lowest average signal level, the noise floor, and chop out all the bits where the signal falls below this. You can get special plugins that are very effective at doing this on voice signals (for exactly your stated application ). My gut instinct is _not_ to try signal processing in Perl, but I haven't tried it (yet) and don't speak from experience. For batch processing offline files it might be effective but slow.



Note: using a very high threshold as a parameter to auto-trimming has an interesting side effect... you actually remove the silences between words and alter the timing of spoken phrases, normally (for TV and Radio) this would be totally unacceptable, but as a study aid the upshot is that you get much better retention because the timescale of the entire lectures salient features is possibly 20% or less of the original.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://363511]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2024-03-28 10:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found