1 Replies - 644 Views - Last Post: 27 August 2015 - 11:06 AM Rate Topic: -----

#1 Duke Diamond  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 27-August 15

Real time Pitch shifting with AVAudioEngine in Swift

Posted 27 August 2015 - 10:55 AM

I am trying to develop an Audio effects app 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(un-effected signal).

I am not sure if this is possible at all, but am interested on your thoughts.

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.
        }
    }


}


Is This A Good Question/Topic? 0
  • +

Replies To: Real time Pitch shifting with AVAudioEngine in Swift

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 13962
  • View blog
  • Posts: 55,729
  • Joined: 12-June 08

Re: Real time Pitch shifting with AVAudioEngine in Swift

Posted 27 August 2015 - 11:06 AM

Please do not open duplicate topics. You have one already in the ios area.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1