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:
2026-07-22 17:45:34 -07:00
parent 62b2f5dbec
commit 8eb64f883f
33 changed files with 2650 additions and 352 deletions
@@ -553,14 +553,24 @@ public final class LyrebirdScratchModel: ObservableObject {
}
/// Render the current selection (or the whole buffer when nothing is
/// selected) to a CAF audio file, offline. Builds the snippet graph on a
/// selected) to an audio file, offline. Builds the snippet graph on a
/// throwaway engine driven by an `NRTDriver` — matching the live engine's
/// sample rate / channel count / bus layout — then renders `duration`
/// seconds off the main thread (`NRTDriver.start()` blocks). Logs the
/// outcome to the console.
///
/// - Parameters:
/// - url: Destination file. Its extension should match `format`.
/// - format: Container and PCM encoding (``AudioFileFormat``). Defaults to
/// `.cafFloat32`. RF64/CAF are uncapped; plain WAV/AIFF throw past 4 GB.
/// - duration: Render length in seconds. Must be finite and > 0.
/// - Returns: `true` when the file was rendered (so the caller can reveal it).
@discardableResult
public func renderToFile(url: URL, duration: Double) async -> Bool {
public func renderToFile(
url: URL,
format: AudioFileFormat = .cafFloat32,
duration: Double
) async -> Bool {
guard !isCompiling else { return false }
guard duration > 0, duration.isFinite else {
appendConsole(.error, "Render duration must be a positive number of seconds.")
@@ -589,7 +599,7 @@ public final class LyrebirdScratchModel: ObservableObject {
numInputChannels: 0,
numAudioBuses: live.numAudioBuses,
numControlBuses: live.numControlBuses,
driver: NRTDriver(outputURL: url, duration: duration)
driver: NRTDriver(outputURL: url, duration: duration, format: format)
)
let offlineSession: LiveSession = LiveSession(engine: offline, attachScope: false)
do {