audeophilic
Member
I am looking to use the Audio.h library on my Teensy 4.0 for a spectrum analysis project using FFT_1024. I have a non-inverting summing opamp circuit that centers the average of a stereo line audio output (-1.1V to +1.1v) around half an input voltage such that:
...where Vin is the input voltage, and Vsigl/r are the voltages of the left and right channel. Due to the nature of the project and having a Vppk ~2.2v, I intend on using the audio library with a reference voltage of 3.3v, but can't figure out how to set the analog reference voltage to 3.3, as this is the maximum voltage of my circuit. The library sets it to the internal 1.2v reference voltage. I have no intention of rebuilding my circuit, as I've run out of components and I'm stuck inside for a while because... you know.
I have found a few threads, but all of them were from 2018. In one, Paul mentioned that there are plans to include a method of switching the reference voltage, but I can't seem to find anymore information past that. That thread can be found here. I'm very much in the same position as this guy. I understand the reason for a 1.2V reference, but at line-level, this would lead to clipping of the signal and distortion of the FFT result, so I'm banking on finding a way to use a 3.3v reference. Unlike him though, I have tried to change the analogReference(INTERNAL) statement on line 51 of input_adc.cpp, but the preprocessor block it sits in is disabled by the lack of definition of KINETISK. See the picture of Visual Studio yelling at me below.
A bit stuck.
Code:
Vout = (Vin+Vsigl+Vsigr)/2
...where Vin is the input voltage, and Vsigl/r are the voltages of the left and right channel. Due to the nature of the project and having a Vppk ~2.2v, I intend on using the audio library with a reference voltage of 3.3v, but can't figure out how to set the analog reference voltage to 3.3, as this is the maximum voltage of my circuit. The library sets it to the internal 1.2v reference voltage. I have no intention of rebuilding my circuit, as I've run out of components and I'm stuck inside for a while because... you know.
I have found a few threads, but all of them were from 2018. In one, Paul mentioned that there are plans to include a method of switching the reference voltage, but I can't seem to find anymore information past that. That thread can be found here. I'm very much in the same position as this guy. I understand the reason for a 1.2V reference, but at line-level, this would lead to clipping of the signal and distortion of the FFT result, so I'm banking on finding a way to use a 3.3v reference. Unlike him though, I have tried to change the analogReference(INTERNAL) statement on line 51 of input_adc.cpp, but the preprocessor block it sits in is disabled by the lack of definition of KINETISK. See the picture of Visual Studio yelling at me below.
A bit stuck.