Using AudioPlayer node changes sampling frequency to 44,100

Viewed 37

I have the following audio engine chain in Audiokit :

48kHz audio file -> AudioPlayer -> some node -> NodeRecorder -> audio file

Even though the input file is 48kHz , the recorded file comes out at 44,100 Hz.

How to force AudioKit to stay at 48KHz throughout ?

I'm using Audiokit 5.3

Btw, If I use microphone as input instead of file, then all is well, the recorded file comes out at 48kHz. Mic input -> some node -> NodeRecorder -> audio file

So I suspect the AudioPlayer node is doing some unrequested resampling, how to turn that off?

2 Answers

Thank you @Nick , this put me in the right direction. Actually all that was needed to run the engine at 48kHz was to add this line at init():

Settings.audioFormat = AVAudioFormat(standardFormatWithSampleRate: 48000, channels: 2) ?? AVAudioFormat()
Related