Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove glide effect in working with oscillator?

Tags:

audiokit

Any can help with the problem of glide effect with using oscillator. Here is the part of code, I need that every cycle oscillator sounds on new random frequency. But frequencies are changed smoothly with glide effect. How to remove glide effect?

for _ in 1...20 {

oscillator.frequency = Double.random(in: 0...10000)
oscillator.start()
sleep(1)
oscillator.stop()

}

like image 698
distapcher Avatar asked Dec 22 '25 15:12

distapcher


1 Answers

Try adding oscillator.rampDuration:

oscillator.frequency = Double.random(in: 0...10000)
oscillator.rampDuration = 0.0

oscillator.start()
sleep(1)
oscillator.stop()
like image 89
Mark Jeschke Avatar answered Dec 24 '25 05:12

Mark Jeschke



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!