AudioMarker
Published on · 19 min
The Problem
You have a raw audio file. You want to add timestamped chapters, cover art, proper metadata. Simple, right?
In reality, it's an uphill battle.
Back when I was producing electronic music podcasts, GarageBand could encode M4A/M4B files with built-in chapters. It was tedious, but it worked. Apple has since dropped this feature — and nobody really stepped up.
Today, options are limited: obscure command-line tools, inflexible paid apps, or heavy dependencies like FFmpeg that you can't ship in an iOS app. Nothing native, nothing Swift, nothing truly built for Apple developers.
AudioMarker fills this gap.
The Solution
AudioMarker is a production-ready Swift library for enriching your audio files with metadata, chapters, artwork and synchronized lyrics.
The core library is pure Swift with zero external dependencies. All parsing and writing — whether ID3v2 for MP3 or ISOBMFF/iTunes atoms for M4A — happens at the byte level, with streaming I/O that never loads audio data into memory. Even on a 3-hour podcast, memory footprint stays minimal.
Two interfaces, same power:
A Swift library — Drop into your iPhone, iPad, Mac and Vision Pro apps. Zero external dependencies, 100% native, App Store compatible.
A CLI tool — 17 commands for command-line processing, automation and CI/CD pipelines.
What AudioMarker Can Do
The list is long, and that's intentional. When working with audio, you want a tool that handles all cases — not just the easy 80%.
30 metadata fields — From basics (title, artist, album) to professional (ISRC, BPM, musical key, publisher, copyright)
Chapters with URLs and artwork — Each chapter can have its own link and image, perfect for Enhanced Podcasts
Synchronized lyrics — LRC, TTML, WebVTT and SRT import/export with full fidelity
Karaoke and speakers — Word-level timing and speaker identification for multi-voice podcasts
9 exchange formats — Podlove JSON/XML, MP4Chaps, FFMetadata, Podcast Namespace, Cue Sheet, Markdown, WebVTT, SRT
Validation engine — 10 built-in rules, extensible via protocol
Batch processing — Parallel processing with bounded concurrency
ID3v2.3 and v2.4 — Full read/write support for 29 frame types
MP4/M4A/M4B — Read/write 17 iTunes atoms, Nero and QuickTime chapters
Quick Start
Let's start with the simplest case: reading an audio file and displaying its info.
AudioMarkerEngine is the unified entry point. It auto-detects the format from magic bytes and file extension, then dispatches to the appropriate reader — you don't need to worry about whether it's an MP3, M4A or M4B.
Writing Metadata
AudioMarker supports 30 metadata fields across 7 categories. Here's how to write the most common ones:
Artwork format is auto-detected from magic bytes — no need to specify whether it's JPEG or PNG.
All 30 Available Fields
For the curious, here's the complete list organized by category:
| Category | Fields |
|---|---|
Core |
|
Professional |
|
Artwork |
|
Lyrics |
|
URLs |
|
Custom |
|
Stats |
|
These fields cover both the ID3v2 spec (TXXX, WXXX, PRIV, UFID frames...) and iTunes atoms for M4A. AudioMarker writes in the correct format based on file type.
Chapters: The Heart of the Matter
Chapters transform a monolithic audio file into a navigable experience. Podcast, audiobook, DJ mix — everything becomes more accessible with proper chaptering.
AudioMarker automatically handles IN/OUT points: you don't need to specify each chapter's end time, it's calculated from the next chapter's start.
Enhanced Podcasts: URLs and Per-Chapter Artwork
The Enhanced Podcast format (popularized by Apple in the 2000s) allows associating a link and image with each chapter. Perfect for show notes, sponsors, or visual references.
Dual Writing: Nero + QuickTime
For M4A/M4B files, AudioMarker writes chapters in two formats simultaneously:
- Nero chapter list (
chplatom) — Read by VLC, ffmpeg, and most players
- Nero chapter list (
- QuickTime text track — Read by Apple Podcasts, QuickTime Player, and native Apple apps
This dual writing guarantees maximum compatibility without any extra effort on your part.
Chapter Import/Export
Have chapters in an external format? Or want to export to a specific format? AudioMarker supports 7 exchange formats with bidirectional import/export (except Markdown, export only).
| Format | Extension | Import | Export | Typical Use |
|---|---|---|---|---|
Podlove JSON |
| Yes | Yes | Modern podcasts, Podlove Publisher |
Podlove XML |
| Yes | Yes | Extended RSS feeds |
MP4Chaps |
| Yes | Yes | Subler, mp4chaps CLI |
FFMetadata |
| Yes | Yes | FFmpeg, batch conversion |
Podcast Namespace |
| Yes | Yes | Podcasting 2.0 |
Cue Sheet |
| Yes | Yes | CD ripping, DJ software |
Markdown |
| No | Yes | Documentation, show notes |
Example export to Podlove JSON:
You can also import directly into an audio file:
Synchronized Lyrics
Beyond chapters, AudioMarker handles synchronized lyrics — timestamped text that displays in real-time during playback. Three complexity levels are supported.
Simple Lyrics (Line by Line)
Karaoke (Word-Level Timing)
For karaoke, each word can have its own timing. AudioMarker uses LyricSegment to split a line into pieces:
Speaker Identification
For podcasts with multiple speakers, or audio drama, you can identify who's speaking on each line:
Smart Storage for M4A
When writing to M4A, AudioMarker automatically chooses the best storage format:
- Simple mono-language lyrics → LRC (maximum player compatibility)
- Karaoke, multi-language or speakers → TTML (full fidelity)
You don't need to think about it — the right choice is made for you.
Lyrics Import/Export
4 formats are supported for lyrics exchange:
TTML supports full round-trips — speakers, styles and regions survive export/import.
Validation
Before publishing an enriched audio file, it's better to verify everything is consistent. AudioValidator inspects an AudioFileInfo and reports potential issues:
10 Built-in Rules
| Rule | What It Checks |
|---|---|
| Timestamps are in ascending order |
| No overlapping chapters |
| Each chapter has a non-empty title |
| No chapter exceeds audio duration |
| No negative timestamps |
| File has a title |
| Artwork is JPEG or PNG |
| Year is valid (> 0) |
| Language is a valid ISO 639-2 code |
| Rating is between 0 and 255 |
Custom Rules
You can create your own rules via the ValidationRule protocol:
Auto-Validation on Write
You can configure the engine to automatically validate before each write:
Batch Processing
When you have 200 podcast episodes to process, doing it one by one isn't an option. BatchProcessor processes multiple files in parallel with bounded TaskGroup concurrency — you control how many files are processed simultaneously.
Progress Tracking
To display a progress bar or indicator, use processWithProgress which returns an AsyncStream:
Supported batch operations: .read, .write(_:), .strip, .exportChapters(format:outputURL:).
Timestamps
AudioTimestamp is the type used throughout AudioMarker to represent a point in time. It offers millisecond precision and parsing/formatting utilities:
Advanced Configuration
The engine accepts several configuration options:
| Option | Default | Description |
|---|---|---|
|
| ID3v2 version for MP3 writes |
|
| Auto-validate before writing |
|
| Keep unknown frames/atoms |
|
| Padding to avoid full file rewrite |
ID3 padding is an important optimization: if you frequently modify a file's tags, sufficient padding avoids rewriting the entire audio file on each modification.
CLI: 17 Commands for Everything
audio-marker is the command-line interface that exposes all library features. Perfect for scripts, automation and CI/CD pipelines.
Installation
Reading and Writing
Chapter Management
Import/Export
Lyrics
Artwork and Utilities
Batch
Standards and Specifications
AudioMarker implements several audio standards. Here are the references for those who want to understand what's happening under the hood:
| Standard | Specification | Usage |
|---|---|---|
ID3v2.3 | id3.org (archived) | MP3 tags, CHAP/CTOC/APIC/SYLT frames |
ID3v2.4 | id3.org (archived) | Modern version with native UTF-8 |
ISO 14496-12 (ISOBMFF) | ISO | MP4/M4A file structure |
iTunes Metadata | Apple | ©nam, ©ART, covr atoms, etc. |
Nero Chapter Format | Nero AG | chpl atom for M4A chapters |
Podlove Simple Chapters | podlove.org/simple-chapters | JSON/XML format for podcasts |
LRC | Enhanced LRC format | Karaoke synchronized lyrics |
TTML | W3C Timed Text | Lyrics with speakers and styles |
WebVTT | W3C WebVTT | Web subtitles |
Podcast Namespace | podcastindex.org/namespace | Podcasting 2.0 RSS extensions |
Architecture
The package is organized in distinct modules with clear separation of concerns:
The AudioMarker module has zero external dependencies. Only the CLI depends on swift-argument-parser for argument parsing.
Installation
Requirements
Swift 6.2+ with strict concurrency
macOS 14+ · iOS 17+ · visionOS 1+ · Mac Catalyst 17+
Add the package to your Package.swift:
Then add the dependency to your target:
Roadmap
AudioMarker is at version 0.1.0 with all features documented above. Here's what's planned for future releases:
New audio formats — FLAC, WAV, AIFF, OGG Vorbis/Opus
Linux support — Cross-platform Foundation compatibility
Legacy ID3 — ID3v1 and ID3v2.2 read support
Additional artwork formats — WebP, AVIF, HEIF
Under the Hood
Swift 6.2 — Strict concurrency, all public types are
SendableZero dependencies — Pure Swift for the core library
Streaming I/O — Audio data is never loaded into memory
Multi-platform — iOS, macOS, visionOS, Mac Catalyst
App Store ready — No third-party binaries, signable without issues
Links
GitHub - atelier-socle/swift-audio-marker: Swift library for enriching audio files with chapters, metadata, artwork, and synchronized lyrics. Native ID3v2 and MP4 atom reading/writing, streaming I/O, zero third-party dependencies.
Swift library for enriching audio files with chapters, metadata, artwork, and synchronized lyrics. Native ID3v2 and MP4 atom reading/writing, streamin…