AudioDeviceManager Set Bit Depth


#1

Hi everyone,

Is it possible to change a USB audio interface/device’s bit depth from JUCE? I don’t see any option to change it from AudioDeviceManager class. I know in the long scheme of things it really doesn’t matter but I’d like to have the option available for users on my application.

Thanks!


#2

No, this is currently not possible with JUCE.


#3

Ah thanks! I guess I would have to build my own driver/classes to fully control a USB audio device then?


#4

To be honest, most USB audio devices will only accept a single bit-depth natively anyway. Furthermore, on Mac, you always feed floating-point numbers to CoreAudio anyway (24-bit). The floats are then converted to the native sample format by the audio driver in the kernel (see IOKit sample audio drivers) - so I’m not really sure what advantage you would get by allowing the user to select this - at least on Mac.


#5

…just out of couriosity, is there a special kind of float with 24 bits, or did you just mean exceeding the dynamic range of 24 bit integers? I assume it’s “regular” 32 bit floats…


#6

Yes, it’s regular 32-bit floats.


#7

Sorry I’m just a little confused here… but on a USB Audio device, wouldn’t the 16-bit / 24-bit options also refer to how the usb audio device’s codec is working at? For example, if I chose 16-bit, the codec would be reading in/out 16-bit word data. If I chose 24-bit, the codec would be reading in/out 32 bit data (24 bit with extra 8 bits zero-packed). With that information, I don’t understand how most USB audio devices only accept a single bit depth as most usb audio devices have 16/24-bit options. Could you clarify that for me? I realize I could totally be asking something totally different or that I’m totally off.

However I do understand that CoreAudio is going to be reading/sending the data the same way no matter what so there’s no real advantage to it.


#8

You probably know more than I do. The USB DACs that I have lying around here only either do 16-bit or 24-bit options. I was under the impression that most hardware USB DACs only have a single real bit depth at hardware level. I guess I’m wrong here.


#9

If I understand things right, JUCE is never talking to the audio hardware but to an abstraction layer, which you select by choosing the AudioIODeviceType. This can be CoreAudio on Mac, or ASIO, DirectSound, ALSA, etc.
So the bit depth of the conversion DAC / ADC to that abstraction layer is important. But after that point it is already converted into float values, which is how the AudioIODevice and the corresponding AudioIODeviceCallback use them.
So if there is a setting, it will be driver specific and therefore JUCE doesn’t implement that…


#10

Alright so I’m not going totally crazy here/I thought I was missing a huge chunk of knowledge right there.[quote=“daniel, post:9, topic:21044, full:true”]
If I understand things right, JUCE is never talking to the audio hardware but to an abstraction layer, which you select by choosing the AudioIODeviceType. This can be CoreAudio on Mac, or ASIO, DirectSound, ALSA, etc.
So the bit depth of the conversion DAC / ADC to that abstraction layer is important. But after that point it is already converted into float values, which is how the AudioIODevice and the corresponding AudioIODeviceCallback use them.
So if there is a setting, it will be driver specific and therefore JUCE doesn’t implement that…
[/quote]

Ok so I think this was my original conclusion to Fabian’s first response. Just as a follow up to this, I know you can change a usb audio device’s bit rate/sample rate via Mac’s Audio/MIDI Setup (choosing bit rates and such). Is it correct to guess that changing the bit rate this way is also changing the usb audio device’s codec’s bit depth in most usb audio devices? If so, is it possible to write some additional code in JUCE’s core audio files to enable/set this bit depth? From my experience with JUCE so far, I’ve been able to change a USB audio device’s sample rate so I figured it could happen with bit depth? In my experience of programming USB audio devices… changing the bit rate through the Audio/MIDI setup is just enabling a different USB alternate setting for the device.


#11

Indeed…

But I never got into that detail, only from a users perspective. When writing plugins, I can comfortably ignore that, and the standalone apps I developed so far are not targeting that advanced users…

It’s interesting though how things will evolve…


#12

Oh wow! Thanks for pointing this out. Didn’t realise that this is possible.


#13

Yea I figured (at least in the last day) that JUCE wouldn’t usually need to do that because its users are usually programming plugins that don’t have to deal with that much detail. I’ll probably research this a little more before making an executive decision whether this is all worth it or not. Thanks! :slight_smile: