Parametric EQ now works. Perhaps Q has to be changed...

pull/85/head
Holger Wirtz 3 years ago
parent b4145a9e97
commit f0c8095d93
  1. 16
      MicroDexed.ino
  2. 33
      UI.hpp
  3. 28
      config.h
  4. 34
      control_sgtl5000plus.cpp
  5. 16
      control_sgtl5000plus.h

@ -2205,13 +2205,15 @@ void set_fx_params(void)
#endif
#ifdef SGTL5000_AUDIO_ENHANCE
sgtl5000.setEQFc(1, mapfloat(configuration.fx.eq_1, EQ_1_MIN, EQ_1_MAX, -1.0, 1.0));
sgtl5000.setEQFc(2, mapfloat(configuration.fx.eq_2, EQ_2_MIN, EQ_2_MAX, -1.0, 1.0));
sgtl5000.setEQFc(3, mapfloat(configuration.fx.eq_3, EQ_3_MIN, EQ_3_MAX, -1.0, 1.0));
sgtl5000.setEQFc(4, mapfloat(configuration.fx.eq_4, EQ_4_MIN, EQ_4_MAX, -1.0, 1.0));
sgtl5000.setEQFc(5, mapfloat(configuration.fx.eq_5, EQ_5_MIN, EQ_5_MAX, -1.0, 1.0));
sgtl5000.setEQFc(6, mapfloat(configuration.fx.eq_6, EQ_6_MIN, EQ_6_MAX, -1.0, 1.0));
sgtl5000.setEQFc(7, mapfloat(configuration.fx.eq_7, EQ_7_MIN, EQ_7_MAX, -1.0, 1.0));
sgtl5000.setEQGain(1, mapfloat(configuration.fx.eq_1, EQ_1_MIN, EQ_1_MAX, -9.9, 9.9));
sgtl5000.setEQGain(2, mapfloat(configuration.fx.eq_2, EQ_2_MIN, EQ_2_MAX, -9.9, 9.9));
sgtl5000.setEQGain(3, mapfloat(configuration.fx.eq_3, EQ_3_MIN, EQ_3_MAX, -9.9, 9.9));
sgtl5000.setEQGain(4, mapfloat(configuration.fx.eq_4, EQ_4_MIN, EQ_4_MAX, -9.9, 9.9));
sgtl5000.setEQGain(5, mapfloat(configuration.fx.eq_5, EQ_5_MIN, EQ_5_MAX, -9.9, 9.9));
sgtl5000.setEQGain(6, mapfloat(configuration.fx.eq_6, EQ_6_MIN, EQ_6_MAX, -9.9, 9.9));
sgtl5000.setEQGain(7, mapfloat(configuration.fx.eq_7, EQ_7_MIN, EQ_7_MAX, -9.9, 9.9));
for (uint8_t band = 1; band <= 7; band++)
sgtl5000.show_params(band);
#endif
init_MIDI_send_CC();

