Bug 8877 - MP3 cue sheets are not gapless
: MP3 cue sheets are not gapless
Status: RESOLVED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Formats
: 7.4.0
: PC Windows XP
: P3 normal with 1 vote (vote)
: Future
Assigned To: Andy Grundman
:
Depends on:
Blocks: 3610
  Show dependency treegraph
 
Reported: 2008-07-25 17:07 UTC by Julius Dauz
Modified: 2010-06-08 14:36 UTC (History)
3 users (show)

See Also:
Category: ---


Attachments
Flac file (50.42 MB, application/octet-stream)
2008-07-25 17:07 UTC, Julius Dauz
Details
cue sheet for flac file (558 bytes, text/plain)
2008-07-25 17:08 UTC, Julius Dauz
Details
mp3 file (15.12 MB, audio/mpeg)
2008-07-25 17:08 UTC, Julius Dauz
Details
cue sheet for mp3 file (613 bytes, text/plain)
2008-07-25 17:09 UTC, Julius Dauz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Julius Dauz 2008-07-25 17:07:13 UTC
Created attachment 3685 [details]
Flac file

A customer is running into an issue where he has a long MP3, that contains multiple tracks in one file. He then has a Cue sheet in the same folder as the file that virtually splits the mp3 into seperate tracks, mainly to display what track is playing and not to split it to add gaps. 

The issue he is seeing or hearing is there is a sort of glitch between each track. It sounds almost like a sloppy transition between songs. This issue is occuring with a mp3 file + cue sheet, but not with flac files. 

I have tested a couple sample files from the customer and have heard this glitch or skip sound. I tried the MP3 file on a software based mp3 player and you cannot hear this glitch. 

I have attached a couple sample files and their corresponding cue sheets. There is an MP3 version of the file and a flac version of the same flle.
Comment 1 Julius Dauz 2008-07-25 17:08:01 UTC
Created attachment 3686 [details]
cue sheet for flac file
Comment 2 Julius Dauz 2008-07-25 17:08:28 UTC
Created attachment 3687 [details]
mp3 file
Comment 3 Julius Dauz 2008-07-25 17:09:15 UTC
Created attachment 3688 [details]
cue sheet for mp3 file
Comment 4 Chris Owens 2008-07-28 09:33:15 UTC
What version of SC did this happen with?
Comment 5 Ben Thomas 2008-07-28 09:47:56 UTC
SqueezeCenter Version: 7.0.1 - 19705 
Comment 6 James Richardson 2008-08-01 14:22:51 UTC
Please retest with SqueezeCenter 7.1-22170 as I am unable to hear any issue with the attached sample files.
Comment 7 Ben Thomas 2008-08-01 15:44:46 UTC
I have tested with the new version today and the problem still exists.

You'll need to really listen carefully to all the transitions... the problem differs for each transition and is a "glitch" sound as if a few frames of the mp3 have been skipped.
Comment 8 Andy Grundman 2008-08-04 12:15:17 UTC
Yeah there is definitely a bug, probably related to samples being dropped for LAME gapless.
Comment 9 Andy Grundman 2008-08-04 13:33:28 UTC
Turns out the problem is that the location where we split the original file is not determined properly, it needs to avoid cutting an mp3 frame in half.
Comment 10 Andy Grundman 2008-08-04 16:14:06 UTC
Ben, did this work with any previous version?
Comment 11 Ben Thomas 2008-08-04 18:08:20 UTC
(In reply to comment #10)
> Ben, did this work with any previous version?
> 

I'm afraid I only bought the Squeezebox fairly recently so I have only had chance to test it with 7.0.1 and 7.1.

Ah, I thought it would be to do with splitting the MP3, apologies for not mentioning that on the bug report. I mentioned it on the support request but forgot to on here.

Out of interest, why does the mp3 ever need to be physically split/changed (assuming that is what's happening - maybe it's not)?
Comment 12 Andy Grundman 2008-08-04 18:18:45 UTC
Here is a good thread on why splitting mp3 files without decoding is tricky to do correctly.

http://www.hydrogenaudio.org/forums/index.php?showtopic=34848

The way SC does cue sheets is to split the track up into smaller 'virtual' tracks and send those to the player separately.  So this has never worked correctly and will require more work to fix than we can do for 7.2.  The reason we do it this way is that our architecture really only deals with individual files.  Sending a single file to the player while displaying virtual tracks on top of it is possible but more work than the right fix for this bug.

I will commit what I have so far which is to split mp3 tracks on a frame boundary and skip LAME headers in the first chunk which avoids gapless handling when it isn't needed.

The additional work that needs to be done is to split the tracks  accounting for the bit reservoir by dynamically adding a silence frame as well as dynamically writing a new LAME tag to skip the silence frame at the start of these chunks.

Related to this bug is a new enhancement I filed, bug 9036, which is to support proper split points for VBR files.
Comment 13 Ben Thomas 2008-08-04 18:42:01 UTC
Yeah, I'm aware of the difficulties with splitting mp3s. I read loads of stuff about it on hydrogenaudio a while ago. 

Thank you for the detailed response on how the Squeezebox currently handles this and what the resolution is. I appreciate it.

I look forward to version 7.3 in the future then! :)

Thanks again and good luck.
Comment 14 Andy Grundman 2008-08-04 18:53:08 UTC
A workaround if you are willing to split your files until we can get this resolved.  The pcutmp3 tool on HA cuts properly, rewrites the LAME tags, and results in perfect gapless playback with SC 7.1+.

http://jaybeee.themixingbowl.org/other/pcutmp3.jar

Discussed at great length in this thread: http://www.hydrogenaudio.org/forums/index.php?showtopic=35654
Comment 15 SVN Bot 2010-06-08 14:36:33 UTC
 == Auto-comment from SVN commit #30854 to the slim repo by agrundman ==
 == http://svn.slimdevices.com/slim?view=revision&revision=30854 ==

Fixed bug 8877, gapless playback for MP3 cue sheets