First let me say I'm new to all this - Teensy and Arduino - so I apologize in advance for any noob errors. But I have been learning a lot from Rich Heslip's excellent work on the Teensy SDR and am blown away by the capabilities of the Teensy Audio Library. One doesn't have to to be a Rembrandt in order to appreciate good art, and I know enough about DSP to know that Paul has created something outstanding here.
My problem is getting a usable amount of audio from the Audio Board with the standard code that Rich developed. Hopefully I've provided the relevant snippets below as the code is set to use hardware AGC and this is the starting point for my troubleshooting.
INITIAL_VOLUME was set to 0.8, but even after I increased it to 1.0 the output is very low (to the point where sound is barely audible with a powered speaker held right to my ear). Of course there are other gains in previous sections of the code that may be responsible, but I thought it made sense to start working backward from the output. I've used example programs such a ToneSweep to prove that the audio board is capable of driving my powered speaker to very loud levels, so it's got to be in the app software somewhere. I'd appreciate pointers to where I can learn more about autoVolumeControl as the comments reproduced below seem to be abbreviated and I haven't found the right place in the library to look for more. What I see, this looks OK except I con't know what the last 3 parameters do. With the initial setting were "wide open", I would expect the audio to blast (like the examples) and then gradually reduce in response to AGC, but audio starts out nearly inaudible and stays that way. I know the software is basically working because I can hear correct audio at a very low level and unfortunately I don't yet have the knowledge to identify potential causes on my own.
A couple more noob questions, if I may:
1. Am I correct that the headphone jack and line outputs get the same signals but headphone audio can be independently controlled? (Right now I hear very weak audio thru line out but nothing at all thru the headphone jack). I'd disable that VOL function if I knew how.
2. Richs's original hardware used a pot connected to the VOL input on the Audio board. I prefer not to have it but have wired it up and can vary the voltage at the VOL pin from 0 to 3.3 but it has no effect on either Line or headphone volume.
If I could get the audio volume from the SDR app close to what I hear with the examples, I'd be happy!
Thanks,
Bob W9RAN
#define INITIAL_VOLUME 1.0 // 0-1.0 output volume on startup
<snip>
AudioConnection c40(Audioselector_I, 0, AGCpeak, 0); // AGC Gain loop measure
AudioConnection c41(Audioselector_I, 0, audioOutput, 0); // Output the sum on both channels
AudioConnection c42(Audioselector_Q, 0, audioOutput, 1);
<snip>
// Enable the audio shield and set the output volume.
audioShield.enable();
audioShield.volume(INITIAL_VOLUME);
audioShield.unmuteLineout();
#ifdef DEBUG
Serial.println("audio shield enabled");
#endif
#ifdef HW_AGC
/* COMMENTS FROM Teensy Audio library:
Valid values for dap_avc parameters
maxGain; Maximum gain that can be applied
0 - 0 dB
1 - 6.0 dB
2 - 12 dB
lbiResponse; Integrator Response
0 - 0 mS
1 - 25 mS
2 - 50 mS
3 - 100 mS
hardLimit
0 - Hard limit disabled. AVC Compressor/Expander enabled.
1 - Hard limit enabled. The signal is limited to the programmed threshold (signal saturates at the threshold)
threshold
floating point in range 0 to -96 dB
attack
floating point figure is dB/s rate at which gain is increased
decay
floating point figure is dB/s rate at which gain is reduced
*/
audioShield.autoVolumeControl(2,1,0,-30,3,20); // see comments above
audioShield.autoVolumeEnable();
#endif
My problem is getting a usable amount of audio from the Audio Board with the standard code that Rich developed. Hopefully I've provided the relevant snippets below as the code is set to use hardware AGC and this is the starting point for my troubleshooting.
INITIAL_VOLUME was set to 0.8, but even after I increased it to 1.0 the output is very low (to the point where sound is barely audible with a powered speaker held right to my ear). Of course there are other gains in previous sections of the code that may be responsible, but I thought it made sense to start working backward from the output. I've used example programs such a ToneSweep to prove that the audio board is capable of driving my powered speaker to very loud levels, so it's got to be in the app software somewhere. I'd appreciate pointers to where I can learn more about autoVolumeControl as the comments reproduced below seem to be abbreviated and I haven't found the right place in the library to look for more. What I see, this looks OK except I con't know what the last 3 parameters do. With the initial setting were "wide open", I would expect the audio to blast (like the examples) and then gradually reduce in response to AGC, but audio starts out nearly inaudible and stays that way. I know the software is basically working because I can hear correct audio at a very low level and unfortunately I don't yet have the knowledge to identify potential causes on my own.
A couple more noob questions, if I may:
1. Am I correct that the headphone jack and line outputs get the same signals but headphone audio can be independently controlled? (Right now I hear very weak audio thru line out but nothing at all thru the headphone jack). I'd disable that VOL function if I knew how.
2. Richs's original hardware used a pot connected to the VOL input on the Audio board. I prefer not to have it but have wired it up and can vary the voltage at the VOL pin from 0 to 3.3 but it has no effect on either Line or headphone volume.
If I could get the audio volume from the SDR app close to what I hear with the examples, I'd be happy!
Thanks,
Bob W9RAN
#define INITIAL_VOLUME 1.0 // 0-1.0 output volume on startup
<snip>
AudioConnection c40(Audioselector_I, 0, AGCpeak, 0); // AGC Gain loop measure
AudioConnection c41(Audioselector_I, 0, audioOutput, 0); // Output the sum on both channels
AudioConnection c42(Audioselector_Q, 0, audioOutput, 1);
<snip>
// Enable the audio shield and set the output volume.
audioShield.enable();
audioShield.volume(INITIAL_VOLUME);
audioShield.unmuteLineout();
#ifdef DEBUG
Serial.println("audio shield enabled");
#endif
#ifdef HW_AGC
/* COMMENTS FROM Teensy Audio library:
Valid values for dap_avc parameters
maxGain; Maximum gain that can be applied
0 - 0 dB
1 - 6.0 dB
2 - 12 dB
lbiResponse; Integrator Response
0 - 0 mS
1 - 25 mS
2 - 50 mS
3 - 100 mS
hardLimit
0 - Hard limit disabled. AVC Compressor/Expander enabled.
1 - Hard limit enabled. The signal is limited to the programmed threshold (signal saturates at the threshold)
threshold
floating point in range 0 to -96 dB
attack
floating point figure is dB/s rate at which gain is increased
decay
floating point figure is dB/s rate at which gain is reduced
*/
audioShield.autoVolumeControl(2,1,0,-30,3,20); // see comments above
audioShield.autoVolumeEnable();
#endif