npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

libalac

v0.1.2

Published

Apple Lossless codec bindings

Downloads

64

Readme

libalac Build Status

Bindings to the official Apple Lossless (ALAC) encoder and decoder.

WARNING: This module is rather broken. I wrote it with poor understanding of how the codec works. Use at your own risk!

Installing

$ npm install libalac

Encoder usage

The encoder is a regular stream:

var alac = require('libalac');
var enc = alac.encoder({
  sampleRate: 44100,
  channels: 2,
  bitDepth: 16
});
input.pipe(enc).pipe(output);

alac.encoder() must have an object argument, which can contain regular readable and writable stream options, along with the following:

  • sampleRate (in Hz) required
  • channels, required
  • bitDepth, required
  • framesPerPacket, defaults to 4096 (usually no need to modify this)

The encoder object also has the following properties:

  • cookie, a buffer containing the ALAC magic cookie. These are parameters for the decoder, and is what you'd place in e.g. the kuki chunk of a CAF-file.

  • packets, array of sizes of packets in the stream. This array is only ever pushed to, and can be modified, or even replaced with an array-like object, as long as it has a push method.

  • sampleRate, channels, bitDepth, and framesPerPacket containing the final parameters used in the encoder.

Note that the encoder always reads input in native byte order!

Decoder usage

The decoder is a regular stream:

var alac = require('libalac');
var dec = alac.decoder({
  cookie: cookie,
  channels: 2,
  bitDepth: 16,
  framesPerPacket: 4096,
  packets: packets
});
input.pipe(dec).pipe(output);

alac.decoder() must have an object argument, which can contain regular readable and writable stream options, along with the following:

  • cookie, required, a buffer as generated by the encoder
  • channels, required
  • bitDepth, required
  • framesPerPacket, required
  • packets, an array of packet sizes

Instead of providing packets up front, it can also be provided (or extended) during streaming by calling packets(arr) one or more times.

Usually, these parameters can all be extracted from the container format. For example, in a CAF-file, they live in the desc, kuki and pakt chunks.

Note that the decoder always outputs in native byte order!

Hacking the code

git clone https://github.com/stephank/libalac.git
cd libalac
npm install
npm test