ghostintranslation
Well-known member
Hi,
I'm using Teensy 4.0 with the audio adapter.
I was working on a synth when I started to notice that varying the gain value of an amp object with a potentiometer was generating a side high pitch frequency. I also tried with a Mixer and changing the gain value is doing the same.
I first thought maybe that's ground noise, but I highly doubt it because I tried on 3 laptops, and on a usb power outlet too, and also because the noise only happen when varying the amp and otherwise there is no noise.
I made a simple reproductible scenario:
In the loop the 1st commented case is a stable gain that does no noise.
The 2nd uncommented case is the gain ramping from 0 to 1 in 1 second. it generates this high frequency that can be especially heard if the input sine is low but can still be heard with higher frequencies. Also it does a strong click when the gain jumps from 1 to 0 every second.
The 3rd commented case is with the gain jumping from values to values, that's to show the click mostly.
I'm more interested in getting rid of that high pitch noise than the click noise.
I have tried with Teensyduino 1.53 and 1.54#7 and get the same result.
In my more realistic use in my synth I am varying the gain of 4 amp objects for 4 sine waves and that generates a lot of noise when combined so it's really obvious.
Is this a known issue, is there a solution or workaround?
I'm using Teensy 4.0 with the audio adapter.
I was working on a synth when I started to notice that varying the gain value of an amp object with a potentiometer was generating a side high pitch frequency. I also tried with a Mixer and changing the gain value is doing the same.
I first thought maybe that's ground noise, but I highly doubt it because I tried on 3 laptops, and on a usb power outlet too, and also because the noise only happen when varying the amp and otherwise there is no noise.
I made a simple reproductible scenario:
Code:
#include <Audio.h>
AudioOutputI2S i2s2;
AudioSynthWaveformModulated sineFM; //xy=243,108
AudioAmplifier amp; //xy=396,116
AudioConnection patchCord2(sineFM, 0, amp, 0);
AudioConnection patchCord3(amp, 0, i2s2, 0);
AudioConnection patchCord4(amp, 0, i2s2, 1);
AudioControlSGTL5000 audioBoard;
unsigned int i;
void setup() {
// put your setup code here, to run once:
// Audio connections require memory to work.
AudioMemory(48);
audioBoard.enable();
audioBoard.volume(0.6);
sineFM.begin(WAVEFORM_SINE);
sineFM.frequency(1); // Try values from 1 to 50
sineFM.amplitude(1);
}
void loop() {
// This won't generate any noise
// amp.gain(1);
// But constantly changing gain generates a high pitch frequency
// Additionaly there is a strong click when the gain jumps from 1 to 0
amp.gain((float)(millis()%1000)/1000);
// This generates clicks a lot as the gain jumps from values to value
// if(millis()%100 == 0){
// i++;
// }
// amp.gain((float)cos(i));
}
In the loop the 1st commented case is a stable gain that does no noise.
The 2nd uncommented case is the gain ramping from 0 to 1 in 1 second. it generates this high frequency that can be especially heard if the input sine is low but can still be heard with higher frequencies. Also it does a strong click when the gain jumps from 1 to 0 every second.
The 3rd commented case is with the gain jumping from values to values, that's to show the click mostly.
I'm more interested in getting rid of that high pitch noise than the click noise.
I have tried with Teensyduino 1.53 and 1.54#7 and get the same result.
In my more realistic use in my synth I am varying the gain of 4 amp objects for 4 sine waves and that generates a lot of noise when combined so it's really obvious.
Is this a known issue, is there a solution or workaround?
Last edited: