News for hackers. Stuff that matters.
Re:Let's build an MP3-decoder (2008) by Siemer on Friday March 16, 2018 @03:43AM (#16599212)
Ever since reading "How music got free" by Stephen Witt I get a bit annoyed with the MPEG team getting credit for "creating" the mp3. They did more to kill it than to support it.
Re:Let's build an MP3-decoder (2008) by sp332 on Friday March 16, 2018 @12:26AM (#16598624)
Now that the patents have expired, let's make an MP3 encoder!

... I have no idea how to do that. Even a toy one.

Re:Let's build an MP3-decoder (2008) by opencl on Friday March 16, 2018 @08:22AM (#16600109)
http://mp3-tech.org/programmer/encoding.html

Source code for a lot of early encoders is available to study. Probably easier to understand than the modern implementations. LAME started out as a set of performance patches against the ISO sources until eventually being rewritten from scratch.

Toy MP3 encoders are not horrifically complicated, though ones that sound decent are. It's astonishing how much improvement there's been over the past few decades even with the same underlying format, modern 128kbps MP3s don't even make your ears bleed.

Re:Let's build an MP3-decoder (2008) by sp332 on Friday March 16, 2018 @09:51AM (#16600596)
Thanks for the link. I think there's a lot of room for experimental, artistic, or even scientific specialty encoders. There's so much flexibility in picking out what's "important" in a signal.
Re:Let's build an MP3-decoder (2008) by exikyut on Sunday March 18, 2018 @12:54AM (#16610502)
The way you worded that immediately made me think of glitch art, particularly GIFs, and particularly situations where the glitch aligns perfectly with the content.
Re:Let's build an MP3-decoder (2008) by sp332 on Sunday March 18, 2018 @08:48AM (#16611712)
This is the post that got me thinking about it recently https://news.ycombinator.com/item?id=16034547
Re:Let's build an MP3-decoder (2008) by OskarS on Friday March 16, 2018 @05:25AM (#16599497)
I generally do it like this:

1. Download liblame

2. Thank god and Richard Stallman for open source software

3. Have a cup of coffee.

Re:Let's build an MP3-decoder (2008) by cuckcuckspruce on Friday March 16, 2018 @09:45AM (#16600551)
RMS would cringe at you calling it open source software instead of Free Software
Re:Let's build an MP3-decoder (2008) by OskarS on Friday March 16, 2018 @09:55AM (#16600630)
That is true. I'm sorry, Richard Stallman, please forgive me! I always call it GNU/Linux, I promise!
Re:Let's build an MP3-decoder (2008) by boomlinde on Friday March 16, 2018 @04:58PM (#16603973)
It's GNU plus Linux
Re:Let's build an MP3-decoder (2008) by jandrese on Friday March 16, 2018 @01:46PM (#16602467)
Maybe, but then I have to get into that whole "no, I mean Free as in Speech, not Free as in beer" discussion again...
Re:Let's build an MP3-decoder (2008) by piqalq on Friday March 16, 2018 @12:41PM (#16601821)
It’s a pain in the ass. I built one for a steganography thesis and the psychoacoustic model is really what made it difficult.

The psychoacoustic model took more time on its own to code than the PCM splitting, MDCT, windowing and Huffman coding.

It’s a fun project however painful. There’s a MP3 encoder from the early 90s floating around that you can use as a base if you can fix the legacy code. I can’t remember the name though, sorry.

Re:Let's build an MP3-decoder (2008) by rzzzt on Friday March 16, 2018 @08:06AM (#16600055)
Take the input, split the bands, apply psychoacoustic model, quantize coefficients, apply Huffman coding on the output: https://books.google.hu/books?id=MN34-91z6qAC

(Coincidentally, these are the steps detailed in the article, in the opposite order.)

