Reputation: 51
I've released iPhone app which uses AKOscillator to ring the sounds. There are some glitch noises.
I'm afraid that it may be troubelesome for you to download and try it, but I want to know the noises due to my code or AudioKit itself.
Here's a link of my app. Of course, it is free.
https://itunes.apple.com/us/app/kist/id1320616182?mt=8
And I put related code I wrote below.
//connect nodes
oscillator1 = AKOscillator(waveform: AKTable(.triangle))
oscillator2 = AKOscillator(waveform: AKTable(.sine))
panner1 = AKPanner(oscillator1, pan: -1)
panner2 = AKPanner(oscillator2, pan: 1)
mixer = AKMixer(panner1,panner2)
//Generate FreqArray
for i in 0...360 {
let freq = (220 * pow(2, i / 120))
freqArray.append(freq)
}
//The function to ring the sounds
func letSoundOut(_ toPoint:CGPoint) {
let x = round(toPoint.x)
let y = round(toPoint.y)
if (y < 0 || y > 360) || (x < 0 || x > 360) {
mixer.stop()
}
else {
mixer.start()
oscillator1.frequency = freqArray[Int(y)]
oscillator2.frequency = freqArray[Int(x)]
}
}
The value of x and y is limited between 0 and 360, because the size of the drawing canvas is 360pt x 360pt.
I use AudioKit 4.0.4, swift 4, Xcode 9.2
Upvotes: 2
Views: 249
Reputation: 4573
The fix is to update AudioKit to the develop branch. Or change the triangle to a different waveform because that is the culprit. We will create an AudioKit 4.0.5 branch with the fix built in. Sorry for the problem.
Upvotes: 1