Skip to content

Instantly share code, notes, and snippets.

@zengadget
zengadget / gist:7003cc754fb4b358446528cc15e672c7
Last active October 8, 2017 19:54 — forked from rgcottrell/gist:5b876d9c5eea4c9e411c
An FM Synthesizer in Swift using AVAudioEngine
//Swift 4
import AVFoundation
import Foundation
// The maximum number of audio buffers in flight. Setting to two allows one
// buffer to be played while the next is being written.
private let kInFlightAudioBuffers: Int = 2
// The number of audio samples per buffer. A lower value reduces latency for
// changes but requires more processing but increases the risk of being unable