Controlling the line-out volume

Status
Not open for further replies.

Frederc Segard

New member
Hello,

Is there any way to control the line-out volume on the Teensy Audio Board? When I do the following code, it works with the headphone output, but not the line-out.

Code:
float vol = analogRead(15);
AudioControl.volume(vol);

Thanks in advance,

Fred
 
Use the "amp" component, it's next to the mixer in the GUI. Scale your ADC reading to the range of 0~1.0, and then call amp1.gain(vol).
 
... and donj't forget you can set the line-in and line_out gains by setting the voltage range on the SGTL5000 in 1.5 dB steps for example:
Code:
  codec.lineInLevel(15);             // Set codec input voltage level to most sensitive
  codec.lineOutLevel(13);            // Set codec output voltage level to most sensitive
 
You also need to unmute the lineout first.
Code:
  sgtl5000_1.unmuteLineout();
  // According to info in libraries\Audio\control_sgtl5000.cpp
  // 31 is LOWEST output of 1.16V and 13 is HIGHEST output of 3.16V
  sgtl5000_1.lineOutLevel(15);

Pete
 
I've never done that on any of my projects. For example in my SDR project, here is the SGTL5000 initialization code
Code:
  AudioNoInterrupts();
  codec.inputSelect(AUDIO_INPUT_LINEIN);
  codec.volume(0.7);
  codec.lineInLevel(15);             // Set codec input voltage level to most sensitive
  codec.lineOutLevel(13);            // Set codec output voltage level to most sensitive
  codec.enable();
  AudioInterrupts();
  delay(500);
and then I use lineInLevel directly integrated into my RF gain scheduler without problem.
 
Status
Not open for further replies.
Back
Top