Hello I am very new to digital audio software designing, though I've been a producer of electronic music for more than a decade. I'm trying to make a simple 3-band EQ with the Teensy audio shield. So far I am testing out the Linkwitz-Riley filter as I know it is generally what you need to create clean crossovers for audio bands, but when the band frequency is low, the highpassed band sounds heavily distored. Is there any way around this? I'll post my code as is
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioInputI2S i2s1; //xy=229,383
AudioFilterBiquad biquad2; //xy=531,489
AudioFilterBiquad biquad1; //xy=540,315
AudioMixer4 mixer1; //xy=861,288
AudioOutputI2S i2s2; //xy=1332,411
AudioConnection patchCord1(i2s1, 0, biquad1, 0);
AudioConnection patchCord2(i2s1, 0, biquad2, 0);
AudioConnection patchCord3(biquad2, 0, mixer1, 1);
AudioConnection patchCord4(biquad1, 0, mixer1, 0);
AudioConnection patchCord5(mixer1, 0, i2s2, 0);
AudioConnection patchCord6(mixer1, 0, i2s2, 1);
AudioControlSGTL5000 sgtl5000_1; //xy=340,169
// GUItool: end automatically generated code
const int myInput = AUDIO_INPUT_LINEIN;
//const int myInput = AUDIO_INPUT_MIC;
void setup() {
AudioMemory(12);
sgtl5000_1.enable(); // Enable the audio shield
sgtl5000_1.inputSelect(myInput);
sgtl5000_1.volume(0.5);
}
void loop() {
int knob = analogRead(A5);
int knob1 = analogRead(A0);
int knob2 = analogRead(A1);
float F = (float(knob) * 18) + 20;
float lowGain = float(knob1) / 1023;
float highGain = float(knob2) / 1023;
biquad1.setLowpass(0, F, 0.54);
biquad1.setLowpass(1, F, 1.3);
biquad1.setLowpass(2, F, 0.54);
biquad1.setLowpass(3, F, 1.3);
biquad2.setHighpass(0, F, 0.54);
biquad2.setHighpass(1, F, 1.3);
biquad2.setHighpass(2, F, 0.54);
biquad2.setHighpass(3, F, 1.3);
Serial.println(F);
mixer1.gain(0, lowGain);
mixer1.gain(1, highGain);
}