Is there a solution for the volume noise issue with SGTL5000 USB audio?

heyjin

New member
I am working on creating a USB audio device using the Teensy 3.2 board and the Rev C Audio Shield. When coding it similar to a simple sample example, it is recognized well and the sound is audible. However, whenever I adjust the volume on the computer, I hear a very small, subtle ticking noise. It is more noticeable when the volume is set around 100%, and as the volume decreases, the noise becomes quieter along with the sound. However, when the volume is set to 0%, there is a noticeable ticking noise that can be considered significant. Is this a characteristic of the SGTL5000? Is there any way to eliminate this noise? As a solution, I have reduced the SGTL5000's default setting to 70% and that has significantly reduced the noise when the volume is set near 100%. However, the noise is still quite audible when the volume is near 0%. Has anyone had a similar experience? I couldn't find any posts discussing this particular issue on the forum. It's possible that I may not be searching properly. I am working on this project to listen to USB audio through headphones via the audio shield. Please help me!




----------------------------------------------------

#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>


// GUItool: begin automatically generated code
AudioInputUSB usb1; //xy=394,206
AudioOutputI2S i2s1; //xy=678,197
AudioConnection patchCord1(usb1, 0, i2s1, 0);
AudioConnection patchCord2(usb1, 1, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; //xy=442,297
// GUItool: end automatically generated code


void setup() {

AudioMemory(16);
sgtl5000_1.enable();
sgtl5000_1.volume(0.5);
sgtl5000_1.lineOutLevel(29);


}

void loop() {
float vol = usb1.volume();
float adjustedVol = vol * 0.7;
sgtl5000_1.volume(adjustedVol);


}

---------------------------------------



Modifying the values of s

gtl5000_1.enable();
sgtl5000_1.volume(0.5);
sgtl5000_1.lineOutLevel(29);

doesn't result in any change in the volume heard through the headphone output jack.




void loop() {
float vol = usb1.volume();
float adjustedVol = vol * 0.7;
sgtl5000_1.volume(adjustedVol);


Other than multiplying the values (using only 70% of the volume) to reduce the current noise, are there any other methods available?


sgtl5000.jpg
 
Does your statement mean that I should exclude the volume setting code inside the loop? Should I put it inside the setup function? My coding skills are limited, so I don't fully understand your statement.
 
Does your statement mean that I should exclude the volume setting code inside the loop? Should I put it inside the setup function? My coding skills are limited, so I don't fully understand your statement.

exactly.
the loop() is called continuously from (hidden) main. Every direct call to set the volume can generate a glitch. So, put all one-time settings into setup().
If you need to modify volume during replay, you should first follow the audio tutorial (see https://www.pjrc.com/teensy/td_libs_Audio.html)
digest the audio examples, and maybe have a look into the SGTL5000 documentation, or live with the glitch while changing volume.
 
Back
Top