Trying To Find Out Core Audio NBandEQ

So, I'm trying to figure out the poorly documented NBandEQ that Apple added in iOS 5. I can make it work fine for anything in 16 groups, but I want more :) What happens if I do this 15-band equalizer everything works, but if I go to any number 16 and above, I get the error -10851 ( kAudioUnitErr_InvalidPropertyValue ) when I set kAUNBandEQProperty_NumberOfBands , then the first 8 bands are fine and the rest is -10878 ( kAudioUnitErr_InvalidParameter ). Thus, 15 bands can be successfully executed, but when I switch to 16, suddenly I can only do 8. There is kAUNBandEQProperty_MaxNumberOfBands that I can read, I suggested that this is a limitation that the device can handle in its current state. Well, it spills out erratic numbers from 12-digit numbers to four-digit numbers. I think I don’t like the extreme frequencies that I give them. I ruled out this possibility. Then I realized that the frequency band of the bands can overlap, and I don't like it. therefore, I am reducing the bandwidth from the default .5 to min. 05 no help.

I really understood that after all my mess with the settings, which were stupid, because he starts complaining before I even get to these settings. He already gives and errs the number of bands.

I am posting this question to find out if any more experienced programmers can see something in my code that confuses me and point to it. I understand that not many of them relate to the main audio much less than NBandEQ, but maybe I messed up some basic C, so please take a look. I'll be very grateful. Obviously I'm upset. Also when posting this code (even if it's an ugly test code), maybe I can help others who come behind. I know that I would like to have at least one piece of code that I could look at regarding NBandEQ

Thanks in advance for your help!

  //Getting max bands for this device??? UInt32 maxNumOfBands; UInt32 propSize = sizeof(maxNumOfBands); AudioUnitGetProperty([_equilizer audioUnit], kAUNBandEQProperty_MaxNumberOfBands, kAudioUnitScope_Output, 0, &maxNumOfBands, &propSize); NSLog(@"THIS IS THE MAX NUMBER OF BANDS?---%u",(unsigned int)maxNumOfBands); UInt32 noBands = [eqFrequencies count]; // Set the number of bands first NSLog(@"NumberOfBands atempted:%i with result:%ld", (unsigned int)noBands, AudioUnitSetProperty(_equilizer.audioUnit, kAUNBandEQProperty_NumberOfBands, kAudioUnitScope_Global, 0, &noBands, sizeof(noBands))); // Set the frequencies for (NSUInteger i=0; i<noBands; i++) { NSLog(@"Set Frequency for band:%i with result:%ld", i, AudioUnitSetParameter([_equilizer audioUnit], kAUNBandEQParam_Frequency+i, kAudioUnitScope_Global, 0, (AudioUnitParameterValue)[[eqFrequencies objectAtIndex:i] floatValue], 0)); } //set bandwidth for (NSUInteger i=0; i<noBands; i++) { NSLog(@"Set bandwidth for band:%i with result:%ld", i, AudioUnitSetParameter([_equilizer audioUnit], kAUNBandEQParam_Bandwidth+i, kAudioUnitScope_Global, 0, 0.05,//of octive 0)); } // Set the bypass to off "0" for (NSUInteger i=0; i<noBands; i++) { NSLog(@"Set Bypass for band:%i with result:%ld", i, AudioUnitSetParameter([_equilizer audioUnit], kAUNBandEQParam_BypassBand+i, kAudioUnitScope_Global, 0, 0,//off 0)); } 

}

+4
source share
1 answer

Ok, I figured it out. I used kAudioUnitScope_Output on kAUNBandEQProperty_MaxNumberOfBands , it should be kAudioUnitScope_Global .

kAUNBandEQProperty_MaxNumberOfBands led to 16 on Sim, iPhone 5 and Retina iPad.

+3
source

All Articles