losnoco / Cog

Cog - A Free and Open Source Audio Player for macOS 10.13+
https://cog.losno.co
GNU General Public License v2.0
651 stars 45 forks source link

Gapless on 320kbps MP3 no longer working. #250

Closed HomeStarRunnerTron closed 2 years ago

HomeStarRunnerTron commented 2 years ago

Hi-- thank you so much for maintaining the best, sleekest audio player on the Mac. Recently, I think about since I've updated to Monterey, 320kbps MP3 gapless playback isn't happening-- there's a discernable glitchy gap that occurs between songs that should seamlessly transition into each other. If I take those same MP3s and convert them to WAV or FLAC, I get the gapless playback. I'm currently on the newest Monterey, 12.3.1, and I can say that the Mac port of foobar2000 (while not lookin' so hot) does have gapless playback for these same MP3s I'm having issues with.

kode54 commented 2 years ago

Send me your gapless MP3 files, and I'll look at them. I switched to a different MP3 decoder, and the gapless info headers are processed differently now. I need to know which format of headers I'm dealing with here.

HomeStarRunnerTron commented 2 years ago

Absolutely, thank you SO much. https://www.dropbox.com/s/76e1m7sv1t5qyca/TCGTTG_SEPARATES.zip?dl=0 <-- Specifically, you can see gapless transitions on display in-between Tracks 1 & 2, 2 & 3, 5 & 6, 6 & 7, 7 & 8, 14 & 15, and 15 & 16.

kode54 commented 2 years ago

Okay, this was entirely my fault, and a recent change that fixed something else, also broke this. I'll push the new version.

Would love to know where you got the full version of this mixtape album, since I can only find mention of it on the author's Bandcamp, and it doesn't have the obvious collection of copyrighted music thrown into the mix tape, just something he himself made.

Oh yeah, and this is 192kbps. But yeah, the issue affected all MP3s. Whoops. Will describe the problem fully in the commit message.

HomeStarRunnerTron commented 2 years ago

Oh, yes! Sorry for the miscommunication on the 320kbps, I had both 192kbps and 320kbps MP3 stuff I was testing out. -- Oh, I made this mixtape, and this is the full mixtape! It's just my take on the album in question by Porter Robinson, since the original had no seamless transitions, and I wanted to add in that kind of stuff for a true album experience.

kode54 commented 2 years ago

Oh cool, I thought your profile picture looked like your profile on Bandcamp. Thanks for the album, by the way. It does seem to play seamlessly now.

kode54 commented 2 years ago

Incidentally, I also support iTunes gapless info, as silly at that functionality ends up being to implement, even though iTunes and Music.app/CoreAudio's encoder is negligibly inferior to LAME.

It's a funny format, too, as it involves storing a string of hexadecimal numbers in a COMM (comment) frame in the ID3v2 tag. foobar2000 supports this method as well, and thanks to the Hydrogen Audio users for deciphering the fields of that text.

This also made me think someone's iTunes encodes on Bandcamp were broken because iTunes was missing, but it later turned out that Mogi Grumbles did a poor job of mastering End of Line, and I more recently ended up manually deleting the gaps from the tracks in Audacity. Little story to go with some of my development and audio collecting process, as this gappy album is what someone sent to me to fix gapless support, and I ended up buying it even though it was a $0+ album.

HomeStarRunnerTron commented 2 years ago

Yes, that's my Bandcamp, haha, I DO do original music, good sleuthing.

OH HALLELUJAH, I just downloaded your latest pull, and it really DOES fix the gapless issue on everything! Man, you performed a miracle in less than a day, you mad genius, you! So relieved to have my favourite way to listen to new music quickly back.

So happy you're not being mean about my taste in music, I was honestly expecting more of an amused "well, whatever music floats your boat" type of response, hahaha. Makes me so happy to see that someone who maintains an open-source music player is actually actively INTERESTED IN MUSIC. (I can hardly believe it!!) Oh, never heard of Mogi Grumbles until now, Michigan sure has been home to lots of amazing indie musicians over the years. And I really respect that you decided to purchase an album just because you could along this glitch-fixing path. Gotta collect musical memories along the way! : ) Clever fix of the gaps-- I exported out my mixtape's separate MP3s from a giant WAV through Audacity, too. (Adobe Audition actually CONSTANTLY created issues when I tried to make multiple split MP3s, so Audacity's got a leg up on that pile.) Open-source forever.

kode54 commented 2 years ago

You may wish to check these newer commits, too. I fixed some gapless issues dealing with resuming playback position on restart. I'll be pushing a signed and notarized release as soon as it finishes archiving.

kode54 commented 2 years ago

Oh, incidentally, XLD, also Open Source software, can do the gapless LAME encoding from a batch of individual FLAC files, too. Or from a single FLAC or WAV and a CUE splitting them.

Or if you wanted to test out Apple's encoder, you could export to WAV or Apple Lossless, then use Music to convert them to MP3 files, which encodes quickly too.

But as I said, I only do that for testing functionality. LAME is marginally better, and also Open Source.

HomeStarRunnerTron commented 2 years ago

Wow, I only recently learned of XLD-- it sure is amazing at ripping any CDs I throw at it or perfectly splitting up a CD into its individual tracks if you give it a FLAC and a CUE. We sure got it good. And I'm currently avoiding Music and using iTunes through Retroactive, since I can have my beloved Cover Flow back! Thank you for the heads-up, though, maybe I can admit it DOES serve a purpose, begrudginglyyy...

kode54 commented 2 years ago

Well, I only tested it for conversion and to make sure I had the functionality working properly, for when people do need to use iTunes MP3s. XLD won't produce any that have that sort of header on them. It was sort of problematic for my scanner, since it meant I had to read the entire ID3v2 tag, and I had to incorporate another ID3v2 parser just to read the gapless tag. I use an entirely different library for the tags that show up in the playlist and info viewer.

Weird enough, I'm also probably the only macOS player to support Free Format MP3, up to 640kbps. Which is amusing and not terribly useful, but vaguely useful if someone insists on throwing you files in this format.

HomeStarRunnerTron commented 2 years ago

So sorry to come back again so soon-- I ran into another batch of MP3s I was trying to play that should have a seamless transition but don't: https://www.dropbox.com/s/jcko146gxvliaab/Carpenters%20-%20Close%20to%20You.zip?dl=0 If I play them in Foobar2000, they're fine, as well as iTunes. Or if I convert them to another type of MP3, they're fine, as well. But of course, that's not entirely optimal, to reconvert every MP3 I receive. Parts that should have seamless transitions are from Track 2 to Track 3, and Track 10 to Track 11. Once again, huge thank you for all the work you've put into this!

kode54 commented 2 years ago

Looks like there are two other possible tags for the LAME portion of the info tag. FFmpeg already handled those, and apparently foobar does too. Basically, not just the magic field of 'LAME', but also 'Lavf' or 'Lavc'.

HomeStarRunnerTron commented 2 years ago

SHOOT. I was just reading through my comments again and I realized that I'd sent you the wrong link-- I was always, like, "192kbps? No, my tracks were definitely 320kbps..." and wondering why you said you went to my Bandcamp. I MEANT to send you a mixtape I made of songs by Porter Robinson, but instead, I sent you my Christmas mixtape, where I wrote the second-to-the-last song! >_< Thankfully, the seamless playback problem was still applicable to both, but SO funny that I gave you the wrong explanation of where the music came from.

I made the mixtape I sent for Christmas-- specifically for a stranger on Reddit who said they normally made yearly Christmas mixtapes, but that 2020 had been such a tough time that they didn't feel they could. So I wanted to make this big seamless 42-song mixtape to bring back Christmas cheer! There's a lot of my own reworking throughout, and then the song "A Gift to u/" is my own composition I recorded. All the best, sorry for reawakening this, and I'm sure this doesn't matter to you, but just felt like correcting my mistake. I've been using Cog absolutely every day since you helped fix my problem, it's been a true joy and only runs better and better all the time! You're The Best.

Also, while I'm here, I made my own personal reskin of the new Cog icon, using the old symbols in the cog, as well as adding a little more metal texture, thought you might find it interesting: https://drive.google.com/drive/folders/1WhIRoRoN9S7uHQ6syWxjkihWARjthdLR?usp=sharing

kode54 commented 2 years ago

No, thank you for calling it to my attention. If you still want to share that other mixtape, my inbox is open. I thought the Christmas one was cute, especially the heartfelt story you narrated onto that track introducing your mix in the set. Plus, this seems to be something you didn't put on Bandcamp, and I don't know if it's something you shared widely. Thanks for that, though, I've listened to it a couple of times now.

HomeStarRunnerTron commented 2 years ago

Aw, wow, thank you, I'm blown away you've listened to it AT ALL! You're one of only, like, five people who have, yes, because I haven't shared it publicly. This is the actual way it was meant to be listened to-- I created a very simple HTML music player with stories written about each songs: https://www.skyetheguy.com/TCGTTG/ Thanks for making me feel like it might be worth sharing! All the best. : )