Teensy 4.0 + Audio Shield - beginner help.

Status
Not open for further replies.
Hi everyone, and Happy New Year to all.
Im using a Teensy 4.0 with an Audio shield Rev B.
I have it all connected (the correct way) and it's working perfectly. I've tested it with various examples and all is working well.
I am an absolute beginner with this and I've spent the last 2 days trying to find info on how to actually implement the built-in 5-band graphic eq using the SGTL5000.
All the online resources I've been able to find hasn't really helped me much, except to confuse me more.
All I am trying to achieve is have a graphic eq between line in and line out, using the audio shield.
I originally wanted to use the 7-band PEQ, but after reading the documentation, I was completely scared off by having to calculate coefficients etc..
So I decided to try using the 5-band graphic instead. Could anyone please help me with with this.
All I would need is for someone to just show me how to adjust one of the 5 bands up / down, the rest I can work out for myself.

This is where Im at so far:

#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>


const int myInput = AUDIO_INPUT_LINEIN;
AudioInputI2S i2s1; //xy=155,209
AudioOutputI2S i2s2; //xy=750,216
AudioConnection patchCord1(i2s1, 0, i2s2, 0);
AudioConnection patchCord2(i2s1, 1, i2s2, 1);
AudioControlSGTL5000 sgtl5000_1; //xy=482,53

void setup() {
AudioMemory(4);
sgtl5000_1.enable();
sgtl5000_1.inputSelect(myInput);
sgtl5000_1.volume(0.5);
sgtl5000_1.audioPostProcessorEnable();
sgtl5000_1.eqSelect(3);
sgtl5000_1.eqBands(1, 2, 3, 4, 5);
sgtl5000_1.eqBand(1, -0.50);
sgtl5000_1.eqBand(2, -0.30);
sgtl5000_1.eqBand(3, 0.50);
sgtl5000_1.eqBand(4, 0.60);
sgtl5000_1.eqBand(5, 0.80);
}

I actually don't know what to put in the loop, coz all I want to do, is do a "once off" eq adjustment (to start with anyway).
Sorry if this post seems a tad silly, but I really don't have a clue with this.
Any help will be appreciated.
Thanks so much.
 
Hi,
The five values you pass to sgtl5000_1.eqBands must all be between -1.0 and 1.0. You can set all five gains using that command - or you have the option of using sgtl5000_1.eqBand to change any one.

You could leave loop() empty for this test.

Have you soldered a connector to the line in input on the audio shield, and do you have a sound source connected to it? What are you hearing at the output?

All the best,

Alan
 
Hi AlanK.
Thank you for your help.
I have soldered rca's to the line in connections and using headphone output of my laptop (1/8" mini h/p jack to rca) as the source.
It seems the code I had is actually working. I just couldn't hear the difference when using values so close together (0.50, 0.60 etc...)
When I did an A/B test using significant differences (1.0 & -1.0) that's when I realised the code is actually working.
So it seems like I never actually had any problem - except for listening properly!!
My initial idea was to try implement an adjustable PEQ, using a LCD and a press-rotary encoder that would allow me to select frequencies & adjust attenuation.
I found a spread-sheet explaining how to calculate the coefficients, but I have no clue what code to use or how to actually implement it.
Link: https://www91.zippyshare.com/v/vQkOM0KI/file.html
Link: https://www91.zippyshare.com/v/5nkuTjio/file.html
Am I correct in thinking that the coding to do this is way too difficult for a beginner like me?
Do you by any chance know how to implement the 7-band PEQ?
Thanks again for your help.
 
Last edited:
Status
Not open for further replies.
Back
Top