I was attempting to change the properties (i.e volume, rate, etc) of the audio being played by an SCNAudioPlayer during the playback of the song, not before hand. At first I attempted using gameScene.rootNode.audioPlayers.first?.audioSource?.rate = 2. There were no errors, but the audio was unaffected. Looking at Apple’s documentation, it said audio source was used to set default values where audioNode is used to change the properties during playback. Therefore, I then attempted to use gameScene.rootNode.audioPlayers.first?.audioNode?.engine?.mainMixerNode.rate = 2. Again, the audio was unaffected. What am I doing wrong?
Also, I was attempting to add positional audio to certain enemies. According to documentation it said I had to set the audioListener node to do this. How would I go about this?
Did you ever find a solution to this?
I am experiencing the same issues now and can’t figure out how to link audioNode with SCNAudioPlayer for real time audio adjustments!!!
I never found the solution. I ended up just taking a more minimalist approach to the audio in my SceneKit game and used short, quick sound effects that didn’t need real time adjustments. Sorry I can’t be more help.
Thanks for getting back to me. I too made no progress with this approach - I even found Apple’s own example of implementing real time audio adjustments in this way and when I downloaded it that also didn’t work!!
I ended up using AudioKit for my project requirements, which once you get started, is an incredibly powerful and easy to use framework!