Giter Site home page Giter Site logo

alac.js's Introduction

alac.js: An Apple Lossless decoder in the browser

The Apple Lossless Audio Codec (ALAC) is an audio codec developed by Apple and included in the original iPod. ALAC is a data compression method which reduces the size of audio files with no loss of information. A decoded ALAC stream is bit-for-bit identical to the original uncompressed audio file.

The original encoder and decoder were open sourced by Apple, and this is a port of the decoder to CoffeeScript so that ALAC files can be played in the browser.

Demo

You can check out a demo alongside our other decoders flac.js, MP3.js, and AAC.js. Currently, alac.js works properly in the latest versions of Firefox, Chrome, and Safari.

Authors

alac.js was written by @jensnockert and @devongovett of Audiocogs.

Building

We use browserify to build alac.js. You can download a prebuilt version from the Github releases page. To build alac.js for the browser yourself, use the following commands:

npm install
make browser

This will place a built alac.js file, as well as a source map in the build/ directory.

alac.js depends on Aurora.js, our audio codec framework. For detailed information on how to use Aurora.js, check out the documentation.

License

alac.js is released under the same terms as the original ALAC decoder from Apple, which is the Apache 2 license.

alac.js's People

Contributors

auroranockert avatar devongovett 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

alac.js's Issues

Fix description of project to reflect that it is not an encoder

I appreciate the work on the framework and the great resource you've provided - but I got really excited when I read 'encoder' in the title of the ALAC project only to find out after I went through all the steps to build from scratch to setup a work environment that there's no encoding component. It's not the end of the world but I did feel a bit sad. :(

Otherwise, keep up the great work! You guys rock!

Encoder ?

The description on the ofmlabs github homepage says that its an alac encoder and decoder written in coffeescript , just wondering how do i use the encoder ?

Encoder ?

The description on the ofmlabs github homepage says that its an alac encoder and decoder written in coffeescript , just wondering how do i use the encoder ?

Visualization uses a lot of CPU

Hi guys,
The first thing people check when looking at the demo is of course CPU use, and at first it seems to be quite high -- but as soon as one minimize the browser window it is low.

I'm guessing this is because of the "silly" visualization?

any plans for 24bit alac support?

I'm trying to play some 24-bit alac files but the decoder is limited to 16-bit playback. Is there any plans to port 24-bit playback code too?

Workers

So I got worker decoding working YAY! Chrome plays buttery smooth audio as of 31d07fb no stutters or anything. And now we have Firefox bugs to deal with. Firefox 8 doesn't support XHR array buffer responses inside Web Workers (let alone not supporting local hosted workers at all)... Both of those issues are fixed in Aurora but I keep getting buffer underflow errors from Sink.js. So perhaps we should only do the worker thing in Chrome and keep everything in the main thread for Firefox? What do you think.

