Audio player - with pitch control

Hi. experimenting with audio players at the moment. I am most definitely a newbie with Swift.

All working (kinda) except for my rate slider.
I get this error as soon as touch the slider:


this is my code

I worked it out. My slider had escaped its constraints.

Now it works!!

BUT! To my surprise the rate of the sample changes but not the pitch. Is there a variable within AudioPlayer to alter pitch and/or rate?

I think you need to set the .pitch to your slider.value save it to a variable and then set the .rate to the new variable.

I will admit I have done very little tinkering with the Audio in Swift.