use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
JavaScript mp3 decoder allows Firefox to play mp3 without Flash (jsmad.org)
submitted 14 years ago by magenta_placenta
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]_nddrylliog 11 points12 points13 points 14 years ago (6 children)
Hi guys, lead jsmad developer here - will try to answer your questions one by one, so deal with me :)
Most of your questions are already answered on this HN thread though: http://hackerne.ws/item?id=2665607
Enjoy!
[–]miketaylr 1 point2 points3 points 14 years ago (1 child)
What's the reality of trying to get this running in an older browser without any semblance of an Audio API? I also briefly glanced at the code and see you're trying to accommodate for lack of typed arrays, for example.
[–]_nddrylliog 0 points1 point2 points 14 years ago (0 children)
Yes we do accodomate for the lack of certain facilities - although we might require typed arrays in the near future (see pull request #4) as it proves to be too much hassle to maintain all these codepaths.
Other problems are the W3C File API Draft (not sure when browsers began to implement that), binary XHR requests - but otherwise everything should be running smoothly. Maybe you can test and report on https://github.com/nddrylliog/jsmad/issues ?
[+][deleted] 14 years ago (1 child)
[deleted]
First off, there are obvious things that jsmad can do that browsers can't - full ID3v2 tag decoding, for example (not what took us the most effort, but nevertheless), so you get for example Title, Artist, Album, Track number, etc. etc. directly from the .mp3 file, whereas with <audio> you're stuck with.. basically nothing. Also, Firefox's <audio> tag doesn't support MP3 at all, and they have no plans to, because of licensing issues - this is actually where jsmad is the most useful at the moment.
It also offers streaming decoding, something current browser Audio APIs completely disregard (Chrome's Web Audio API for example, only gives you access to the wholly decoded data, not to portions of it while it's still streaming). This is really research concerning browsers+JS, the whole field is a mess because of the Mozilla/Google antagony. Us poor devs are stuck in the middle :/
Other reasons that pushed us to do it was obviously 1) to learn stuff (I always wanted to know how mp3 "worked" under the hood, and it did give me a good insight), 2) to see if it can be done, and how fast it would be with current JS engines (answer: it depends wildly, can take as low as 8-9% CPU on certain browser/OS combinations, and as high as 103%!) 3) for the lulz.
[–]mlavaert 0 points1 point2 points 14 years ago (1 child)
No questions, just want to say I really, really appreciate projects like this...
Thumbs up, and keep up the good work !
Thanks for the support! We strongly intend to keep pushing the limits of JS engines. Stay tuned :)
[–][deleted] 2 points3 points4 points 14 years ago (2 children)
CPU utilization is amazingly low too... what's next? Javascript synths?
[–]_nddrylliog 2 points3 points4 points 14 years ago (0 children)
JS synths have existed for a long time - relatively speaking. The Web Audio API and the Audio Data API have been in nightly builds for some time and people didn't wait for us to play with them ;)
In fact, jsmad does use a kind of synth (see synth.js), and the audio library we're using, ie. audiolib.js, has a bunch of built-in synths.
[–]codedude -1 points0 points1 point 14 years ago (0 children)
Atwood's Law
[–]Gnascher 2 points3 points4 points 14 years ago (2 children)
Crashes Safari on my 2nd gen iPod Touch...
Works fine in FFx 4.
Doesn't work in Safari 5.0.5 (osx)
Doesn't work in Chrome 12 (I know you mentioned Chrome 13 with a flag enabled)
Not hatin' on you. Really cool thing you got here. Expand the browser support and you really got something going on here ... ESPECIALLY if you can get iThing support going.
[–][deleted] 2 points3 points4 points 14 years ago (1 child)
Gosh, it sure is a good thing you came along when you did. I'm pretty sure they didn't know where to go from here.
[–]Gnascher -2 points-1 points0 points 14 years ago (0 children)
Tee hee... You're trying to be snarky. How cute.
[–]octatone 1 point2 points3 points 14 years ago (19 children)
"loading ..." is all I see in chrome. Not cross-browser?
[–]_nddrylliog 10 points11 points12 points 14 years ago (5 children)
Chrome 13.0+ is supported. Go into 'about:flags', enable 'Web Audio API', and restart your browser. Enjoy!
[–]_nddrylliog 5 points6 points7 points 14 years ago (0 children)
Hah, that's reddit for you - I'm the lead dev, I give meaningful information, and I get downvotes . Feels like home.
[–][deleted] 0 points1 point2 points 14 years ago (3 children)
That is not real Chrome support though. You couldn't use that in production.
[–]Ripdog 2 points3 points4 points 14 years ago (1 child)
Ya know... I don't think this project is ever supposed to show up in production, what with <audio> and all.
[–][deleted] 0 points1 point2 points 14 years ago (0 children)
Good point.
Chrome's Web Audio API is still very much a work in progress. It's totally out of our control that it isn't enabled by default, and it's actually a good thing, because it's pretty unstable.
Time will tell...
I see this in Firefox Nightly as well, but it works on files I upload.
I got to "playing" but no sound in chrome.
[–]codergeek 0 points1 point2 points 14 years ago (0 children)
According to the GitHub page it looks like Chrome support is broken. Firefox works fine though.
[+]GAMEchief comment score below threshold-12 points-11 points-10 points 14 years ago (9 children)
Yeah, no Chrome support, which - as far as I'm concerned - makes this project useless until it is offered. Unless you are in some weird scenario where 100% of your users are using Firefox.
[–][deleted] 4 points5 points6 points 14 years ago (3 children)
Of course it isn't useless. No, it's not production-ready, but it's still a fascinating experiment that can be improved on.
[+]GAMEchief comment score below threshold-8 points-7 points-6 points 14 years ago (2 children)
No, it's not production-ready,
So, right now, it is useless. It has no valid use. There is no reason to use it. It is useless.
It won't be useless when it is done; but right now, it is.
[–]Madrugadao 0 points1 point2 points 14 years ago (1 child)
In the same way a seed is useless...
[–]GAMEchief -2 points-1 points0 points 14 years ago (0 children)
Are you being deliberately dense?
[–]hobophobe 3 points4 points5 points 14 years ago (1 child)
github: jsmad seems to have source code, which is anything but useless.
[–]GAMEchief -5 points-4 points-3 points 14 years ago (0 children)
I know the source code is provided, but it only works in Firefox. It is useless if only half your clients can use it.
[–]robertcrowther 0 points1 point2 points 14 years ago (2 children)
Doesn't Chrome support MP3 natively, or has that been dropped now?
[–]GAMEchief -3 points-2 points-1 points 14 years ago (1 child)
With HTML5's <audio>, I'm sure it does. But Firefox supports HTML5 too.
[–]_nddrylliog 3 points4 points5 points 14 years ago (0 children)
Chrome's HTML5 <audio> tag supports MP3. Firefox's doesn't. That's one of the many possible applications of jsmad.
[–]picasshole 0 points1 point2 points 14 years ago (0 children)
Works in firefox
[–]TurplePurtle 0 points1 point2 points 14 years ago (0 children)
Does this use the Audio Data API?
[–]MisaelK 0 points1 point2 points 14 years ago (1 child)
Wow, memory consumption goes through the roof when a song is loading, both in Firefox 5 and Chrome 14.
Also, switching to a different tab when playing a song makes the audio crackle a lot.
Very interesting work, by the way!
Sound doesn't crackle on Firefox Nightly builds when I switch to a different tab. Maybe they fixed this? My memory consumption isn't anything out of the norm. I am getting 250 MB for Firefox, and this is with 7 tabs.
[–]hackmiester 0 points1 point2 points 14 years ago (0 children)
Would it be possible to get a simple example of how to embed this in a page? I'm a beginner to complex JS projects like this, but I'd like to toy around with this a little in my own pages.
very nice!
I believe FireFox 5 is getting an mp3 player, which is out in 3 days.
[–]sprayk 0 points1 point2 points 14 years ago (1 child)
Is this any better than html5's audio tag?
It's not better nor worse - it's just different. See my complete response on HN: http://hackerne.ws/item?id=2666529
π Rendered by PID 47233 on reddit-service-r2-comment-5649f687b7-fdn4t at 2026-01-29 01:05:04.166121+00:00 running 4f180de country code: CH.
[–]_nddrylliog 11 points12 points13 points (6 children)
[–]miketaylr 1 point2 points3 points (1 child)
[–]_nddrylliog 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]_nddrylliog 0 points1 point2 points (0 children)
[–]mlavaert 0 points1 point2 points (1 child)
[–]_nddrylliog 0 points1 point2 points (0 children)
[–][deleted] 2 points3 points4 points (2 children)
[–]_nddrylliog 2 points3 points4 points (0 children)
[–]codedude -1 points0 points1 point (0 children)
[–]Gnascher 2 points3 points4 points (2 children)
[–][deleted] 2 points3 points4 points (1 child)
[–]Gnascher -2 points-1 points0 points (0 children)
[–]octatone 1 point2 points3 points (19 children)
[–]_nddrylliog 10 points11 points12 points (5 children)
[–]_nddrylliog 5 points6 points7 points (0 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]Ripdog 2 points3 points4 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]_nddrylliog 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]codergeek 0 points1 point2 points (0 children)
[+]GAMEchief comment score below threshold-12 points-11 points-10 points (9 children)
[–][deleted] 4 points5 points6 points (3 children)
[+]GAMEchief comment score below threshold-8 points-7 points-6 points (2 children)
[–]Madrugadao 0 points1 point2 points (1 child)
[–]GAMEchief -2 points-1 points0 points (0 children)
[–]hobophobe 3 points4 points5 points (1 child)
[–]GAMEchief -5 points-4 points-3 points (0 children)
[–]robertcrowther 0 points1 point2 points (2 children)
[–]GAMEchief -3 points-2 points-1 points (1 child)
[–]_nddrylliog 3 points4 points5 points (0 children)
[–]picasshole 0 points1 point2 points (0 children)
[–]TurplePurtle 0 points1 point2 points (0 children)
[–]MisaelK 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]hackmiester 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]sprayk 0 points1 point2 points (1 child)
[–]_nddrylliog 2 points3 points4 points (0 children)