Living on the cutting edge is ugly sometimes. :(

A demuxer for this container was not found.

I am trying to use alac to play files from URL. And the demuxer cannot be found for ALAC. How do I get ALAC files to play from URL?

var AV = require('av');
require('alac');

var player = function(url) {
  console.log("play " + url)
  var p = AV.Player.fromURL(url);
  p.on('ready', function() {
    console.log('ready to play');
  });
  p.on('buffer', function(percent) {
    console.log('buffering ' + percent);
  });
  p.on('error', function(err) {
    console.log('error ' + err);
  })
  p.on('format', function(value) {
    console.log('format ' + value);
  });
  p.volume = 100;
  p.play();
}

player('/api/getfile/01%20The%20Eater%20Of%20Dreams.m4a');

in the console, I have added some debug statements to track program flow.


registering demuxer function M4ADemuxer() {
      return M4ADemuxer.__super__.constructor.apply(this, arguments);
    }
demuxer.js?fc11:104 registering demuxer function CAFDemuxer() {
      return CAFDemuxer.__super__.constructor.apply(this, arguments);
    }
demuxer.js?fc11:104 registering demuxer function AIFFDemuxer() {
      return AIFFDemuxer.__super__.constructor.apply(this, arguments);
    }
demuxer.js?fc11:104 registering demuxer function WAVEDemuxer() {
      return WAVEDemuxer.__super__.constructor.apply(this, arguments);
    }
demuxer.js?fc11:104 registering demuxer function AUDemuxer() {
      return AUDemuxer.__super__.constructor.apply(this, arguments);
    }
decoder.js?6368:105registering id:lpcm decoder: function LPCMDecoder() {
      this.readChunk = __bind(this.readChunk, this);
      return LPCMDecoder.__super__.constructor.apply(this, arguments);
    }
decoder.js?6368:105registering id:ulaw decoder: function XLAWDecoder() {
      this.readChunk = __bind(this.readChunk, this);
      return XLAWDecoder.__super__.constructor.apply(this, arguments);
    }
decoder.js?6368:105registering id:alaw decoder: function XLAWDecoder() {
      this.readChunk = __bind(this.readChunk, this);
      return XLAWDecoder.__super__.constructor.apply(this, arguments);
    }
decoder.js?049e:3decoder
ag_dec.js?50da:3ag_dec
decoder.js?049e:25Registering ALACDecoder
decoder.js?6368:105registering id:alac decoder: function ALACDecoder() {
      return ALACDecoder.__super__.constructor.apply(this, arguments);
    }
File.js?1ab7:76 play /api/getfile/01%20The%20Eater%20Of%20Dreams.m4a
buffering 0.7638004667497408
demuxer.js?fc11:113test format: function M4ADemuxer() {
      return M4ADemuxer.__super__.constructor.apply(this, arguments);
    }
m4a.js?210c:27m4a seeking
m4a.js?210c:28Stream {list: BufferList, localOffset: 0, offset: 0}
demuxer.js?fc11:122UnderflowError {name: "UnderflowError", stack: "Error↵    at new UnderflowError (eval at <anonymou…st:8000/assets/app.js:9205:2), <anonymous>:56:12)"}
demuxer.js?fc11:113test format: function CAFDemuxer() {
      return CAFDemuxer.__super__.constructor.apply(this, arguments);
    }
demuxer.js?fc11:122UnderflowError {name: "UnderflowError", stack: "Error↵    at new UnderflowError (eval at <anonymou…st:8000/assets/app.js:9205:2), <anonymous>:56:12)"}
demuxer.js?fc11:113test format: function AIFFDemuxer() {
      return AIFFDemuxer.__super__.constructor.apply(this, arguments);
    }
demuxer.js?fc11:122UnderflowError {name: "UnderflowError", stack: "Error↵    at new UnderflowError (eval at <anonymou…st:8000/assets/app.js:9205:2), <anonymous>:56:12)"}
demuxer.js?fc11:113test format: function WAVEDemuxer() {
      return WAVEDemuxer.__super__.constructor.apply(this, arguments);
    }
demuxer.js?fc11:122UnderflowError {name: "UnderflowError", stack: "Error↵    at new UnderflowError (eval at <anonymou…st:8000/assets/app.js:9205:2), <anonymous>:56:12)"}
demuxer.js?fc11:113test format: function AUDemuxer() {
      return AUDemuxer.__super__.constructor.apply(this, arguments);
    }
demuxer.js?fc11:122UnderflowError {name: "UnderflowError", stack: "Error↵    at new UnderflowError (eval at <anonymou…st:8000/assets/app.js:9205:2), <anonymous>:56:12)"}
File.js?1ab7:92error A demuxer for this container was not found.
File.js?1ab7:89buffering 24.084558295221953
File.js?1ab7:89buffering 85.09596537673015
File.js? 1ab7:89buffering 92.61631746226932
File.js?1ab7:89buffering 96.44101535345938

Status update

So I split up and rearranged the files a bit and they should match up with the file structure on the original C++ version now. We really need to set up a test environment so we can see if this thing actually works. But first we need to write the decoder for the container (mp4) and find the "magic cookie" to send to the decoder. And then we need to actually play the decoded audio. :)

Streaming and node.js

Hi,

I'm be interested in using this to decode ALAC encoded audio from an AirPlay device; any pointers on how I would use this library for that purpose?

My current work is at https://github.com/stephencwan and only works with PCM data over AirPlay so far.

Cheers,
Stephen

Decode from buffer

Hi

Is there a way to decode alac from a buffer? I have looked at AV carefully, but I only found the way using AV.Asset.fromBuffer(buffer). However, I did not figure out how to define the format to be alac.

Actual working demo

I heard from @devongovett (on IRC I believe) that it was working - but can we have a demo with audio and all? Maybe work with @quinnirill to have an audio sink. @JensNockert I know you've been busy with school and all, but this is a priority right now, so if we can all just pitch in and make it happen quickly.

The goal right now is to quickly get up a page ie. codecs.ofmlabs.org where we have both jsmad and alac.js side-by-side, running on the same audio sample, and later on we can add how much time/CPU it takes to decode both formats, maybe measure the error induced by MP3, the size ratios, interesting stuff like that.

But first, run two working demos side-by-side. Quickly.

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.