AENewTimePitchFilter on wav file - swift 2/ios 9

Hey, I've been using an AENewTimePitchFilter for several months on app. The app loads a short file from a resource directory, which it loops. The pitch filter is added at the time the file is loaded. Then the sound is played and the pitch is changed as the user moves their finger(s) around the screen.
This was all working well until the xcode 7/swift 2 release last week. Now the sound plays briefly and goes silent. I checked the mute and playback on the channel, as well as the volume - all good.
Originally I tried adding the filters to channelgroups instead of the channel directly, but kept getting a "render took too long" message and decided to cut out the groups.

** It's worth noting that I tried Varispeed as well, and while the speed changes fine, the track distortion is so bad that it's a non-starter. I'd be willing to use either one though, if one would work 100%.

Here's what Ive been working with - any thoughts anyone? I'm out of time and options.

//each channel loads a file to be time-shifted.
func addChannel(file: NSURL, index: Int) {
        let looper = try! AEAudioFilePlayer(URL: file)
        looper.loop = true
        looper.pan = 0

        channels[index] = looper
        if AudioController.aeController.channels().count <= index {
            AudioController.aeController.addChannels([channels[index] as AnyObject])
        }
}

func addPitchFilter(index: Int) {
    if AudioController.aeController.channels().count > index {
        filters[index] = AENewTimePitchFilter()
        let channel = (AudioController.aeController.channels()[index] as? AEAudioPlayable)!
        if AudioController.aeController.filtersForChannel( channel ).count == 0 {
            AudioController.aeController.addFilter(filters[index], toChannel: channel)
        }
    }
}

//rate is sent from view multitouch y coord, index is which finger
func setPlaybackRate(rate: Float, index: Int) {
    if AudioController.aeController.channels().count > index  {
        self.filters[index].rate = Double(1.0 - rate)
        self.filters[index].pitch = Double(1.0 - rate) * 1000.0
    }
}

//called here.
let file = self.getSoundFile(fileName)
self.addChannel(file, index: 0)
self.play(index)
self.addPitchFilter(index)

Comments

  • Also - had to upgrade to newest version this morning. There was an issue with archiving and old version. This is when I first noticed this problem.

  • Ouch. No, no ideas I'm afraid (aside from sticking with Xcode 6 for now?). Could be an iOS SDK bug, but this would need some serious diagnosis work to determine.

    I suggest you just stick with what works for now. There are always problems like this with a major update from Apple.

  • I would be interested to see if this is only my issue, or if this particular effect has stopped working across the board. Can anyone else verify the NewTimePitch effect is working, swift 2/xcode 7?

  • Hi guys

    i have the same effect with NewTimePitch

    "Now the sound plays briefly and goes silent."

    Xcode 7.1

Sign In or Register to comment.