USB Audio ref design: bits per sample

Sub forums for various specialist XMOS applications. e.g. USB audio, motor control and robotics.
pmillett
New User
Posts: 2
Joined: Mon Nov 28, 2011 10:47 pm

USB Audio ref design: bits per sample

Post by pmillett »

I apologize in advance if this is obvious, as I'm working a little out of my element here :roll:

I've been digging through the ref design code, trying to find some indication of how many bits per sample are being sent in the USB audio stream. I can see (for example) where the sample rate gets set... but nothing about bits/sample. It almost looks like the driver is always sending the same size packets, and I2S is always 32 bits/frame, so maybe the HW doesn't even need to know?

I'd like to know this so I can display the current sample rate and bits/sample (16 or 24) on a UI.

TIA,
Pete


User avatar
Ross
XCore Expert
Posts: 820
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

pmillett wrote:I apologize in advance if this is obvious, as I'm working a little out of my element here :roll:

I've been digging through the ref design code, trying to find some indication of how many bits per sample are being sent in the USB audio stream. I can see (for example) where the sample rate gets set... but nothing about bits/sample. It almost looks like the driver is always sending the same size packets, and I2S is always 32 bits/frame, so maybe the HW doesn't even need to know?

I'd like to know this so I can display the current sample rate and bits/sample (16 or 24) on a UI.

TIA,
Pete
In the default reference design the number of bits transmitted to/from the device is 32bits. This is made up of 24 bits of sample and 8-bits of zero padding (See bBitResolution and bSlotSize in the device descriptors/USB Audio Class specification). If a 16 bit file is being played the host will zero-pad.
pmillett
New User
Posts: 2
Joined: Mon Nov 28, 2011 10:47 pm

Post by pmillett »

Ross wrote:
In the default reference design the number of bits transmitted to/from the device is 32bits. This is made up of 24 bits of sample and 8-bits of zero padding (See bBitResolution and bSlotSize in the device descriptors/USB Audio Class specification). If a 16 bit file is being played the host will zero-pad.
Thanks Ross. So it seems only the host knows how many bits are really being used...

Pete