Socket
Book a DemoInstallSign in
Socket

@alac/decoder

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alac/decoder

A decoder that turns raw ALAC data into PCM data.

0.1.0
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

ALAC Decoder

A decoder that turns raw ALAC data into PCM data.

Installation

npm install --save @alac/decoder

Usage

const cookie = new Uint8Array(/* ... */) // e.g. from CAF 'kuki' chunk
const packets = new Uint32Array(/* ... */) // e.g. from CAF 'pakt' chunk

const decoder = new ALACDecoder(cookie)

// This buffer will be written into from the decoder, it needs to hold at least one full decoded packet
const outputBuffer = new Uint8Array(decoder.bytesPerPacket)

for (const size of packets) {
  const packet = new Uint8Array(/* ... */) // the next `size` bytes from your ALAC data

  const framesWritten = decoder.decodeChunk(packet, outputBuffer)
  const bytesWritten = framesWritten * decoder.bytesPerFrame

  // The first `bytesWritten` bytes will now be filled with PCM data
  const decodedChunk = outputBuffer.slice(0, bytesWritten)
}

FAQs

Package last updated on 07 Jan 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.