Hey all. I'm using a teensy 4.1 on a custom PCB with the audio shield replicated on it, and I'm facing an issue where I'm sometimes getting little to no signal on the SGTL5000's line-output, which I have hooked up to my audio interface.
When I upload the PlaySynthMusic example sketch that comes with the Audio library, the line-out and the headphone out both work fine. However, when I upload my own code, the headphone output works fine, but I'm getting only a very small signal on line-out(checked it with scope) which is not really useable. What's weird is that in my code, I setup and enable the codec in the exact same way as the example sketch, yet, for some reason, the line output just doesn't work.
So I know it's some issue with the code and not the hardware, but I haven't been able to track it down. I even tried explicitly setting lineOutLevel and unmuteLineout to no effect. Does anyone know what might be causing this? I'm stumped.
I've attached my entire code as a zip, but the following are the only places where I address the codec directly in my code:
View attachment 1_CombinedSystem.zip
When I upload the PlaySynthMusic example sketch that comes with the Audio library, the line-out and the headphone out both work fine. However, when I upload my own code, the headphone output works fine, but I'm getting only a very small signal on line-out(checked it with scope) which is not really useable. What's weird is that in my code, I setup and enable the codec in the exact same way as the example sketch, yet, for some reason, the line output just doesn't work.
So I know it's some issue with the code and not the hardware, but I haven't been able to track it down. I even tried explicitly setting lineOutLevel and unmuteLineout to no effect. Does anyone know what might be causing this? I'm stumped.
I've attached my entire code as a zip, but the following are the only places where I address the codec directly in my code:
Code:
//audio network
AudioControlSGTL5000 codec;
void setup() {
codec.enable();
codec.volume(0.45);
//other stuff
}
void loop() {
int n = analogRead(15);
if (n != vol) {
vol = n;
codec.volume((float)n / 1023);
}
//other stuff
}
View attachment 1_CombinedSystem.zip