Coder Social home page Coder Social logo

jsmad's Introduction

Deprecated! Please use mp3.js and aurora.js instead.

About

jsmad is a pure javascript MP3 decoder, based on libmad, with an ID3 decoder written from scratch.

For example, jsmad allows Firefox 4.0+ to play MP3s without any Flash. Faster loading times. Fewer security holes. No 64-bit headaches on Linux. Fewer memory leaks.

jsmad opens up a whole world of realtime audio applications implemented in javascript: dj-mixers, samplers, sequencers, all these applications benefit from using mp3s as audio source.

jsmad is released under the GPLv2 license.

Demo

See a live demo here: http://jsmad.org/ in collaboration with official.fm and using the musicmetric API

It works out of the box under Firefox 4.0 and above. On Chrome 13.0+, you have to enable manually the Web Audio API in 'about:flags', then restart the browser and it should work fine! No Opera support at the moment.

Authors

  • @nddrylliog - lead developer
  • @jensnockert - helped porting & debugging the code at MusicHackDay Berlin
  • @mgeorgi - helped debugging the code after MusicHackDay Berlin

Special thanks to @antoinem for the Demo design and particularly to @_romac for adding features & keeping the demo server alive!

Porting notes

Obviously, porting low-level C code to Javascript isn't an easy task. Some things had to be adapted pretty heavily. jsmad is not the result of an automatic translation - all 15K+ lines of code were translated by hand by @nddrylliog and @jensnockert during MusicHackDay Berlin. Then, @mgeorgi helped us a lot with the debugging process, and @antoinem did the design of the demo during MusicHackDay Barcelona.

It performs well enough to decode and play MP3s in realtime on Firefox on modern computers, although if you do lots of things at once, Firefox might forget at all about scheduled tasks and let the soundcard underflow. There is a rescue mechanism for that in the demo, which works most of the time.

jsmad will undoubtedly be an interesting benchmark for browser's javascript implementations. We would love to get feedback from the Mozilla, Google Chrome, and Opera team - shoot us a note!

Accuracy

The output from jsmad is NOT representative of the output quality of libmad itself. jsmad hasn't been tested for ISO/IEC 11172-4 computational accuracy requirements compliance. JavaScript number crunching has always been a bad idea, and we're aware of that - we've done it to push the limits of what is being done with JavaScript, much in the spirit of pdf.js

License

jsmad is available under the terms of the GNU General Public License, Version 2. Please note that under the GPL, there is absolutely no warranty of any kind, to the extent permitted by the law.

What GPL means for a javascript library is not exactly clear to us. What's clear is that you have to release any fork/changes under the GPL as well, so that everyone can profit from it. However, using it on a commercial platform is probably alright. Remember: no guarantees, and we'd love to know about it!

libmad has commercial license. As for jsmad, we're in a sort of grey legal area. If you're from Underbit and want to work this out with us please drop me a note at [email protected]

Future

What's next? A few things:

  • Strings are still used in the core decoding routines instead of Uint8Arrays - this should change
  • Optimizations, always
  • Better buffering strategy - player.js is still pretty naive and we stumble now and then onto buffer underflow
  • MPEG Layer I and II are not supported, only Layer III is - it should be pretty trivial but we had no interest for it in the first place.
  • MPEG 2.5 is not supported.
  • Free bitrate streams are not supported (this is different from VBR - VBR is supported)
  • Most of ID3v2.2 and ID3v2.3 are implemented, but some tags are mising.

jsmad's People

Contributors

adrianholovaty avatar auroranockert avatar devongovett avatar georgi avatar jussi-kalliokoski avatar koichirose avatar romac avatar smoove avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jsmad's Issues

memcpy fails sometimes

This is because it's trying to do subarray on something that isn't a typed array. I have a fix ready.

Clear use case for switching tracks.

The way I have hacked track switch is a kill() followed by another playUrl(). This is obviously isn't optimal and there has to be some kind of way to switch the streams and have it play gracefully from the new stream. The way it works now 1 or 2 seconds of the previous track play when it switches to the next.

Any ideas/help hints would be much appreciated. This works stellar even in the face of that one issue ๐Ÿ‘

playback finish is not handled properly

when a file's end is reached, jsmad throws

Uncaught Header decoding failed
Mad.Frame.decodeframe.js:366
refillplayer.js:62
(anonymous function)player.js:92
AUDIOLIB.SinkClass.processaudiolib.js:2550
bufferFill

then it starts throwing

Uncaught TypeError: Cannot read property 'flags' of null
Mad.Frame.decodeframe.js:362
refillplayer.js:62
(anonymous function)player.js:92
AUDIOLIB.SinkClass.processaudiolib.js:2550
bufferFill

audio live stream

hi, i had a quick look at the sources and it looks to me as if you are expecting what ever file is played, to be loaded completely.

how can i use jsmad to play a live stream?

i want to use it to play live captured system audio for my h264 remote console
-> https://www.youtube.com/watch?v=nDuHEMA5uSw

Visualizations not possible

Mad.Player needs some hooks so that people can add visualizations or whatever postprocessing to the audio.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.