AudioAnalyzePeak::read()=1.0 ... means?

Status
Not open for further replies.

G0OER

New member
Hi everyone! (my first post)

I'm teaching myself some DSP by building the original Rich Heslip Teensy_SDR by incremental degrees. (See https://github.com/rheslip/Teensy_SDR). He notes in the code that his AGC.cpp code is "probably broken with the new audio library", and while it compiles for me, the best I can get it to do leads to a crash (solid tone out of the audio board) after a few minutes of listening. I have had to comment out the AGC part of the code, as that locks up the Teensy entirely, so for now I am currently just trying to get the S-meter code to work. In evaluating Rich's code, I'm trying to work out why it's broken. I suspect that something might be leading to excessive values being fed into the variables -- although there doesn't seem to be much in the way of distortion products in the output.

HARDWARE: Teensy 4.0 + Audio Board (for the Teensy 4.0)

One key thing is relating the result of calling AudioAnalysePeak::read() to what's happening with the signal when it goes into LINE-IN -- reading both Paul's library code and the SGTL5000 datasheet suggests that when the return value of the function reaches the maximum value of 1.0, that corresponds to a 1v RMS input signal at the analog LINE-IN port. (Assuming the pre-ADC analog gain is set to 0dB).

Am I right?

Thanks for any help.
Paul Roberts, G0OER.
 
Well, there's nothing like answering your own question. After connecting a signal generator and scope to my Teensy 4.0 audio board and testing the values, and looking at the code for AudioAnalyzePeak.read(), here's the answer.

a) The float value of AudioAnalyzePeak.read() varies from 0 to 1.0, in 1/32767 increments.

b) A value of 1.0 corresponds to a LineIn value of 1.33v pk-pk on the Teensy Audio Board *assuming the audio path has not been boosted or attenuated by the SGTL5000 hardware*. (For example, using AudioControlSGTL5000.lineInLevel(x) will adjust the 1.0 to correspond to another level from 1.33v pk-pk - the default, according to the table in that section of the AudioControlSGTL5000 object documentation in the design tool).

So if anyone is looking for the answer at some point in the future, I hope this helps. And if any of the Senior Members correct me, I'm happy to retract.
 
Status
Not open for further replies.
Back
Top