Live data from Hacker News

JavaScript mp3 decoder allows Firefox to play mp3 without flash

jsmad.org

81–90 of 99 posts

Re: JavaScript mp3 decoder allows Firefox to play mp3 without flash

#81

Earlier quoted context omitted.

Yes, please help optimize it.

The question is can it be optimized? My knowledge of this stuff is very limited but I assume javascript object wrappers for number types and lack of SSE/SSE2 instructions will be the biggest blockers to performance.

I doubt SSE2 would help much, at most 2x on arithmetic performance. Much time is spent fiddling with arrays, and the newer version of firefox the better that performance is. In addition there are many optimizations to do.

A Pentium 1 can decode MP3s in assembly, so in Javascript we probably need a few times more power, but not insanely much more.

Re: JavaScript mp3 decoder allows Firefox to play mp3 without flash

#82

Earlier quoted context omitted.

Been playing 320kbps Stereo flawlessly afaik. The bitrate is really not much of an issue. Browsers have a much harder time dealing with binary XHRs, huge typed arrays, huge strings, and a real fucking lot of arithmetic operations. I think the most difficult part was the debugging. Jens Nockert, Matthias Georgi & I finally used node.js and carefully diff'd the output from minimad.c (the canonical libmad example) and j…

I suspect that there's a fairly interesting blog post with samples of the gnuplot output waiting to be written about this.

That's a good idea. I think some of the graphs are still on the depo (in experiments/node/ or something).

Re: JavaScript mp3 decoder allows Firefox to play mp3 without flash

#83

Earlier quoted context omitted.

The question is can it be optimized? My knowledge of this stuff is very limited but I assume javascript object wrappers for number types and lack of SSE/SSE2 instructions will be the biggest blockers to performance.

I doubt SSE2 would help much, at most 2x on arithmetic performance. Much time is spent fiddling with arrays, and the newer version of firefox the better that performance is. In addition there are many optimizations to do. A Pentium 1 can decode MP3s in assembly, so in Javascript we probably need a few times more power, but not insanely much more.

Switching entirely from Strings to typed arrays would help a great deal imho. Right now the code is hybrid.

Re: JavaScript mp3 decoder allows Firefox to play mp3 without flash

#86
Not sure if anyone has mentioned this yet, but I'm noticing speed/pitch differences in playback when I load a file from my disk versus playing in iTunes. Billy Joel sounds more like Janis Joplin.

Edit: Horrible bug report -- I'm in Chrome 12 with the Web Audio about:flag enabled on Mac OS X 1.6.7

Edit 2: Just tested in Chrome Dev 14 and the issue is unchanged.

Re: JavaScript mp3 decoder allows Firefox to play mp3 without flash

#88

jsmad lead developer here, shoot if you have any questions!

I think this is the beginning of something beautiful.

On Chrome 13 if you enter a new ID track and hit enter it will keep playing the old song even if you start playing the new one or it will have that crkkkk repeating sound. :) Firefox 4 seems to have no problem but you have to sometimes hit refresh and then play to get the new track playing.

One cool feature would be to make a random ID track generator so you won't have to search/enter the codes for yourself.

Hope this feedback helps somehow.

Did I say how cool all this is?

Re: JavaScript mp3 decoder allows Firefox to play mp3 without flash

#89
When does mp3 playback fall out of patent protection? I know people keep digging up new patents for popular standards but assuming Mozilla and like-minded developers put some effort into patent avoidance you'd think they'd be able to include native support for some subset of mp3 playback without too much patent trouble by now.

Re: JavaScript mp3 decoder allows Firefox to play mp3 without flash

#90
post #51

Awesome! But... I'm not a JS guy. I can't contextualise this. How does this compare to HTML5 browser-based audio playing? Will this be a new way to make an audio button? Or does it go much deeper than that for JS apps?

From what I hear,the HTML5 tag implementation quality varies wildly. It hasn't been used much in production for desktop-targeted web apps. It is, however, quite popular on the iPlatforms, because you have no Flash there! As far as I can tell, jsmad is not going to replace the HTML5 audio tag on mobile devices. However, it does constitute a nice legal workaround for MP3 in desktop browsers such as Firefox. It gives ac…

One of the main problems with the html5 audio tag isn't that it doesn't play audio, it is that it doesn't allow the control needed for things like gaming (playing different streams in different speakers, no latency guarantees, etc).
Post reply on HN