Re: iPad Pro USB audio
Re: iPad Pro USB audio
- Subject: Re: iPad Pro USB audio
- From: Brian Willoughby <email@hidden>
- Date: Sun, 17 Mar 2019 14:22:45 -0700
Rather than divide by 28.18, you can multiply by 0.03548, which is (1 / 28.18).
This can be faster, depending upon the compiler.
What you’re doing is dropping the signal level by 29 dB. This tells me there is
a gain issue somewhere that you’re not aware of.
In my experience, input devices may or may not have a volume control associated
with the device in CoreAudio. Of those devices that have a volume control, the
range can vary wildly. Some hardware devices can only attenuate - they cannot
boost the gain - so their volume ranges from negative gain to 0 dB, but no
higher. Other hardware devices can handle significant gain, so their volume
control ranges from negative gain to positive gain, and sometimes that is as
high as +15 dB or +30 dB. On my MacBook Pro, the built-in microphone volume
ranges from -12 dB to +12 dB.
My point is that you can’t set the input device volume to maximum for all
devices. The +29 dB gain that you’re seeing is probably due to the volume
setting for the input device. This is exposed to the user, so there might not
be an Apple-approved way to guarantee that this isn’t set to something crazy.
If the control maxes out at 0 dB, then you want to turn it all the way up. If
the control goes beyond 0 dB, then it’s a really bad idea to set the control to
the top of the range.
I’ve never written code to access the hardware input device volume control, but
everything else in CoreAudio provides metadata for the units and range of a
control. Thus, you should be able to see that your input device is set to +29
dB instead of 0 dB, where it wouldn’t clip.
By the way, if you’re using an XMOS chip, then you might want to check whether
the firmware properly implements USB Audio Device Descriptors as appropriate
for your hardware. A mistake in the USB firmware could cause significant
problems with CoreAudio.
Brian Willoughby
On Mar 17, 2019, at 7:01 AM, Jean-Charles Rousset <email@hidden> wrote:
> Hi Andrew,
>
> Thanks for your feedback.
> I submitted a new bug on the Apple bug reporter as I could not find out what
> is wrong here.
> The problem appears only with inputs (ADC) as playing sound works great (even
> though the devices are still detected as Headphones…).
> Dividing all the coming samples in the callback by 28.18 is a dirty
> workaround, but it did work.
>
> I guess this will be solve in a next iOS release.
>
> Best,
> JC
>
> Le 15 mars 2019 à 20:11, Andrew Smith <email@hidden
> <mailto:email@hidden>> a écrit :
>> Yes, I found the same thing!
>>
>> One thing I did find is that I had some old code that was trying to set the
>> gain of the input ADC, assuming that the internal mic was being used, and
>> this got converted to sending out USB HID volume changes, which resulted in
>> the USB audio device I had connected increasing its gain. When I lowered the
>> gain I was setting, the USB gain went down as well.
>>
>> Seems a little buggy.
>>
>> Best,
>> Andrew Smith
>>
>>> Date: Thu, 14 Mar 2019 21:55:09 +0100
>>> From: Jean-Charles Rousset <email@hidden>
>>> Message-ID: <email@hidden>
>>>
>>> Hi everyone,
>>>
>>> I just got the new iPad Pro with the USB-C connector.
>>> Our iOS app works with different external USB audio devices.
>>> I wanted to check if everything works fine but I am quite surprised about
>>> the results I got:
>>> All USB devices seem to be recognized as « Headsets », not as USB devices
>>> like it used to be. The number of In an Out channels seems to be correct
>>> though.
>>> Furthermore, there seems to be a higher « gain ». I could dig a bit and all
>>> samples seem to around 28.18 bigger.
>>> There is very probably a reason about all of this but I have to say that I
>>> am a bit lost here…
>>> Note that this is not related to our app as the genuine recorder gives the
>>> same results. Our audio devices integrate a XMOS, but I also got the same
>>> results with basic other sound cards.
>>> Am I missing something?
>>> Thanks a lot.
>>> JC
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden