v1.6.0 release: soundfile format expansion (WAV int depths + RF64 >4GB, AIFF/CAF, AAC/ALAC compressed, 4GB guard, unified AudioFileFormat)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -329,18 +329,36 @@ afconvert -f WAVE -d LEF32 output.caf output.wav
|
||||
### `LyrebirdBuffer.write()` — AIFF, WAV, or CAF
|
||||
|
||||
```swift
|
||||
try buf.write(to: url, format: .caf, sampleRate: 44100) // default
|
||||
try buf.write(to: url, format: .aiff, sampleRate: 44100) // AIFF-C, Float32
|
||||
try buf.write(to: url, format: .wav, sampleRate: 44100) // WAV, Float32
|
||||
try buf.write(to: url, format: .cafFloat32, sampleRate: 44100) // default
|
||||
try buf.write(to: url, format: .aiffFloat32, sampleRate: 44100) // AIFF-C, Float32
|
||||
try buf.write(to: url, format: .wavFloat32, sampleRate: 44100) // WAV, Float32
|
||||
|
||||
// Integer WAV encodings, for smaller files / DAW interchange:
|
||||
try buf.write(to: url, format: .wavInt16, sampleRate: 44100) // WAV, 16-bit PCM
|
||||
try buf.write(to: url, format: .wavInt24, sampleRate: 44100) // WAV, 24-bit PCM
|
||||
```
|
||||
|
||||
| Format | Extension | Endian | Channels | Notes |
|
||||
|---|---|---|---|---|
|
||||
| `.caf` | `.caf` | little-endian | up to 8 | Best for macOS; default |
|
||||
| `.aiff` | `.aiff` | big-endian | ≤ 2 recommended | Broad DAW compatibility |
|
||||
| `.wav` | `.wav` | little-endian | up to 8 | Cross-platform standard |
|
||||
| Format | Extension | Endian | Encoding | Channels | Notes |
|
||||
|---|---|---|---|---|---|
|
||||
| `.cafFloat32` | `.caf` | little-endian | 32-bit float | up to 8 | Best for macOS; default |
|
||||
| `.aiffFloat32` | `.aiff` | big-endian | 32-bit float | ≤ 2 recommended | Broad DAW compatibility |
|
||||
| `.wavFloat32` | `.wav` | little-endian | 32-bit float | up to 8 | Cross-platform standard |
|
||||
| `.wavInt16` | `.wav` | little-endian | 16-bit PCM | up to 8 | Smaller files; lossy quantise |
|
||||
| `.wavInt24` | `.wav` | little-endian | 24-bit PCM | up to 8 | Common DAW interchange depth |
|
||||
| `.rf64Float32` | `.wav` | little-endian | 32-bit float | up to 8 | RF64/BW64 — 64-bit sizes, **no 4 GB cap** |
|
||||
| `.rf64Int24` | `.wav` | little-endian | 24-bit PCM | up to 8 | RF64/BW64 — 64-bit sizes, **no 4 GB cap** |
|
||||
| `.aacHigh` / `.aacMedium` | `.m4a` | — | AAC (lossy) ~256 / ~128 kbps | up to 8 | Compressed. **Offline writers only.** Not sample-accurate. |
|
||||
| `.alac` | `.m4a` | — | Apple Lossless (24-bit source) | up to 8 | Compressed lossless. **Offline writers only.** |
|
||||
|
||||
All formats write 32-bit float samples (Float32). The `Double` (Double) values in the buffer are converted to Float32 on the way out.
|
||||
The buffer's `Double` samples are handed to `ExtAudioFile` as native Float32; the
|
||||
container's on-disk encoding drives the conversion — the Float32 cases are lossless,
|
||||
the integer cases quantise to signed 16/24-bit PCM. (`.caf` / `.aiff` / `.wav` remain
|
||||
as Float32 shorthands for the corresponding `…Float32` cases.)
|
||||
|
||||
The `.rf64*` cases keep the `.wav` extension but use RF64/BW64 (EBU Tech 3306) — 64-bit
|
||||
sizes in a `ds64` chunk — so they are exempt from the 4 GB limit that makes plain
|
||||
`.wav`/`.aiff` throw `fileTooLargeForContainer`. Lyrebird emits RF64 with its own
|
||||
`RF64Writer` (`ExtAudioFile` has no RF64 writer); CoreAudio reads it back.
|
||||
|
||||
---
|
||||
|
||||
@@ -423,6 +441,9 @@ if task.terminationStatus == 0 {
|
||||
| `NRTDriverError.cannotCreateFile` | Bad URL, permissions, or full disk | Check the path and disk space |
|
||||
| `NRTDriverError.writeFailed` | Disk I/O error during render | Check disk space and path permissions |
|
||||
| `LyrebirdBufferIOError.cannotCreateOutputFile` | Same as above for `write()` | |
|
||||
| `NRTDriverError.invalidDuration` | `duration` is negative, NaN, or infinite | Pass a finite, non-negative duration |
|
||||
| `NRTDriverError.fileTooLargeForContainer` | WAV/AIFF render projected past the 4 GB RIFF cap | Use `format: .cafFloat32`, or shorten `duration` |
|
||||
| `LyrebirdBufferIOError.fileTooLargeForContainer` | `LyrebirdBuffer.write` to WAV/AIFF projected past 4 GB | Use `.cafFloat32`, or split/shorten the buffer |
|
||||
| Silent output / all-zeros file | Synthesizers added after `start()` | Move all `engine.add()` calls before `start()` |
|
||||
| File truncated short | `duration` too short for the patch | Increase `NRTDriver` duration |
|
||||
|
||||
|
||||
Reference in New Issue
Block a user