@ -7708,8 +7708,11 @@ void UI_func_eq_1(uint8_t param)
}
}
lcd_display_meter_float("EQ 50Hz", configuration.fx.eq_1, 0.1, 0.0, EQ_1_MIN, EQ_1_MAX, 1, 1, false, true, true);
sgtl5000.setEQGain(1, mapfloat(configuration.fx.eq_1, EQ_1_MIN, EQ_1_MAX, 0.0, 1.0));
sgtl5000.setEQGain(1, mapfloat(configuration.fx.eq_1, EQ_1_MIN, EQ_1_MAX, -9.9, 9.9));
sgtl5000.commitFilter(1);
#ifdef DEBUG
sgtl5000.show_params(1);
#endif
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -7753,8 +7756,11 @@ void UI_func_eq_2(uint8_t param)
}
}
lcd_display_meter_float("EQ 120Hz", configuration.fx.eq_2, 0.1, 0.0, EQ_2_MIN, EQ_2_MAX, 1, 1, false, true, true);
sgtl5000.setEQGain(2, mapfloat(configuration.fx.eq_2, EQ_2_MIN, EQ_2_MAX, 0.0, 1.0));
sgtl5000.setEQGain(2, mapfloat(configuration.fx.eq_2, EQ_2_MIN, EQ_2_MAX, -9.9, 9.9));
sgtl5000.commitFilter(2);
#ifdef DEBUG
sgtl5000.show_params(2);
#endif
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -7798,8 +7804,11 @@ void UI_func_eq_3(uint8_t param)
}
}
lcd_display_meter_float("EQ 220Hz", configuration.fx.eq_3, 0.1, 0.0, EQ_3_MIN, EQ_3_MAX, 1, 1, false, true, true);
sgtl5000.setEQGain(3, mapfloat(configuration.fx.eq_3, EQ_3_MIN, EQ_3_MAX, 0.0, 1.0));
sgtl5000.setEQGain(3, mapfloat(configuration.fx.eq_3, EQ_3_MIN, EQ_3_MAX, -9.9, 9.9));
sgtl5000.commitFilter(3);
#ifdef DEBUG
sgtl5000.show_params(3);
#endif
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -7843,8 +7852,11 @@ void UI_func_eq_4(uint8_t param)
}
}
lcd_display_meter_float("EQ 1000Hz", configuration.fx.eq_4, 0.1, 0.0, EQ_4_MIN, EQ_4_MAX, 1, 1, false, true, true);
sgtl5000.setEQGain(4, mapfloat(configuration.fx.eq_4, EQ_4_MIN, EQ_4_MAX, 0.0, 1.0));
sgtl5000.setEQGain(4, mapfloat(configuration.fx.eq_4, EQ_4_MIN, EQ_4_MAX, -9.9, 9.9));
sgtl5000.commitFilter(4);
#ifdef DEBUG
sgtl5000.show_params(4);
#endif
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -7888,8 +7900,11 @@ void UI_func_eq_5(uint8_t param)
}
}
lcd_display_meter_float("EQ 2000Hz", configuration.fx.eq_5, 0.1, 0.0, EQ_5_MIN, EQ_5_MAX, 1, 1, false, true, true);
sgtl5000.setEQGain(5, mapfloat(configuration.fx.eq_5, EQ_5_MIN, EQ_5_MAX, 0.0, 1.0));
sgtl5000.setEQGain(5, mapfloat(configuration.fx.eq_5, EQ_5_MIN, EQ_5_MAX, -9.9, 9.9));
sgtl5000.commitFilter(5);
#ifdef DEBUG
sgtl5000.show_params(5);
#endif
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -7933,8 +7948,11 @@ void UI_func_eq_6(uint8_t param)
}
}
lcd_display_meter_float("EQ 7000Hz", configuration.fx.eq_6, 0.1, 0.0, EQ_6_MIN, EQ_6_MAX, 1, 1, false, true, true);
sgtl5000.setEQGain(6, mapfloat(configuration.fx.eq_6, EQ_6_MIN, EQ_6_MAX, 0.0, 1.0));
sgtl5000.setEQGain(6, mapfloat(configuration.fx.eq_6, EQ_6_MIN, EQ_6_MAX, -9.9, 9.9));
sgtl5000.commitFilter(6);
#ifdef DEBUG
sgtl5000.show_params(1);
#endif
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -7980,6 +7998,9 @@ void UI_func_eq_7(uint8_t param)
lcd_display_meter_float("EQ 10000Hz", configuration.fx.eq_7, 0.1, 0.0, EQ_7_MIN, EQ_7_MAX, 1, 1, false, true, true);
sgtl5000.setEQGain(7, mapfloat(configuration.fx.eq_7, EQ_7_MIN, EQ_7_MAX, 0.0, 1.0));
sgtl5000.commitFilter(7);
#ifdef DEBUG
sgtl5000.show_params(7);
#endif
}
if (LCDML.FUNC_close()) // ****** STABLE END *********

@ -602,32 +602,32 @@
#define VOICECONFIG_NUM_MAX MAX_VOICECONFIG
#define VOICECONFIG_NUM_DEFAULT -1
#define EQ_1_MIN -10
#define EQ_1_MAX 10
#define EQ_1_MIN -99
#define EQ_1_MAX 99
#define EQ_1_DEFAULT 0
#define EQ_2_MIN -10
#define EQ_2_MAX 10
#define EQ_2_MIN -99
#define EQ_2_MAX 99
#define EQ_2_DEFAULT 0
#define EQ_3_MIN -10
#define EQ_3_MAX 10
#define EQ_3_MIN -99
#define EQ_3_MAX 99
#define EQ_3_DEFAULT 0
#define EQ_4_MIN -10
#define EQ_4_MAX 10
#define EQ_4_MIN -99
#define EQ_4_MAX 99
#define EQ_4_DEFAULT 0
#define EQ_5_MIN -10
#define EQ_5_MAX 10
#define EQ_5_MIN -99
#define EQ_5_MAX 99
#define EQ_5_DEFAULT 0
#define EQ_6_MIN -10
#define EQ_6_MAX 10
#define EQ_6_MIN -99
#define EQ_6_MAX 99
#define EQ65_DEFAULT 0
#define EQ_7_MIN -10
#define EQ_7_MAX 10
#define EQ_7_MIN -99
#define EQ_7_MAX 99
#define EQ_7_DEFAULT 0
// Buffer for load/save configuration as JSON

