3

Im trying to build a 10 band Equaliser using NOVOCAINE. I copied the Equaliser.mm's code in viewWillAppear, and added 9 more Sliders in the xib file, and changed IBAction code too this :

-(void)HPFSliderChanged:(UISlider *)sender {
PEQ[sender.tag - 1].centerFrequency = sender.value;
NSLog(@"%f",sender.value);
} 

What I want to know is if I am doing this the right way or not ? and the what will be range of the Sliders ? Like in HPF example, the slider range is 2k to 8k. Need some guidance here.

Thanks.

Dhrumil
  • 3,221
  • 6
  • 21
  • 34
Omer Obaid
  • 416
  • 1
  • 6
  • 24

1 Answers1

0

EDIT: after your comment, I think it is clearer what you are asking.

Take the code to instantiate a NVPeakingEQFilter:

        NVPeakingEQFilter* PEQ = [[NVPeakingEQFilter alloc] initWithSamplingRate:self.samplingRate];
        PEQ.Q = QFactor;
        PEQ.G = gain;
        PEQ.centerFrequency = centerFrequencies;

you need define 3 parameters: Q, G, and centerFrequency. Both Q and centerFrequency are usually fixed (QFactor in my case is a constant equal to 2.0).

So, you have 10 sliders: each one corresponds to a fixed centerFrequency. I suggested iTunes values: 32Hz, 64Hz, 125Hz, 250Hz, 500Hz, 1KHz, 2KHz, 4KHz, 8KHz, 16KHz. You do not want to change those values when the slider value changes.

What you want to change when the slider value changes is the gain (G). At init time, G can be set to 0.0. This means "no amplification/attenuation".

When the slider moves, you change G, so actually you would do:

PEQ[sender.tag - 1].G = sender.value * kNominalGainRange;

where kNominalGainRange is 12.0, so if sender.value goes from -1.0 to +1.0, G goes from -12 to +12.

Hope this helps.

What I want to know is if I am doing this the right way or not ?

you do not show much code, but HPFSliderChanged seems correct. If you have any specific issue you should describe it and post more code.

and the what will be range of the Sliders ?

Actually, there is no rigid rule when it come to equalisers. iTunes goes from -12db to +12db, but you could use different ranges (with the only caveat being distortion).

Like in HPF example, the slider range is 2k to 8k. Need some guidance here.

again, you can take iTunes equaliser as an example (32Hz, 64Hz, 125Hz, 250Hz, 500Hz, 1KHz, 2KHz, 4KHz, 8KHz, 16KHz), or you can google for images of real equalisers and see which bands they use.

sergio
  • 68,819
  • 11
  • 102
  • 123
  • Actually 1) in HPF example he is doing this `_HPF_cornerFrequency = sender.value;. and i am setting centreFrequency. so am i doing correct. 2) I know iTunes goes from -12db to +12db but i dunno what are these values. – Omer Obaid Jul 03 '14 at 08:21
  • Can you explain 2 more thing please. 1) why different players have different frequencies like in iTunes values are 32,64,125 ... 16k Hz and in VLC they are different 16 Hz,170,310 ... 16kHz? 2) and why the G(gain) range is -12 to 12? – Omer Obaid Jul 03 '14 at 11:02
  • no specific reason, I guess tuning things so that they sounds better… but this is subjective… if you allow, e.g., for larger gains, you will easily get some distortion… – sergio Jul 03 '14 at 11:50