Skip to content

Audio Metadata Extraction

Now Playing’s metadata-connect package reads the metadata embedded inside audio files. It is a shared library used by every local-file DJ integration (Rekordbox, Serato, djay, VirtualDJ) and by the PRO DJ LINK artwork extractor. Its design lets Now Playing pull title, artist, and artwork from an audio file without downloading the full file — important when the file lives on a CDJ’s USB drive reached over NFS.

Metadata is stored differently in each audio format:

FormatContainerMetadata Encoding
MP3ID3v2.2, v2.3, v2.4 frames
M4A / MP4 / AACISO BMFF (mp4)iTunes atoms
FLACFlac nativeVorbis comments
AIFFAIFF chunksID3v2 chunks
Ogg VorbisOGGVorbis comments

The package understands all of these and returns a normalised result regardless of the underlying encoding.

FieldNotes
TitleString
ArtistString
AlbumString
GenreString
YearNumber or ISO date
BPMNumber
Musical keyString (where tagged)
ArtworkImage bytes (JPEG, PNG, or GIF) with MIME type

The package is built around a FileReader abstraction. A reader is a small object that knows how to fetch a byte range from somewhere. Several reader implementations exist:

  • Local file readerfs.read with an offset and length.
  • HTTP range reader — ranged GET requests with Range: bytes=….
  • NFS partial reader — read a byte range from a remote NFS export, used by the PRO DJ LINK artwork path for CDJs.
  • Custom readers — any caller can supply a reader for unusual sources.

By requesting only the first few kilobytes of an audio file, the metadata extractor can obtain title, artist, and even artwork without transferring the entire track. For a full CDJ USB library, this turns a 10 MB per-track fetch into a 100 KB one.

The package has zero runtime dependencies and is implemented entirely in TypeScript. That choice matters for two reasons:

  • Works in Electron’s renderer and main processes — no native modules means no platform-specific rebuild headaches.
  • Works in the cloud services — the server-side enrichment path uses the same library for files delivered over the file-upload endpoint.

metadata-connect is used under other integrations, not alongside them:

  • rekordbox-connect uses it to read embedded artwork from tracks found in the Rekordbox database.
  • serato-connect uses it to parse ID3 tags in tracks, then layers GEOB frame decoding on top.
  • djay-connect uses it to read artwork referenced by djay’s MediaLibrary.db.
  • alphatheta-connect uses it (with an NFS reader) to read artwork from CDJ USB drives without downloading the whole track.

The result is that artwork extraction is consistent and deduplicated across every source.