Re: lame inserting 0.047 seconds of silence in the beginning of the mp3 file

Thomas Orgis <[email protected]>
Newsgroups gmane.comp.audio.mp3.lame
Message-ID <[email protected]>
Am Thu, 23 Feb 2012 17:10:39 +0100
schrieb nick humphrey <[email protected]>: 

> i dont understand. the mp3 file is encoded from a wav source file using
> *lame*. what does audacity or mpg123 have to do with it? it seems like
> you're suggesting that the silence is normal/intended and that the program
> you play it with is supposed to cut out the silence??? or have i
> misunderstood?

You understood correctly. The MP3 format includes encoder and decoder
delays; at least it should be obvious that it needs to bring the sample
count to a multiple of the MPEG frame size. There are technical reasons
for this. Lame is helpful in telling how many samples it added, the
decoder needs to interpret that (and deal with its own delay, too).

Most players don't really care about that (or did in the past, at
least), and in fact many people think MP3 files cannot be "gapless".
But they can; I specifically worked on that feature in the mpg123
decoder.

> i run this:
> mpg123 --loop 4 funky_drummer_1.mp3
>
> and the silence is there. it doesnt loop smoothly.

Can you send me (personal mail, the list might not like this) the WAV
and MP3 to verify what is going on there (I hope it's a small sample
file)?

Are you really using mpg123 or is this mpg321 masquerading as mpg123
(this should be less  common nowadays, but to make sure, please have a
look at `mpg123 --version`)?

This works for me:

shell$ lame left.wav left.mp3
LAME 3.98.2 64bits (http://www.mp3dev.org/)
Using polyphase lowpass filter, transition band: 16452 Hz - 17032 Hz
Encoding left.wav to left.mp3
Encoding as 48 kHz j-stereo MPEG-1 Layer III (12x) 128 kbps qval=3
    Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA 
    80/80    (100%)|    0:00/    0:00|    0:00/    0:00|   32.000x|    0:00 
------------------------------------------------------------------------------------------------------
   kbps        LR    MS  %     long switch short %
  128.0       98.8   1.2        91.9   5.0   3.1
Writing LAME Tag...done
ReplayGain: -6.1dB

shell$ mpg123 -w left_again.wav left.mp3
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
	version 1.13.4; written and copyright by Michael Hipp and others
	free software (LGPL/GPL) without any warranty but with best wishes

Playing MPEG stream 1 of 1: left.mp3 ...
MPEG 1.0 layer III, 128 kbit/s, 48000 Hz joint-stereo

[0:01] Decoding of left.mp3 finished.

shell$ ls -l left*.wav
-rw-r----- 1 thomas users 358700 23. Feb 22:18 left_again.wav
-rw-r----- 1 thomas users 358700 11. Aug 2010  left.wav

Input and output WAV do have the same size. That's how it should be.
Can you do that test with your setup? If you have the same size but
still a gap when looping, then perhaps it's an issue with the audio
output code. With plain ALSA, I can play MP3 albums ripped from CDs
that have the tracks seamlessly blended into one another and not notice
any gap.


Alrighty then,

Thomas.

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/

_______________________________________________
Lame-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lame-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.