I am developing an Audio effects application on OSX using Swift, and I'm interested in integrating a pitch-shift effect.
I would like in real-time, to change the tone up or down an octave. Currently I am only getting a dry signal.
I am not sure if this is possible at all and would like to know if this is even possible or any help or suggestions anyone may have.
Current code relevant to the problem is as follows:
import Cocoa
import AVFoundation
class ViewController: NSViewController {
var engine = AVAudioEngine()
var timePitch = AVAudioUnitTimePitch()
override func viewDidLoad() {
timePitch.pitch = 1200
// Setup engine and node instances
var mixer = engine.mainMixerNode
var input = engine.inputNode
var output = engine.outputNode
var format = input.inputFormatForBus(0)
var error:NSError?
engine.attachNode(timePitch)
engine.connect(input, to: timePitch, format: format)
engine.connect(timePitch, to: output, format: format)
engine.startAndReturnError(&error)
super.viewDidLoad()
}
override var representedObject: AnyObject? {
didSet {
// Update the view, if already loaded.
}
}
}