Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: Teensy 4.0 + Audio Shield - beginner help.

  1. #1
    Junior Member
    Join Date
    Feb 2020

    Teensy 4.0 + Audio Shield - beginner help.

    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() {
    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.

  2. #2
    Join Date
    Feb 2020
    Dublin, Ireland
    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,


  3. #3
    Junior Member
    Join Date
    Feb 2020
    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.
    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 by CrazyCraig; 01-06-2021 at 03:49 PM.

  4. #4
    Join Date
    Feb 2020
    Dublin, Ireland
    You should be able to use the calcBiquad function here:
    Audio/control_sgtl5000.h at master PaulStoffregen/Audio GitHub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts