Using the Teensy audio board as an effects loop bug

Status
Not open for further replies.

cfredisded

Active member
I've been working on a project using the Teensy 4.0 and its audio board as an effects loops. I've recently run into a problem and spent the last week ruling out possible issues and boiled it down to what seems to be a bug in the audio library?

Here's an example of how the effects loop would work.
effect loop explanation.jpg
Right channel would be a dry signal and left channel would be the effected signal and then you can mix different amounts of each. It was working fine until i noticed there was still some dry signal coming through when it should be 100% wet. So I plugged it in like this
effect loop explanation2.jpg
and only plugged in the right input and right output and noticed that even when there shouldn't be any signal on the right output there still is.


Here's the simplest sketch that reproduces this issue. It seems to happen with both the mixer library module and amp module, and i would be using the mixer module.

Library Module Setup 1
mixSetup2.png
Sketch 1
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

// GUItool: begin automatically generated code
AudioInputI2S            i2s1;           //xy=431,321
AudioAmplifier           amp1;           //xy=613,312
AudioAmplifier           amp2;           //xy=613,348
AudioOutputI2S           i2s2;           //xy=787,325
AudioConnection          patchCord1(i2s1, 0, amp1, 0);
AudioConnection          patchCord2(i2s1, 1, amp2, 0);
AudioConnection          patchCord3(amp1, 0, i2s2, 1);
AudioConnection          patchCord4(amp2, 0, i2s2, 0);
AudioControlSGTL5000     sgtl5000_1;     //xy=433,256
// GUItool: end automatically generated code

const int myInput = AUDIO_INPUT_LINEIN;

void setup() {
  // put your setup code here, to run once:
   AudioMemory(250);
  sgtl5000_1.enable();
  sgtl5000_1.inputSelect(myInput);
  sgtl5000_1.volume(1);
  //sgtl5000_1.adcHighPassFilterDisable(); 
}

void loop() {
  // put your main code here, to run repeatedly:
  amp1.gain(1); //changing either of these to .gain(0); and there is no signal at right output
  amp2.gain(1);
}
There shouldn't be any audio getting to the right output but there still is a very quite but present signal if the amp.gains are set to 1? Changing either amp.gain to 0 and there is no more signal.


Library Module Setup 2
mixSetup1.png
Sketch 2
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

// GUItool: begin automatically generated code
AudioInputI2S            i2s1;           //xy=430,313
AudioMixer4              mixer2;         //xy=613,273
AudioMixer4              mixer1;         //xy=615,366
AudioOutputI2S           i2s2;           //xy=782,311
AudioConnection          patchCord1(i2s1, 0, mixer1, 0);
AudioConnection          patchCord2(i2s1, 0, mixer2, 0);
AudioConnection          patchCord3(i2s1, 1, mixer1, 1);
AudioConnection          patchCord4(i2s1, 1, mixer2, 1);
AudioConnection          patchCord5(mixer2, 0, i2s2, 0);
AudioConnection          patchCord6(mixer1, 0, i2s2, 1);
AudioControlSGTL5000     sgtl5000_1;     //xy=433,256
// GUItool: end automatically generated code


const int myInput = AUDIO_INPUT_LINEIN;

void setup() {
  // put your setup code here, to run once:
   AudioMemory(250);
  sgtl5000_1.enable();
  sgtl5000_1.inputSelect(myInput);
  sgtl5000_1.volume(1);
  //sgtl5000_1.adcHighPassFilterDisable(); 
}

void loop() {
  // put your main code here, to run repeatedly:
  mixer1.gain(0,1); // left chann to right (audio shouldnt come through when this is set to 1)
  mixer1.gain(1,0); // right chann to right
  mixer2.gain(0,0); // left chann to left
  mixer2.gain(1,1); // right chann to left (audio shouldnt come through when this is set to 1)
}
Any help with this would be greatly appreciated. It would also help if someone can reproduce this just so I 100% no its not just something strange on my end. Thanks
 
This should probably be move to the 'Suggestions and Bug reports' section. I wasn't sure at first.
So I tested this on teensy 3.2 and teensy 3.6 and they also have this issue. Here is an even more simplified example.
mixSetup3.png
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

// GUItool: begin automatically generated code
AudioInputI2S            i2s1;           //xy=307,199
AudioOutputI2S           i2s2;           //xy=492,201
AudioConnection          patchCord1(i2s1, 0, i2s2, 1);
AudioConnection          patchCord2(i2s1, 1, i2s2, 0);
AudioControlSGTL5000     sgtl5000_1;     //xy=305,141
// GUItool: end automatically generated code

  const int myInput = AUDIO_INPUT_LINEIN;

void setup() {
  // put your setup code here, to run once:
   AudioMemory(50);
  sgtl5000_1.enable();
  sgtl5000_1.inputSelect(myInput);
  sgtl5000_1.volume(1);
  //sgtl5000_1.adcHighPassFilterDisable(); 
}

void loop() {
  // put your main code here, to run repeatedly:

}

Sound from the right input is still getting to the right output somehow.


Is this just limitations of the sgtl5000 or could this be a software bug? Any incite greatly appreciated. Cheers


EDIT!
I just found out that adding
Code:
sgtl5000_1.muteHeadphone();
in the setup fixes this issue. Weird.
 
Last edited:
Channel crosstalk.
This is due to the low quality of the SGTL5000 and the board layout pushed it even lower.
If you really need pro audio, use something else.
Almost every CODEC is better than that.
What is your budget?
Depending on budget we find something for you.
 
Channel crosstalk.
This is due to the low quality of the SGTL5000 and the board layout pushed it even lower.
If you really need pro audio, use something else.
Almost every CODEC is better than that.
What is your budget?
Depending on budget we find something for you.

What better Codecs someone could possibly solder manually (DIP or SOIC) are feasible?
 
In the same price-range you can use a combination of PCM1808 (ADC) / PCM1502 (DAC). Both are available as inexpensive breakout-boards and therefore (almost) as easy to use as the audio shield.
They are not "high-end", but very ok, and I had good results. For non-professional "home usage", great.There is little bit more to solder, however.
 
The SGTL5000 is designed for use in a cheap mobile phone - the inputs in particular are lowish quality, and the headphone
amp is a high current circuit that is probably imposing ground currents internally to the chip, which is probably why disabling
it wins much better crosstalk performance. The lineout DACs are the best performing part of the chip from the datasheet
specs.

If you want high performance you don't pick a chip whose principal selling point is low power consumption targetted at
mobile devices. However its reasonable as lineout only, which is what many people use it for (synths etc), and is a
single chip solution (otherwise you'd need separate ADC and DAC chips).
 
In the same price-range you can use a combination of PCM1808 (ADC) / PCM1502 (DAC). Both are available as inexpensive breakout-boards and therefore (almost) as easy to use as the audio shield.
They are not "high-end", but very ok, and I had good results. For non-professional "home usage", great.There is little bit more to solder, however.

Thanks for that hint - TSSOP looks somehow solderable by hand so one can avoid Breakout Boards. So i use them simply with the i2s Output Module form the Audio System? Just like the PT8211??
 
Thanks for that hint - TSSOP looks somehow solderable by hand so one can avoid Breakout Boards. So i use them simply with the i2s Output Module form the Audio System? Just like the PT8211??

You might also want to take a look at the TGA Pro Audio Board. I specifically designed it for handling both line-level or guitar signals and helping out people who don't want to deal with a lot of difficult surface mount soldering. The components and PCB layout are specifically designed for low noise. The schematic is free and public if you want to try to build your own.
 
Status
Not open for further replies.
Back
Top