Re: Core Audio integer mode
Re: Core Audio integer mode
- Subject: Re: Core Audio integer mode
- From: Brian Willoughby <email@hidden>
- Date: Wed, 31 May 2017 10:34:20 -0700
I understand the need for lossless audio, but you don't need to change the device format to preserve the original data. The maximum uncompressed audio bit depth is 24-bit, and you can convert the 32-bit float to that without any loss of resolution. You just have to be very careful of matching the sample rate when using an AUConverter. If you handle the float to integer conversion in another way, then you might not have to worry about sample rate.
If you're dealing with non-audio data, or compressed data, then that's a totally different question.
As for why your code is not working, it could be that the device driver doesn't really support what you're doing, or that you're accessing the wrong scope or device. It also depends upon which method you're using to open the input device as to whether there is a format converter in the middle.
At the very least, if you continue to pursue 32-bit integer input, your program will not work with all audio input devices. It would be far more successful to deal with the canonical 32-bit float input and use lossless conversion techniques within your app.
I've written plenty of CoreAudio code that is totally lossless with regard to passing pure 24-bit integer audio samples from input to output, all while using 32-bit float. It does take significant attention to detail, and it really helps to have some sort of bit meter on the output or other analysis tools to verify that there hasn't been an accidental loss.
Brian Willoughby
Sound Consulting
On May 31, 2017, at 7:17 AM, Hubert Pietrzykowski wrote:
> New to this list, so let me introduce myself. I've done a lot of freelancer DSP algorithm design and programming over the last 15 years (including numerous commercial products). Haven't used CoreAudio too much, one or two simple iOS projects using Remote IO.
> Now I face the problem of implementing something more challenging - I need to get the 32-bit integer data from the ADC to the OSX app (CoreAudio-based) without any conversion or any other kind of processing. Seemed easy but I was too optimistic, apparently. No matter how hard I try I cannot make it work. I can successfully enable the hog mode on the device. Once this is done I inspect the input stream format of the device, which is 32-bit floating point. This alone is a little strange, because Audio MIDI Setup says the device input is 32-bit integer (which is exactly what I need). So, the next step I try is setting the stream format (by setting corresponding property). The supported stream formats, obtained from the device by means of kAudioDevicePropertyStreamFormats includes integer streams. To my surprise the stream format does not change when I attempt to set it to the desired spec by calling AudioObjectSetPropertyData with kAudioDevicePropertyStreamFormat selector. The function does not return any error. It's just the stream that remains like it was before. To be more precise - the fields like sample rate do actually change. It's just the flags that always remain 32-bit floating point (value of 9) not matter what I do. Anyone has ideas? Is it possible? I heard the integer mode has been re-enabled in OSX starting from 10.9 if I recollect correctly, so there should be a way. Any help will be greatly appreciated.
>
_______________________________________________
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