I am using the new AVAudioSourceNode to stream audio samples to be played out of a hardware interface. I can successfully do this, however when inspecting the stream, I can see that the node seems to decide it’s own format. I assumed that this would take the format used in the line: engine.connect(sourceNode, to: mainMixerNode, format: format) However it is not using this. I have tried setting the preferred sampleRate for the audio session to 48000. Everything attached to my audioEngine uses 48000Hz but for some reason the audioSourceNode still seems to use 44100Hz, and set to 2-channel! Any suggestions?
Avaudiosourcenode set format
I found similar problem, but in my case, it sometimes works and sometimes not. Sometimes, the AVAudioSourceNode respect requested format (1 channel, int16, 48000) and sometimes I have same result as you - 44100Hz, 2 channels, floats.
I wanted to rewrite my c-api based AudioUnit code, but it seems, that AVAudioEngine is too blackbox, very difficult to debug problems like this.
Have you found any solution?
I wanted to rewrite my c-api based AudioUnit code, but it seems, that AVAudioEngine is too blackbox, very difficult to debug problems like this.
Have you found any solution?