@ -28,8 +28,8 @@
void AudioControlSGTL5000Plus::init_parametric_eq(void)
{
eqSelect(PARAMETRIC_EQUALIZER);
eqFilterCount(num_bands);
//eqSelect(PARAMETRIC_EQUALIZER);
//eqFilterCount(num_bands);
filter_type = new uint8_t[num_bands];
Fc = new float[num_bands];
@ -40,6 +40,7 @@ void AudioControlSGTL5000Plus::init_parametric_eq(void)
setEQFc(1, EQ_CENTER_FRQ_0);
setEQQ(1, EQ_Q_0);
setEQGain(1, 0.0);
commitFilter(1);
if (num_bands > 1)
{
@ -47,7 +48,7 @@ void AudioControlSGTL5000Plus::init_parametric_eq(void)
setEQFc(2, EQ_CENTER_FRQ_1);
setEQQ(2, EQ_Q_1);
setEQGain(2, 0.0);
commitFilter(7);
commitFilter(2);
}
if (num_bands > 2)
@ -56,7 +57,7 @@ void AudioControlSGTL5000Plus::init_parametric_eq(void)
setEQFc(3, EQ_CENTER_FRQ_2);
setEQQ(3, EQ_Q_2);
setEQGain(3, 0.0);
commitFilter(7);
commitFilter(3);
}
if (num_bands > 3)
@ -65,7 +66,7 @@ void AudioControlSGTL5000Plus::init_parametric_eq(void)
setEQFc(4, EQ_CENTER_FRQ_3);
setEQQ(4, EQ_Q_3);
setEQGain(4, 0.0);
commitFilter(7);
commitFilter(4);
}
if (num_bands > 4)
@ -74,7 +75,7 @@ void AudioControlSGTL5000Plus::init_parametric_eq(void)
setEQFc(5, EQ_CENTER_FRQ_4);
setEQQ(5, EQ_Q_4);
setEQGain(5, 0.0);
commitFilter(7);
commitFilter(5);
}
if (num_bands > 5)
@ -83,7 +84,7 @@ void AudioControlSGTL5000Plus::init_parametric_eq(void)
setEQFc(6, EQ_CENTER_FRQ_5);
setEQQ(6, EQ_Q_5);
setEQGain(6, 0.0);
commitFilter(7);
commitFilter(6);
}
if (num_bands > 6)
@ -138,6 +139,21 @@ void AudioControlSGTL5000Plus::commitFilter(uint8_t band)
band = constrain(band, 1, num_bands);
calcBiquad(filter_type[band - 1], Fc[band - 1], peakGainDB[band - 1], Q[band - 1], 524288, AUDIO_SAMPLE_RATE, filter);
//eqFilter(band, filter);
calcBiquad(filter_type[band - 1], Fc[band - 1], peakGainDB[band - 1], Q[band - 1], 0x80000, AUDIO_SAMPLE_RATE, filter);
eqFilter(band, filter);
}
void AudioControlSGTL5000Plus::show_params(uint8_t band)
{
Serial.print(F("Band: "));
Serial.print(band, DEC);
Serial.print(F(" Type:"));
Serial.print(filter_type[band - 1], DEC);
Serial.print(F(" Fc:"));
Serial.print(Fc[band - 1], 1);
Serial.print(F(" Q:"));
Serial.print(Q[band - 1], 1);
Serial.print(F(" peakGainDB:"));
Serial.print(peakGainDB[band - 1], 1);
Serial.println();
}

@ -30,31 +30,31 @@
#define EQ_TYPE_0 FILTER_PARAEQ
#define EQ_CENTER_FRQ_0 50.0
#define EQ_Q_0 1.0
#define EQ_Q_0 0.5
#define EQ_TYPE_1 FILTER_PARAEQ
#define EQ_CENTER_FRQ_1 120.0
#define EQ_Q_1 1.0
#define EQ_Q_1 0.5
#define EQ_TYPE_2 FILTER_PARAEQ
#define EQ_CENTER_FRQ_2 220.0
#define EQ_Q_2 1.0
#define EQ_Q_2 0.5
#define EQ_TYPE_3 FILTER_PARAEQ
#define EQ_CENTER_FRQ_3 1000.0
#define EQ_Q_3 1.0
#define EQ_Q_3 0.5
#define EQ_TYPE_4 FILTER_PARAEQ
#define EQ_CENTER_FRQ_4 2000.0
#define EQ_Q_4 1.0
#define EQ_Q_4 0.5
#define EQ_TYPE_5 FILTER_PARAEQ
#define EQ_CENTER_FRQ_5 7000.0
#define EQ_Q_5 1.0
#define EQ_Q_5 0.5
#define EQ_TYPE_6 FILTER_PARAEQ
#define EQ_CENTER_FRQ_6 10000.0
#define EQ_Q_6 1.0
#define EQ_Q_6 0.5
class AudioControlSGTL5000Plus : public AudioControlSGTL5000
{
@ -68,11 +68,11 @@ class AudioControlSGTL5000Plus : public AudioControlSGTL5000
void setEQQ(uint8_t band, float q);
void setEQGain(uint8_t band, float gain);
void commitFilter(uint8_t band);
void show_params(uint8_t band);
private:
void init_parametric_eq(void);
uint8_t num_bands;
int* filter_coeff;
uint8_t* filter_type;
float* Fc;
float* Q;

Loading…
Cancel
Save