sonobus
sonobus copied to clipboard
Ability to select non-default audio device channel configuration
I have some USB audio devices which are capable of 8-channel output (7.1), but by default they appear as a 2-channel stereo device.
On desktop OSes, e.g. macOS using the "Audio MIDI Setup" app, I can configure the device to provide 8-channel output, and then Sonobus is able to use all 8 channels. However, I cannot do the same thing when using Sonobus on iOS. Ideally, Sonobus could provide some way of convincing the device to use a specific/higher channel count, and/or attempt to configure an audio device to provide the maximum number of channels by default.
That's pretty strange, and sounds like a very device specific kind of thing. Usually if a device supports multiple channels it doesn't need pre-configuring to present them to the USB audio subsystem on the device. What model devices are you using exactly?
Here are a couple example devices:
- https://www.amazon.ca/gp/product/B07QBZVNPW
- https://www.amazon.ca/gp/product/B07FZLFN6T
The same thing happens in Windows as well (stereo output by default, but under "Sound Control Panel" -> "Playback" -> (select device) -> "Configure"
you can select 5.1 or 7.1 output and then Sonobus will see the extra channels).
I'm not sure, but this may provide a way to do it programmatically that could be used on the Apple OSes?
https://stackoverflow.com/questions/16557371/how-to-set-speaker-configuration-programatically-using-core-audio-api-on-mac-os
Actually, I think the above way is macOS-only -- and probably more involved than necessary, anyway!
I was able to get this working in a custom SonoBus iOS build, in a very quick-and-dirty way:
I added the following lines
NSError *error;
[session setPreferredOutputNumberOfChannels:8 error:&error];
in deps/juce/modules/juce_audio_devices/native/juce_ios_Audio.cpp
after line 117:
auto session = [AVAudioSession sharedInstance];
NSError *error;
[session setPreferredOutputNumberOfChannels:8 error:&error];
This was sufficient to get the device operating in "7.1" (i.e. 8 channel output). I'm not really sure how implementing this would look in a more generic / user-accessible way e.g. with GUI controls in SonoBus, though for now my custom build works fine for me; I can monitor 8 different peers with these super cheap audio interfaces!