JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q35986F
  • License ISC

An ATRAC1 audio codec implementation in JS

Package Exports

  • carta1
  • carta1/codec/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (carta1) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Carta1

An ATRAC1 audio codec implementation in JS.

Features

  • Pure JavaScript implementation of ATRAC1 codec
  • Encoding WAV to AEA (ATRAC1) format
  • Decoding AEA to WAV format
  • Command-line interface
  • Browser-compatible with Web Workers
  • Streaming support for large files

Installation

npm install carta1

CLI Usage

Encoding

carta1 --encode input.wav output.aea

Decoding

carta1 --decode input.aea output.wav

Options

  • -e, --encode - Encode WAV to AEA
  • -d, --decode - Decode AEA to WAV
  • -j, --json - Dump AEA file structure to JSON
  • -q, --quiet - Suppress all output except errors
  • -f, --force - Overwrite output file if it exists
  • -t, --title <title> - Custom title for AEA file metadata (encoding only)

Browser Usage

<script src="https://unpkg.com/carta1/dist/carta1-worker.min.js"></script>
<script src="https://unpkg.com/carta1/dist/carta1-worker-interface.min.js"></script>
// Create codec instance
const codec = new Carta1Worker('carta1-worker.min.js')

// Encode PCM to ATRAC1
const result = await codec.encode(pcmData, options)

// Decode ATRAC1 to PCM
const wavData = await codec.decode(aeaData)

// Clean up
codec.terminate()

API Reference

Node.js

import { encode, decode, AudioProcessor } from 'carta1'

// Encode PCM frames
const encoder = encode(options)
const encodedFrame = encoder(pcmFrame)

// Decode ATRAC1 frames
const decoder = decode()
const pcmFrame = decoder(encodedFrame)

Browser Worker API

new Carta1Worker(workerPath)

Create a new codec worker instance.

encode(pcmData, options)

Encode PCM audio data to ATRAC1 format.

decode(aeaData)

Decode ATRAC1 data to PCM format.

parseAeaBlob(blob)

Parse AEA file blob to extract metadata.

terminate()

Clean up worker resources.

Development

# Install dependencies
npm install

# Run tests
npm test

# Build minified versions
npm run build

# Lint code
npm run lint

# Format code
npm run format

Acknowledgements

This project would not have been possible without:

  • AtracDEnc by Daniel Cherednik - The reference ATRAC implementation that provided invaluable insights into the codec's inner workings and served as the primary source for understanding the ATRAC1 format specification.

License

ISC