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 🙏

© 2026 – Pkg Stats / Ryan Hefner

traktor-metadata

v1.0.0

Published

Read and write Native Instruments Traktor DJ metadata from audio files

Readme

traktor-metadata

Read and write Native Instruments Traktor DJ metadata from audio files.

Features

  • Parse Traktor's proprietary binary metadata from MP3 files
  • Extract BPM, key, cue points, loops, artwork, and more
  • Serialize metadata back to binary format
  • Full TypeScript support
  • Works in Node.js and browser

Installation

npm install traktor-metadata

Usage

Extract from file (Node.js)

import { extractFromFile } from 'traktor-metadata'

const metadata = await extractFromFile('track.mp3')

console.log(metadata.title)      // "Track Name"
console.log(metadata.artist)     // "Artist Name"
console.log(metadata.bpm)        // 128.5
console.log(metadata.key)        // "Am"
console.log(metadata.cuePoints)  // [{ name: "Drop", start: 60000, ... }]

Extract from buffer

import { extractFromBuffer } from 'traktor-metadata'

const buffer = await fs.promises.readFile('track.mp3')
const metadata = await extractFromBuffer(new Uint8Array(buffer))

Parse raw Traktor binary data

import { parse } from 'traktor-metadata'

// If you already have the PRIV frame data
const metadata = parse(traktorBinaryData)

Serialize metadata

import { serialize } from 'traktor-metadata'

const metadata = {
  title: 'My Track',
  artist: 'Artist Name',
  bpm: 128,
  key: 'Am',
  cuePoints: [
    { name: 'Drop', index: 0, type: 0, start: 60000, length: 0, repeats: 0, hotcue: 1 }
  ]
}

const binary = serialize(metadata)
// Write binary to PRIV frame in ID3 tag

API

Types

interface TraktorMetadata {
  // Track info
  title?: string
  artist?: string
  album?: string
  genre?: string
  label?: string
  producer?: string
  remixer?: string
  comment?: string

  // Analysis
  bpm?: number
  bpmPrecise?: number
  key?: string
  keyNumeric?: number

  // Stats
  trackNumber?: number
  playCount?: number
  ranking?: number
  lengthMs?: number
  bitrate?: number

  // Dates
  fileModified?: Date
  releaseDate?: Date
  lastPlayed?: Date
  importDate?: Date

  // Complex data
  cuePoints?: CuePoint[]
  artwork?: Artwork

  // Validation
  checksumValid?: boolean
  formatVersion?: number
}

interface CuePoint {
  name: string
  index: number
  type: CuePointType
  start: number      // milliseconds
  length: number     // milliseconds (for loops)
  repeats: number    // -1 = infinite
  hotcue: number     // 1-8, or 0 if not a hot cue
}

enum CuePointType {
  Cue = 0,
  FadeIn = 1,
  FadeOut = 2,
  Load = 3,
  Grid = 4,
  Loop = 5,
}

interface Artwork {
  width: number
  height: number
  data: Uint8ClampedArray  // RGBA pixels
}

Functions

| Function | Description | |----------|-------------| | extractFromFile(path) | Extract metadata from an audio file (Node.js) | | extractFromBuffer(buffer) | Extract metadata from a buffer | | parse(buffer) | Parse raw Traktor binary data | | serialize(metadata) | Serialize metadata to binary format | | calculateChecksum(buffer) | Calculate Traktor checksum |

Demo

Try the interactive demo to parse Traktor metadata in your browser.

How it works

Traktor stores DJ-specific metadata in the PRIV frame of ID3v2 tags. This library:

  1. Extracts the PRIV frame from the audio file
  2. Parses the proprietary binary format (element tree structure)
  3. Decodes all field types (strings, floats, dates, cue points, artwork)
  4. Validates the checksum

For writing, the process is reversed: metadata is serialized to the binary format with proper checksums.

License

MIT