You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AudioSnapshotTesting provides snapshot strategies for testing audio-related functionality through visual snapshots. This makes it easier to verify audio processing and manipulation in a visual, deterministic way.
10
+
AudioSnapshotTesting is a standalone snapshot testing library (no external dependencies) that works with Swift Testing framework. It provides strategies for waveform, spectrum, and spectrogram visualization, making it easy to verify audio processing and manipulation through deterministic snapshot comparisons. Snapshots are stored as lossless ALAC-encoded audio files with optional PNG visualizations for failure analysis.
More examples can be found in: [AudioSnapshotTestingTests.swift](Tests/AudioSnapshotTestingTests/AudioSnapshotTestingTests.swift)
78
+
79
+
### Requirements
80
+
81
+
- iOS 16+ / macOS 13+ (for full visualization support)
82
+
- Swift 6.2+ (for Swift Testing `Attachment` API)
83
+
- No external dependencies
84
+
85
+
### Snapshot Format
86
+
87
+
Snapshots are stored in `__AudioSnapshots__/` directory (adjacent to test files) as ALAC-encoded CAF files:
88
+
- Single buffer: `__AudioSnapshots__/{TestFile}/snapshot-name.caf`
89
+
- Multiple buffers: `__AudioSnapshots__/{TestFile}/snapshot-name.1.caf`, `snapshot-name.2.caf`, etc.
90
+
91
+
Audio data is bit-exact through pre-quantization: source buffers are quantized (Float → Int → Float) to match ALAC's encoding, enabling exact sample-by-sample comparison without floating-point tolerance.
0 commit comments