When you read with ExtAudioFileRead, are you able to read a stereo file
into two separate buffers in your AudioBufferList?  I have only been able
to get it to read a stereo file into one buffer (interleaved), and I wonder
If your noise came from your AudioBufferList not being set up properly for
interleaved. If I were you, I would verify that you are getting both left
and right channels, and that they are not being mixed into one stream.
Maybe listen to a file with a clear left/right distinction.  The reason I
suggest this is that when looked at your ASBD that you posted before I
noticed that you weren't setting mBytesPerFrame and mBytesPerPacket
relative to your channel count. They should be sizeof(float or SInt16) *
mChannelsPerFrame.

On Mon, Jan 12, 2015 at 2:33 PM, Robert Carroll <[email protected]> wrote:

> Thanks for sending this.
>
> I am finally back into a marginal running state on both iOS 7 & 8 with a
> simplified test app. This is with branching based on the running iOS
> version. Using float for the data on iOS 8 and SInt32 on iOS 7. I use a
> typedef’ed struct which seems to work with the audio data set as void *,
> then cast in the callback to either float or SInt32. This required setting
> up a duplicate callback.
>
> I’d prefer to find a way to use floats on iOS 7, and only 1 data type
> between the 2 ios’s. So far, no luck.
>
> Using your function to set the client data ASBD threw an error in the
> Extaudiofiel read process with the format set for interleaved.
> de-interleaved works for me.
>
> regards,
>
> rob
>
>
>
>
> On Jan 12, 2015, at 1:30 PM, Dave O'Neill <[email protected]> wrote:
>
> Here is a helper function I use to get ASBDs. I use floats because they
> work with the accelerate framework and they are easier on the eye. When
> setting the kExtAudioFileProperty_ClientDataFormat property on your
> extAudioFileRef, you should use an ASBD for interleaved, and when setting
> ASBDs for audio units you should not use interleaved.  So in your case i
> would use this function to get ASBDs like this:
>
> AudioStreamBasicDescription extAudioClientASBD = asbdWithInfo(1,2,1);
> AudioStreamBasicDescription mixerInputASBD = asbdWithInfo(1,2,0);
>
> AudioStreamBasicDescription asbdWithInfo(Boolean isFloat,int
> numberOfChannels,Boolean interleavedIfStereo){
>     AudioStreamBasicDescription asbd = {0};
>     int sampleSize          = isFloat ? sizeof(float) : sizeof(SInt16);
>     asbd.mChannelsPerFrame  = (numberOfChannels == 1) ? 1 : 2;
>     asbd.mBitsPerChannel    = 8 * sampleSize;
>     asbd.mFramesPerPacket   = 1;
>     asbd.mSampleRate        = 44100.0;
>     asbd.mBytesPerFrame     = interleavedIfStereo ? sampleSize * asbd.
> mChannelsPerFrame : sampleSize;
>     asbd.mBytesPerPacket    = asbd.mBytesPerFrame;
>     asbd.mReserved          = 0;
>     asbd.mFormatID          = kAudioFormatLinearPCM;
>     if (isFloat) {
>         asbd.mFormatFlags = kAudioFormatFlagIsFloat;
>         if (interleavedIfStereo) {
>             if (numberOfChannels == 1) {
>                 asbd.mFormatFlags = asbd.mFormatFlags |
> kAudioFormatFlagsNativeEndian | kAudioFormatFlagIsPacked |
> kAudioFormatFlagIsNonInterleaved;
>             }
>         }
>         else{
>             asbd.mFormatFlags = asbd.mFormatFlags |
> kAudioFormatFlagIsNonInterleaved | kAudioFormatFlagIsPacked ;
>         }
>     }
>     else{
>         asbd.mFormatFlags = kAudioFormatFlagIsSignedInteger |
> kAudioFormatFlagsNativeEndian | kAudioFormatFlagIsPacked;
>         if (!interleavedIfStereo) {
>             if (numberOfChannels > 1) {
>                 asbd.mFormatFlags = asbd.mFormatFlags |
> kAudioFormatFlagIsNonInterleaved;
>             }
>
>
>         }
>     }
>     return asbd;
> }
>
> On Mon, Jan 12, 2015 at 8:49 AM, Robert Carroll <[email protected]>
> wrote:
>
>> Can I ask what data type you are using for your samples?
>>
>> I replaced all references to AudioUnitSampleType with float this morning.
>> That gets me correct playback on iOS8, but on iOS7 I get overloaded noise.
>> On iOS7 AudioUnitSampleType was working, as was SInt32.
>>
>> I’m running this on 2 iPads with the two iOS’s. Testing the arch with #if
>> __LP64__ shows 32-bit for both devices. I can try switching to a fixed
>> width int as per Doug Wyatt;s suggestion. My preference is to find a
>> structure that will run on both iOS’s.
>>
>> rob
>>
>>
>> On Jan 11, 2015, at 8:31 PM, Dave O'Neill <[email protected]> wrote:
>>
>> Are there any other audio units in your chain?  Be sure to set the output
>> ASBD of each audio unit to the input ASBD of the audio unit it is connected
>> to (downstream).  Just as a troubleshooting technique you can try putting
>> AUConverters between various audio units to see if that fixes things.
>> Maybe you could post your ASBD and we can spot an issue.  Instead of using 
>> AudioUnitSampleType
>> just find out what it is typedef'd to and substitute it with that ( you can
>> just highlight it and "jump to definition" in Xcode).  All of the iOS8
>> specific issues I've had were all traced back 32-64 bit issues. Here is a
>> handy guide that points out some common gotchas:
>> https://developer.apple.com/library/ios/documentation/General/Conceptual/CocoaTouch64BitGuide/ConvertingYourAppto64-Bit/ConvertingYourAppto64-Bit.html#//apple_ref/doc/uid/TP40013501-CH3-SW1
>>
>>
>> On Sun, Jan 11, 2015 at 5:00 PM, Matt Hart <[email protected]> wrote:
>>
>>> I haven't tested with m4a lossless, but I have played about 14 or so
>>> lossless wav simultaneously as well as that many m4a compressed files. They
>>> are all buffered though.
>>>
>>> On Jan 11, 2015, at 7:08 PM, Robert Carroll <[email protected]> wrote:
>>>
>>> Hi.
>>>
>>> Thanks. I am doing that with the same function call.
>>>
>>> Further investigation is pointing to some other issue. My code that
>>> reads the ExtAudioFile objects is playing single m4a files, but not
>>> multiple files set up on different mixer buses. I was testing with a single
>>> A440.if file then with 3 m4a lossless files for C4, E4, G4 which should
>>> play simultaneously.
>>>
>>> On iOS 7 it works, on iOS 8 I get a brief burst of vicious white noise.
>>>
>>> I’m inclined to think this is back to the storage type for the sample
>>> data. Since, I haven’t found an answer to a replacement for the
>>> AudioUnitSampleType on iOS, I had reverted my code to using that type.
>>>
>>> rob
>>>
>>> On Jan 11, 2015, at 6:25 PM, Matt Hart <[email protected]> wrote:
>>>
>>> I use this with iOS 8 and 7 without any issues. Did you set the expected
>>> client data format onto the audio file property?
>>>
>>> status = ExtAudioFileSetProperty(_audioFile,
>>> kExtAudioFileProperty_ClientDataFormat, sizeof(_targetAudioDescription),
>>> &_targetAudioDescription);
>>>
>>>
>>> On Jan 11, 2015, at 1:56 PM, Robert Carroll <[email protected]> wrote:
>>>
>>> I am attempting to narrow down the options why my audiograph code is
>>> failing on iOS 8.
>>>
>>> I am using ExtAudioFileRead to extract data from applelossless source
>>> files and load structs set up for this purpose.
>>> The buffers and audioData parts of the struct are typed as
>>> AudioUnitSampleType.
>>>
>>> All of this works as it should on iOS’s up to 7.x. Running on iOS 8.1.2
>>> I can play aiff source files with this code but get distortion if I load
>>> the m4a (lossless) files.
>>>
>>> What changed in iOS 8 with extaudiofile that would account for this
>>> issue?
>>>
>>> thanks
>>>
>>> rob
>>>
>>>
>>> Robert Carroll
>>> RSM Records
>>> Toronto
>>> http://www.rsmrecords.com
>>>
>>>
>>>
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Coreaudio-api mailing list      ([email protected])
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/coreaudio-api/matt%40matthart.com
>>>
>>> This email sent to [email protected]
>>>
>>>
>>>
>>>
>>>
>>>  _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Coreaudio-api mailing list      ([email protected])
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>> https://lists.apple.com/mailman/options/coreaudio-api/oneill707%40gmail.com
>>>
>>> This email sent to [email protected]
>>>
>>
>>
>>
>
>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/coreaudio-api/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to