12 ms·
Shine: A super fast fixed-point MP3 encoder
- grandchild 5y agoMore interesting than the code itself is the history at the very bottom of the README.
- freedomben 5y agoThis flared up my nostalgia when I remembered ripping CDs I bought from Graywhale into .wav files and encoding them into mp3s on my windows 95 machine in the mid to late 90s. BladeEnc was amazing and fast. It would sometimes encode up to 1x! Meaning it only took about a minute to encode a 60 second .wav into an .mp3. Nowadays I can encode 32 10-minute wav files in like 2 seconds on my Ryzen 5950x.
- raffraffraff 5y agoWow, BladeEnc... I didn't even know I had forgotten that. 1998's brain cells are still there but they don't light up very often. Thanks.
- duskwuff 5y agoAnd for the other direction, there's minimp3: https://github.com/lieff/minimp3 https://github.com/lieff/minimp3 I've used minimp3 to implement a MP3 player on a STM32 microcontroller. Works great -- it has no problem playing a 256kbps file at 80 MHz. :)
- classichasclass 5y agoTenFourFox embeds minimp3. Works just dandy and it's small.
- baq 5y agoI remember times when it wasn’ts problem on much less than that… which is what most people had. Guess I’m just old :)
- einr 5y agoOn x86, a Pentium 75 was just about the absolute minimum for playing the common 128 kbps stereo MP3s of the time. A DX4/100 could just barely do it if you were running a performant MS-DOS player and doing nothing else at the same time (the 486 of course had dramatically worse floating point performance than a Pentium clocked at the same frequency).
- dan_hawkins 5y agoMy Pentium 166 MMX running Windows 95 and Winamp 0.x got 100% loaded while playing my first ever mp3 file - brought home on 3 floppy disks. That's why games of that era were using CD Audio for soundtrack or tracker music like Unreal or Deus Ex.
- Zardoz84 5y agoUnreal, Unreal Return to Napali, and Unreal Tournament used S3M files for music. Not CD Music
- dan_hawkins 5y agoThat's what I exactly said. Read it again please.
- retrac 5y agoPart of that is was probably just Windows 9x's terrible multitasking, coupled with a badly-written MP3 decoder. We generally suffered software in those days that really held back those machines from what thy were capable of. The MMX Pentiums were perfectly capable of decoding an MP3 in real time. My old 233 MHz MMX Pentium machine could decode MPEG-4 standard definition video with an MP3 audio track, under Linux. Though I had to set my video player to real-time priority if I wanted it to not drop frames.
- npteljes 5y agoThat's exactly how I did it yes. DX4/100, and a dedicated DOS player that could play one song at a time. Of course back then, much of my collection was in XM format.
- deadlyllama 5y agoThat's a blast from the past! Shine's output doesn't sound great. If you need the performance on embedded hardware, that's what it's there for. If you need quality sound and can't afford to crank up the output bitrate, prepare to be disappointed.
- ghoul2 5y agoExactly right. Due to the missing psycoacoustic model, Shine can't really compress well. Don't even bother with bitrates lower than 128kbps if you want your audio to sound decent. But exactly due to the lack of the psycoacoustic model, its very light on cpu and memory, and perfect for the specific embedded use cases where encoded bitrate is not a concern.
- svnpenn 5y agoWhy do people insist on still using MP3, when better stuff is available? YouTube hasn't used MP3 for years, with good reason. You can use Opus or AAC, even most car systems should work with one of them.
- charcircuit 5y agomarketing
- MayaFey 5y agoCan you elaborate? Who markets it and stands to gain from MP3's continued usage?
- charcircuit 5y agoWell currently it would be royalties from licensing it out (the patent is expired so it's technically not needed anymore). There is also a benefit since consumers are more familiar with the word MP3 as opposed to AAC. However I think marketing in the past is much more relevant. I have heard of "MP3 players", but not "AAC" players.
- qwerty456127 5y ago> I have heard of "MP3 players", but not "AAC" players. Because the latter are called "MP4 players" and the files are meant to have ".m4a" extension. Also because dedicated media player devices stopped being something ordinary people need (because smartphones) sooner than MP4 became a thing.
- tashbarg 5y agoSame reasons people still use jpeg.
- fulafel 5y agoFor tech giants optimizing for transit, the complexity and engineering costs of improvements are easily paid for by even small savings, and because it's just transit, you can support multiple formats simultaneously. And everything you do is ephemeral: You could have a new codec every day and not ruin any archivist's day with long term support requirements (excepts the ones they try to shake off anyway). TLDR: for Youtube, transit bw is expensive and rapidly evolving codec cornucopia is cheap enough to cover with the bw savings.
- ghoul2 5y agoWow, nice seeing this here. Shine was a life saver when I was building the live broadcast capability of othernet.is. Our Satellite link was really low bitrate ( less than 20kbps). I wanted to keep as much of that as possible for the data-casting part, which was our core offering. So after experimenting with varioud codecs I narrowed down to using Opus@8kbps as my downlink from the satellite to our custom receivers. The problem was, Opus wasn't natively supported as a codec by most browsers (Safari being a major culprit). In fact after analysis, I found the only format that could be reliably played on every browser (including mobile) is mp3. So the solution I derived was to have the downlink in opus, decode that on the reciver, reencode it to mp3, and stream that out to the users browser. Now the reciever was a very low end linux device - 1GHz Arm6, 256MB ram - that ran the entire stack. Satellite receiver, UI server, filesystem maintenance, Wifi Hotspot (softAP). We also didn't want to load it down with large heat sinks or fans as a design goal. So the cpu could not be loaded to its full capacity. Every other MP3 encoder I tried was too heavy duty, and would cause thermal issues for the SoC. But Shine worked perfectly - total cpu consumption remaining less than 10% for real time decoding (from opus) and encoding (to mp3).
- kingcharles 5y agoThat's interesting you were running at such a low bit-rate. In 1999 I was the 2nd employee at what became one of the world's biggest music streaming services. I was working from home as we didn't have offices yet, and my broadband got cut off because I hadn't been paid yet and I was broke. I ended up having to re-encode the entire music catalog at 8000bps so I could stream it all over my 9600bps cell connection via the serial port of my Nokia 9000, when I was testing the system.
- ghoul2 5y agoWhat codec did you use for your 8000bps? In my experience opus is the only codec that can encode general audio to an "acceptable" (for low values of acceptable) quality at that bitrate. There are speech codecs that can go below 2kbps, but they are useless for non-speech audio (and are also very computationally expensive). Opus is simply magic. Iirc, they now even have a 6kbps mode.
- MrYellowP 5y agoFixed point math superiority \o/
- DrBazza 5y ago> The encoder was converted circa 2001 by Pete Everett to fixed-point arithmetic for the RISC OS Did this originate on a ye-olde-worlde Acorn Archimedes, or merely get converted to run on that? Anecdote - I remember the first jpeg renderer on the Arch, written in Basic, so interpreted, and it would take a couple of second to render a jpeg to screen on a 33Mhz CPU with no GPU acceleration.
- bluedino 5y agoI haven't thought about CPU usage when it comes to MP3's (and this was for decoding), since my DX4-100 couldn't really play them using Winamp (doing almost anything else in Windows while playing one would cause it to stutter). I think I ended up playing them in DOS on that machine.