Re:Let's build an MP3-decoder (2008) by opencl on Friday March 16, 2018 @08:30AM (#16600162)
The decoder doesn't care about the psychoacoustic model at all though, that's all up to the encoder and the decoder just gets some frequencies to play back. The psychoacoustic model is also by far the most complicated part of any decent modern encoder.
Re:Let's build an MP3-decoder (2008) by epmaybe on Friday March 16, 2018 @02:35AM (#16599017)
Signal processing is a fascinating field that I wish I had explored further in college
Re:Let's build an MP3-decoder (2008) by jacobush on Friday March 16, 2018 @05:20AM (#16599484)
Obviously the only way to do that is to throw a Recurring Neural Network at it? Am-I-rite or am-I-rite?

... snark, but not really? Todays hammer of choice is machine learning and AI.

Re:Let's build an MP3-decoder (2008) by petercooper on Friday March 16, 2018 @11:05AM (#16601147)
I took a quick look and couldn't find anything obvious, but I'd be surprised if someone wasn't using machine learning to improve psychoacoustic models. A fundamental problem is modelling the subjective listener, I guess.
Re:Let's build an MP3-decoder (2008) by jandrese on Friday March 16, 2018 @01:51PM (#16602519)
You could calculate the difference between the original and uncompressed and then weight the differences by sensitivity levels of the human ear at various frequencies...

It wouldn't be able to measure "warmth" or "heart" or "anger" or anything like that. It would be able to tell you which model most closely matches the original at the frequencies you can hear. Once you have a metric, you can use it as the basis of a parameter space search. Not exactly machine learning, but maybe some preliminaries.

Re:Let's build an MP3-decoder (2008) by jacobush on Tuesday March 20, 2018 @02:55AM (#16626461)
What's also in vogue is to gather huge datasets, in a fashion only really available to Google and their ilk. I'd imagine a "click-on-all-vehicles"-affair, only with sound instead of images.
Re:Let's build an MP3-decoder (2008) by bluedino on Friday March 16, 2018 @08:05AM (#16600054)
Here's an old list of Mp3 decoders:

http://mp3decoders.mp3-tech.org/decoders.html

It's amazing how terrible some of them were back then. I had probably 5 different players on my system because certain files would only play with certain players, encoding and decoding was such a mess back then.

Re:Let's build an MP3-decoder (2008) by akhilcacharya on Friday March 16, 2018 @12:43AM (#16598688)
This is really cool! I've never seen an article that uses Haskell for a real-world task like this, are there any others?
Re:Let's build an MP3-decoder (2008) by jraph on Friday March 16, 2018 @03:14AM (#16599122)
Pandoc (http://pandoc.org/) is written in Haskell and converts documents across formats.
Re:Let's build an MP3-decoder (2008) by aepiepaey on Friday March 16, 2018 @05:41AM (#16599554)
Pandoc is great!

...except if you want to batch convert real-world markdown.

Though admittedly, that's mostly because markdown designers thought allowing embedding of arbitrary HTML was a good idea.

(The best you can get is by going: markdown -> HTML -> $target_markup.)

Re:Let's build an MP3-decoder (2008) by Tomte on Friday March 16, 2018 @06:01AM (#16599640)
The ability to embed arbitrary HTML is an intentional feature of Markdown.
Re:Let's build an MP3-decoder (2008) by KMag on Friday March 16, 2018 @07:20AM (#16599895)
aepiepaey agrees with you that it's an intentional design decision ("thought ... was a good idea"), and his/her use of past tense also implies that s/he disagrees with the decision.
Re:Let's build an MP3-decoder (2008) by jxub on Friday March 16, 2018 @05:54AM (#16599609)
https://lettier.github.io/posts/2016-08-15-making-movie-mona... walks you through making a movie player in Haskell.
Re:Let's build an MP3-decoder (2008) by kefir_cultist on Friday March 16, 2018 @07:31AM (#16599922)
Never ceases to amaze me how complicated digital audio processing seems compared to analogic. A very nice article —and blog —.
Re:Let's build an MP3-decoder (2008) by jxub on Friday March 16, 2018 @05:37PM (#16604209)
Got any resources for analog signal processing?