Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: Controlling the line-out volume

  1. #1
    Junior Member Frederc Segard's Avatar
    Join Date
    Jul 2019
    Location
    Montreal, QC, Canada
    Posts
    1

    Controlling the line-out volume

    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

  2. #2
    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).

  3. #3
    Senior Member
    Join Date
    May 2016
    Posts
    137
    ... 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

  4. #4
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,134
    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

  5. #5
    Senior Member
    Join Date
    May 2016
    Posts
    137
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •