Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What stream format should iOS5 Effect Units use

I'm trying to use a Low Pass Filter AU. I keep getting a kAudioUnitErr_FormatNotSupported (-10868) error when setting the stream format to the filter unit, but if I just use the Remote IO unit there's no error.

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'm setting the filter stream like this:

 // 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");
like image 665
Sam Kent Avatar asked Jan 29 '12 20:01

Sam Kent


2 Answers

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

like image 165
hotpaw2 Avatar answered Oct 12 '22 09:10

hotpaw2


what format is working wit the reverb unit??? I'm getting weird errors tryn to record a buffer....any news on this topic?

like image 27
Stone Alessandro Avatar answered Oct 12 '22 09:10

Stone Alessandro