7 ms·
What I learned about MP3 encoding
- teraflop 3y agoCool project. But because this is a derivative work of the original shine library, it almost certainly isn't legal for you to relicense it from LGPL to MIT.
- diogenes4 3y ago> derivative work What a ridiculous concept. IP needs to die an ugly death.
- pavlov 3y agoThe GPL/LGPL isn’t IP in the same sense as Disney’s character portfolio or corporate patent trolling though. Many people would like to see the death of the latter kind of IP but not necessarily the “enforced sharing” version that GPL invented.
- diogenes4 3y ago> The GPL/LGPL isn’t IP in the same sense as Disney’s character portfolio or corporate patent trolling though. Sure, these licensing terms are meant to protect against said evils. They would also be unnecessary in a world that discarded the idea of owning data. And they're still ridiculous—especially copyleft.
- zigzag312 3y agoA bit off topic, does GPL IP ever expire?
- pwdisswordfishc 3y agoYes, like any copyright.
- 38 3y agocan anyone explain why I should care about MP3 anymore? YouTube hasnt used MP3 in years, they use Opus or AAC.
- supertrope 3y agoIf you don’t control both the encoding and playback ends, you have to accommodate legacy decoders. Podcasts use constant bitrate MP3 because it’s the lowest common denominator. Even though iPods popularized AAC, there are millions of clip-on MP3 players and car head units that don’t decode AAC and might even choke on variable bitrate MP3. Spotify still hasn’t migrated from Ogg Vorbis to Opus.
- CharlesW 3y agoYou don’t need to care about it, but (1) it did change the world, (2) it’s a good format to start with if you want to understand perceptual audio encoding, and (3) it is (only because of inertia, really) still used to deliver almost all open podcasting content.
- astrange 3y ago> it’s a good format to start with if you want to understand perceptual audio encoding It honestly isn't, it's actually more complicated than later codecs like LC-AAC for no benefit because of the weird filterbank thing. Though, I would start with ADPCM.
- Minor49er 3y agoThe vast majority of people on Soulseek are trading MP3s. Who cares what YouTube uses?
- astrange 3y agoDo they hate being able to hear cymbals or something? MP3 can't properly encode those even at 320k.
- 3y ago
- Pannoniae 3y agoThis blog post really feels like it was written for the sake of writing something. A C library mechanically translated to Go does not magically become a Go library, and the whole thing feels like cargo-culting. ("libc calls bad", "unsafe bad") I would like to ask, why was this blogpost written? What is the purpose?
- Minor49er 3y agoThe author is trying to draw more attention to his Quite OK Audio Format which has received positive attention on HN in the past https://news.ycombinator.com/item?id=34625573 https://news.ycombinator.com/item?id=34625573
- deleted 3y ago[deleted]
- Pannoniae 3y agoIs it his format? From what I see, the names don't match up
- sp332 3y agoIt's not on Braha's own list of projects https://resume.braheezy.net/ https://resume.braheezy.net/
- SushiHippie 3y agoIt's not his format. He just created a go implementation of that format https://github.com/braheezy/goqoa https://github.com/braheezy/goqoa
- lifthrasiir 3y agoWhile the Go community's dislike of CGO can be a bit unreasonable from time to time (in my humble opinion), the post does say that one couldn't build a CGO version of LAME binding, so turned to the (automated) source transpilation instead. This tells much about the "portability" of C in practice.
- CharlesW 3y ago> The Best MP3 Encoder is LAME The best open source MP3 encoder, which still makes LAME very important. If you need the absolute best MP3 encoder, ABX testing against Fraunhofer’s encoder tells the tale.
- pier25 3y agoCan you elaborate?
- djkoolaide 3y agoI'm interested in knowing more, but after a few minutes of searching, I can't seem to find a modern macOS implementation of the reference Fraunhofer codec. All my tools (Audition, xACT, ffmpeg, and even dbpoweramp) use various versions of LAME. Does Fraunhofer's encoder preserve above 20kHz at 320kbps?
- mannyv 3y agoApparently Music uses it...or at least it used to. https://podcastengineeringschool.com/itunes-uses-fraunhofer/ https://podcastengineeringschool.com/itunes-uses-fraunhofer/
- astrange 3y agoiTunes' MP3 encoder is awful, so that's not a good sign. It's iTunes' AAC encoder that's good.
- mannyv 3y agoHaven't encoded anything with iTunes/Music's mp3 encoder in years, ever since AAC came out. What's amusing is that speakers may have been optimizing themselves for LAME, since it's pretty much the dominant encoder.
- mannyv 3y agoAs an aside, the docs attached to the repo referenced above has the first good explanation of "joint stereo" I've ever seen. I remember seeing the "joint stereo" button on the first encoders, and nobody ever said what that actually did.
- hakunin 3y agoThis was an enjoyable light read. A window into solving a programming problem outside my day to day work, easy enough to follow, with a couple of fun concepts like "psychoacoustic model". Thank you for sharing.
- qup 3y agoOne of the first things I ever pirated was some mp3 library for vb6 (well...I also pirated vb6). I built an mp3 player called 3pm, so clever. It had a userbase of me and maybe 2 friends. It had AOL chat coms. Ha.
- pwdisswordfishc 3y ago> What I Learned About MP3 Encoding The author seems to have spent considerable effort on learning as little about it as possible. Most of this article talks about translating C to Go mechanically, without understanding the code. There is even a cameo of the Bullshit Eng—, er, ChatGPT. In other words, the title is misleading clickbait.
- lelanthran 3y ago> The author seems to have spent considerable effort on learning as little about it as possible. I agree that the article content was a bit of a letdown after I read the article title. I actually, really, did want to learn about MP3 Encoding.
- daniel-cussen 3y ago[dead]
- Analemma_ 3y ago> 16k lines of obscure C, riddled with pointer magic and arcane memory manipulations? No thanks! I swear I'm not trying to sound like an uppity, badass Real Programmer here, but this seems... not too bad? 16 kloc of C for what is apparently the gold standard in lossy audio encoding is actually less than I would have guessed.
- adgjlsfhk1 3y agosorry for the pedantry but gold standard lossy audio hasn't been mp3 for a decade. OPUS sounds better at roughly half the bitrate.
- hulitu 3y ago> OPUS sounds better at roughly half the bitrate. No, it does not.
- LoganDark 3y agoAnyone who's tried to use Discord for voice chat can tell you how bad OPUS is. Honestly hilarious.
- astrange 3y agoDiscord is encoding and streaming in realtime on top of a bunch of noise gating filters. Opus is the most efficient audio codec we've got. (For stereo anyway.) At high bitrates there might be better tuned ones, but also at high bitrates it doesn't really matter what you use as long as it's not MP3.
- HappyDaoDude 3y agoI'm not sure if it is the codec at issue there. I have only used Discord voice chat a few times being interviewed for podcasts and the quality at times is astoundingly good. That said, those doing the interviews are using higher end audio gear that most people would so that would go a long way to improving that. Generally when I am grabbing audio off Youtube via NewPipe, I generally use the 50kbs OPUS stream if it is just talking/lectures. I cannot tell the difference. That said I once did a FLAC to 128KBit OPUS test on myself with music convinced I would be able to tell the difference. I could not. I just don't have hearing that is sensitive to codec loss it seems.
- qwerty456127 3y ago> Open-source and hobbyist developers like myself are going to avoid anything involving patents. Do open-source and hobbyist developers really care about patents? I would rather think that's only the case when they plan to commercialize.
- btown 3y agoGiven that people have been sued for patent infringement for merely using office scanners [0], patent encumbrance is absolutely a chilling effect even for hobbyists. [0] https://arstechnica.com/tech-policy/2013/01/patent-trolls-want-1000-for-using-scanners/ https://arstechnica.com/tech-policy/2013/01/patent-trolls-wa...
- LoganDark 3y agoNobody will ever know I exist, so I'm fine.
- speedgoose 3y agoDevelopers living in places with no software patents and with no plans to go on markets with software patents don't care. See ffmpeg or VLC for example.
- JohnFen 3y agoFor projects that I'm unlikely to share with others, I don't care about patents (and I'm not legally required to care about them). For others, I do care and go to reasonable lengths to avoid infringing on any.
- Bimos 3y agoTLDR: Totally no information about MP3 Encoding.
- lelanthran 3y ago> 16k lines of obscure C, riddled with pointer magic and arcane memory manipulations? No thanks! I think this line sells it short: It's battle-tested code. Like SQLite, forget about the language used to implement it; the fact that it runs on multiple architectures, used by multiple products, from multiple different programming languages, deployed to multiple platforms ... means that I have more confidence in the software than in a new project made in a safe language.
- deleted 3y ago[deleted]
- LoganDark 3y ago> humans can only hear frequencies between 20 Hz and 20 kHz I can hear up to around 21.5kHz, which I know because I have a 48kHz DAC. However those frequencies are almost always just unnecessary to include in a signal anyway.
- akanet 3y agoThe author may have been mistaken, but they were almost certainly simply stating what they thought of as fact, there's no need to accost them
- LoganDark 3y agoSorry, edited.
- astrange 3y agoAt what dB and how much are you annoying nearby dogs?
- LoganDark 3y agoNot sure to both. I haven't measured. I used a 1kHz tone to calibrate the volume to a comfortable level and then raised the frequency until I couldn't tell whether the tone was playing or not.
- speedgoose 3y agoI have a 384kHz DAC and I can safely say that I have no dolphin capabilities.
- sp1rit 3y ago> 16k lines of obscure C, riddled with pointer magic and arcane memory manipulations? No thanks Given the popularity of the library I'd imagine it's quite well tested. I also fail to understand why he attempts to port libshine from C to Go when he could just port the header files from LAME as FFI bindings instead. That should also ensure comparability with windows, as I'm sure such a library us also buildable on windows, given that ffmpeg uses it and ffmpeg works on windows.
- miki123211 3y agoGo programmers usually avoid C bindings if at all possible. Pure Go can be cross-compiled easily, but that goes out the window once you include C code. You can make it a bit easier by using Zig as your c compiler, but it's still a bit of a pain. If you want to expose your code as a Go package, the situation gets even more complicated.
- nunez 3y ago> The basic encoding/decoding technology for MP3 was under a patent for all of the 90s and 00s. It wasn’t patent-free in the US until 2017. Open-source and hobbyist developers like myself are going to avoid anything involving patents. Haha, yep. This is partly why there were so many recordings that sounded like ass back in the infancy of music sharing and partly why we cared about bitrate. We have many more options today. Today's music sounds great at 96Kbps with AAC or Ogg Vorbis encoding, which is a big reason why streaming became, and continues to be, viable.
- mortallywounded 3y agoI was surprised he/she/they/xe/zi/zer/it thought 16K lines of C was too much to comprehend and re-write in Go. It may seem like a lot but if you're going to maintain something as complex as an encoder, it's sorta your job to know exactly how the encoding works. Also, 16K lines isn't too bad for a single person if you dedicate a day or two to it.