views:

16

answers:

2

I've got a flash 10.1 app that lets me record microphone input to a wav without a media server, which I am saving to an Amazon S3 bucket.

I have another process running on a server which gets wavs from this bucket, converts to mp3 using LAME and puts them into another bucket. This all works fine, but in converting wav > mp3, about 0.1sec or so of silence is added to my sound.

In the application this are being used in, perfect sync is critical, so I need to trim off that little bit. If I have to trim it off the original waveform that is okay, I don't expect anything important to happen in that first fraction of a second.

What is the best way to go about this? I am using Adobe's WavWriter to convert by ByteArray into a proper waveform. Is there a way I can easily trim off the first few samples from my ByteArray without invalidating the structure?

Alternatively, is there a good server-side tool I can use to trim the wav before running it through LAME, or an argument I can give LAME? Or, could I even trim that sound off the mp3 after it has been converted?

Thanks!

+2  A: 

The problem is with the MP3 format itself. MP3 requires files to be a certain multiple of length, and LAME adds in the silence to meet this standard.

There is a workaround, check out this post by Andre Michelle

davr
So even if I was to trim off enough to compensate the gap, the encoder may add on a new gap anyway?
Lowgain
A: 

I was able to trim the gap off with mp3splt server-side after saving

Lowgain