What stream format should iOS5 effect modules use

I am trying to use an AU low pass filter. I keep getting the kAudioUnitErr_FormatNotSupported (-10868) error when setting the stream format to the filtering unit, but if I just use the remote I / O module, no error occurs.

The stream format I'm using is (Updated):

myASBD.mSampleRate = hardwareSampleRate;
myASBD.mFormatID = kAudioFormatLinearPCM;      
myASBD.mFormatFlags = kAudioFormatFlagIsSignedInteger;
myASBD.mBitsPerChannel = 8 * sizeof(float);
myASBD.mFramesPerPacket = 1;                                          
myASBD.mChannelsPerFrame = 1;           
myASBD.mBytesPerPacket = sizeof(float) * myASBD.mFramesPerPacket;                                                                            
myASBD.mBytesPerFrame = sizeof(float) * myASBD.mChannelsPerFrame;  

And I set the filter stream as follows:

 // Sets input stream type to ASBD
 setupErr = AudioUnitSetProperty(filterUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &myASBD, sizeof(myASBD));
 NSLog(@"Filter in: %i", setupErr);

 //NSAssert(setupErr == noErr, @"No ASBD on Finput");


//Sets output stream type to ASBD
setupErr = AudioUnitSetProperty(filterUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 0, &myASBD, sizeof(myASBD));
NSLog(@"Filter out: %i", setupErr);
NSAssert(setupErr == noErr, @"No ASBD on Foutput");
+5
source share
3 answers

The canonical format for iOS filter audio devices is 8.24 fixed points (linear PCM), which is 32 bits per channel, not 16.

+3
source

??? tryn .... ?

+2

.

size_t bytesPerSample = sizeof (AudioUnitSampleType); //Default is 4 bytes
myASBD.mSampleRate        = hardwareSampleRate;
myASBD.mFormatID          = kAudioFormatLinearPCM;
myASBD.mFormatFlags       = kAudioFormatFlagsAudioUnitCanonical; //Canonical AU format
myASBD.mBytesPerPacket    = bytesPerSample;
myASBD.mFramesPerPacket   = 1;
myASBD.mBytesPerFrame     = bytesPerSample;
myASBD.mChannelsPerFrame  = 2;  //Stereo
myASBD.mBitsPerChannel    = 8 * bytesPerSample;  //32bit integer

You need to make sure that all of your ASBD AudioUnits are configured evenly.

If you do heavy sound processing, floats (supported in iOS5) are also a good idea.

size_t bytesPerSample     = sizeof (float); //float is 4 bytes
myASBD.mSampleRate        = hardwareSampleRate;
myASBD.mFormatID          = kAudioFormatLinearPCM;
myASBD.mFormatFlags       = kAudioFormatFlagIsFloat;
myASBD.mBytesPerPacket    = bytesPerSample;
myASBD.mFramesPerPacket   = 1;
myASBD.mBytesPerFrame     = bytesPerSample;
myASBD.mChannelsPerFrame  = 2;
myASBD.mBitsPerChannel    = 8 * bytesPerSample;  //32bit float
0
source

All Articles