im building a tool for some musician friends of mine and i wanted to create an equalizer like spotify has.
But i cant put the Band Gain of the equalizer Every digital equalizer i've seen so far was able to put the Gain below 0.
I also can't really find a properly article about the ranges of the Audioeffect properties in general :/
Hopefully some of you guys can help me out.
Edit: The Code where the EqualizerEffectDefinition is used:
After the init of the AudioGraph i init the eq
this.equalizerLowFreq = new EqualizerEffectDefinition(this.audioGraph);
this.equalizerMidFreq = new EqualizerEffectDefinition(this.audioGraph);
this.equalizerHighFreq = new EqualizerEffectDefinition(this.audioGraph);
i use 3 EqualizerEffectDefinitions because 1 only holds 4 Bands.
Right after init the deviceOutputNode i add and enable them
this.deviceOutputNode.EffectDefinitions.Add(this.equalizerLowFreq);
this.deviceOutputNode.EffectDefinitions.Add(this.equalizerMidFreq);
this.deviceOutputNode.EffectDefinitions.Add(this.equalizerHighFreq);
this.deviceOutputNode.EnableEffectsByDefinition(this.equalizerLowFreq);
this.deviceOutputNode.EnableEffectsByDefinition(this.equalizerMidFreq);
this.deviceOutputNode.EnableEffectsByDefinition(this.equalizerHighFreq);
And here i wanna choose between predefined EQs and a custom one
private void chooseEQ(string EQ)
{
// switch back old EQ button
switch (this.localSettings.Values["selected EQ"].ToString())
{
case "Normal":
EQNormal.IsChecked = false;
break;
case "Pop":
EQPop.IsChecked = false;
break;
case "Classic":
EQClassic.IsChecked = false;
break;
case "Jazz":
EQJazz.IsChecked = false;
break;
case "Rock":
EQRock.IsChecked = false;
break;
case "Party":
EQParty.IsChecked = false;
break;
case "Custom":
EQCustom.IsChecked = false;
break;
}
// set EQ
switch (EQ)
{
case "Normal":
//this.setEQBands(0, 0, 0, 0, 0, 0, 0, 0, 0, false); <- Gain = 0 gives error
this.setEQBands(1, 1, 1, 1, 1, 1, 1, 1, 1, false);
this.localSettings.Values["selected EQ"] = "Normal";
EQNormal.IsChecked = true;
break;
case "Pop":
this.setEQBands(0, 0, 0, 2, 3, -2, -4, -4, -4, false);
this.localSettings.Values["selected EQ"] = "Pop";
EQPop.IsChecked = true;
break;
case "Classic":
this.setEQBands(0, 0, -6, 0, 1, 0, 6, 6, 6, false);
this.localSettings.Values["selected EQ"] = "Classic";
EQClassic.IsChecked = true;
break;
case "Jazz":
this.setEQBands(0, 0, 5, -5, -2, 2, -1, -1, -1, false);
this.localSettings.Values["selected EQ"] = "Jazz";
EQJazz.IsChecked = true;
break;
case "Rock":
this.setEQBands(0, 0, 3, -9, -2, 3, 3, 3, 3, false);
this.localSettings.Values["selected EQ"] = "Rock";
EQRock.IsChecked = true;
break;
case "Party":
this.setEQBands(8, 6, 3, 0, -3, -1, 1, 5, 9, false);
this.localSettings.Values["selected EQ"] = "Party";
EQParty.IsChecked = true;
break;
case "Custom":
this.setEQBands(0, 0, 0, 0, 0, 0, 0, 0, 0, true);
this.localSettings.Values["selected EQ"] = "Custom";
EQCustom.IsChecked = true;
break;
}
}
private void setEQBands(int low1, int low2, int low3, int mid1, int mid2, int mid3, int high1, int high2, int high3, bool isCustomEQ)
{
if (isCustomEQ)
{
this.equalizerLowFreq.Bands[0].Gain = this.customEQ63HzGain;
EQ63HzSlider.Value = this.customEQ63HzGain;
this.equalizerLowFreq.Bands[1].Gain = this.customEQ125HzGain;
EQ125HzSlider.Value = this.customEQ125HzGain;
this.equalizerLowFreq.Bands[2].Gain = this.customEQ250HzGain;
EQ250HzSlider.Value = this.customEQ250HzGain;
this.equalizerMidFreq.Bands[0].Gain = this.customEQ500HzGain;
EQ500HzSlider.Value = this.customEQ500HzGain;
this.equalizerMidFreq.Bands[1].Gain = this.customEQ1kHzGain;
EQ1kHzSlider.Value = this.customEQ500HzGain;
this.equalizerMidFreq.Bands[2].Gain = this.customEQ2kHzGain;
EQ2kHzSlider.Value = this.customEQ500HzGain;
this.equalizerHighFreq.Bands[0].Gain = this.customEQ4kHzGain;
EQ4kHzSlider.Value = this.customEQ500HzGain;
this.equalizerHighFreq.Bands[1].Gain = this.customEQ8kHzGain;
EQ8kHzSlider.Value = this.customEQ500HzGain;
this.equalizerHighFreq.Bands[2].Gain = this.customEQ16kHzGain;
EQ16kHzSlider.Value = this.customEQ500HzGain;
}
else
{
this.equalizerLowFreq.Bands[0].Gain = low1;
EQ63HzSlider.Value = low1;
this.equalizerLowFreq.Bands[1].Gain = low2;
EQ125HzSlider.Value = low2;
this.equalizerLowFreq.Bands[2].Gain = low3;
EQ250HzSlider.Value = low3;
this.equalizerMidFreq.Bands[0].Gain = mid1;
EQ500HzSlider.Value = mid1;
this.equalizerMidFreq.Bands[1].Gain = mid2;
EQ1kHzSlider.Value = mid2;
this.equalizerMidFreq.Bands[2].Gain = mid3;
EQ2kHzSlider.Value = mid3;
this.equalizerHighFreq.Bands[0].Gain = high1;
EQ4kHzSlider.Value = high1;
this.equalizerHighFreq.Bands[1].Gain = high2;
EQ8kHzSlider.Value = high2;
this.equalizerHighFreq.Bands[2].Gain = high3;
EQ16kHzSlider.Value = high3;
}
}