Clicking noise When turning amplitude Knob coming from hardware or software ?

Status
Not open for further replies.

chuinst

Member
MY SETUP ( FM SYNTHESIZER )

HARDWARE :

POT ---> MULTIPLEXER 4067 ---> TEENSY 4.0 + AUDIO SHIELD ---> HEADPHONE ---> MY EARS

SOFTWARE :

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

#define s0 3
#define s1 4
#define s2 9
#define s3 5
// GUItool: begin automatically generated code
AudioSynthWaveformModulated OscA; //xy=1675.8333282470703,313.21425437927246
AudioOutputI2S           i2s1;           //xy=1899.9999923706055,312.1428861618042
AudioConnection          patchCord1(OscA, 0, i2s1, 0);
AudioConnection          patchCord2(OscA, 0, i2s1, 1);
AudioControlSGTL5000     sgtl5000_1;     //xy=1851.3332061767578,404.47619438171387
// GUItool: end automatically generated code


void setup()
{
  Serial.begin(9600);

  AudioMemory(40);
  sgtl5000_1.enable();
  sgtl5000_1.volume(0.5);
  OscA.begin(0.5,220,WAVEFORM_SINE);
  
  
  // SET MULTIPLEXER ADDRESS
  pinMode(s0, OUTPUT);
  pinMode(s1, OUTPUT);
  pinMode(s2, OUTPUT);
  pinMode(s3, OUTPUT);
  // no scan to make sure that clicking issure didn't coming form scan rate
  digitalWrite(s0, HIGH);
  digitalWrite(s1, LOW);
  digitalWrite(s2, HIGH);
  digitalWrite(s3, LOW);

  
}


void loop()
{

  float vol = (float)analogRead(A10) / 1280 ;

  AudioNoInterrupts();
  OscA.amplitude(vol);
  AudioInterrupts();

  
}


}


What I have been try to proved by my self by research old thread.

Hardware :

1. USB Power Source issue Because Pot and Teensy using the same source ---> Separate Vcc ---> 100nf | 1uf | 10uf coupling between Vcc&Gnd ---> No Change
2. Ground loop ---> I probe at USB power pin and 3.3v pin with AC coupling mode | 50mv div ---> 1mhz - 3mhz noise ---> Probe Lineout --> noisy sin wave
3. Poor Mechanical pot ---> try difference pot ----> Connect Pot directly to teensy without Mux ---> No Change
4. Change Audio Shield ----> No Change

Software :

1. Try to use ResposiveAnalogRead library ---> No Change
2. Try to make Hysteresis or dead band ---> No Change
3. Try to use example from audio library --> Do More While Playing ---> Playing .wav file from sd card ---> Change Amplitude ---> Didn't hear clicking
I'm not sure it's no clicking because Music are louder than clicking and having a lot of detail or Teensy tell me something here ?.


After this I need your help - I like to learn and make a mistake

Tomorrow Plan :

1. In Pure Data if you send Control Signal directly to amplify the output , you will hear the same kind of clicking that I founded in this project. So the solution in Pure Data is [line~] object or Ramp generator, by passing 2 parameter 1. target value 2. ramp_duration and then it will smooth your changing without noise.
So, In Teensy Audio System have an object like Fade but it only have ramp_duration , I have been try it already and again No Change.

My question is :

1. Do you think my Tomorrow Plan will help me from this problem ?
2. Like title Do you think My problem ( Clicking noise coming from hardware or software ?

Ps. Sorry for my English. if you read this message I think you know already please forgive me
 
Today, use this build in example 03.Analog --> "Smoothing" to smooth my adc signal
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
#include <Encoder.h>

#define s0 3
#define s1 4
#define s2 9
#define s3 5
// GUItool: begin automatically generated code
AudioSynthWaveformModulated OscA; //xy=1675.8333282470703,313.21425437927246
AudioOutputI2S           i2s1;           //xy=1899.9999923706055,312.1428861618042
AudioConnection          patchCord1(OscA, 0, i2s1, 0);
AudioConnection          patchCord2(OscA, 0, i2s1, 1);
AudioControlSGTL5000     sgtl5000_1;     //xy=1851.3332061767578,404.47619438171387
// GUItool: end automatically generated code

const int numReadings = 10;

int readings[numReadings];      // the readings from the analog input
int readIndex = 0;              // the index of the current reading
int total = 0;                  // the running total
int average = 0;                // the average

int inputPin = A10;


void setup()
{
  Serial.begin(9600);

  AudioMemory(40);
  sgtl5000_1.enable();
  sgtl5000_1.volume(0.5);
  OscA.begin(0.5,220,WAVEFORM_SINE);
  
  
  // SET MULTIPLEXER ADDRESS
  pinMode(s0, OUTPUT);
  pinMode(s1, OUTPUT);
  pinMode(s2, OUTPUT);
  pinMode(s3, OUTPUT);
  // no scan to make sure that clicking issure didn't coming form scan rate
  digitalWrite(s0, LOW);
  digitalWrite(s1, HIGH);
  digitalWrite(s2, HIGH);
  digitalWrite(s3, LOW);

  for (int thisReading = 0; thisReading < numReadings; thisReading++) 
  {
    readings[thisReading] = 0;
  }

  
}


void loop()
{
  
  // subtract the last reading:
  total = total - readings[readIndex];
  // read from the sensor:
  readings[readIndex] = analogRead(inputPin);
  // add the reading to the total:
  total = total + readings[readIndex];
  // advance to the next position in the array:
  readIndex = readIndex + 1;

  // if we're at the end of the array...
  if (readIndex >= numReadings) {
    // ...wrap around to the beginning:
    readIndex = 0;
  }

  // calculate the average:
  average = total / numReadings;
  
  float vol = (float)average / 1280;
 
  AudioNoInterrupts();
  OscA.amplitude(vol);
  AudioInterrupts();

  
}

And then I think maybe i should try to filter ( LP) before feeding into adc. By experiment with some values of resistor and capacitor. Noise is more quiet but not enough.

schematic.jpg


I have been check my power source again, I read some article that unstable voltage ref will effect adc.

power_probe.jpg
power_osilloscope1.jpg

then I wiring adc to gnd.

Adc_to_ground1.jpg
Adc_read1.jpg

after that I add pot without filter.
add_pot1.jpg
pot_read1.jpg

This is the line out with 10hz sinewave 0.5 amplitude.
line_out_set1.jpg
line_out_osilloscope1.jpg

It's sound like this when you turn the pot. NOTE* difference pot difference noise character
https://soundcloud.com/yojxpuv4l3mp/noise/s-m24ME1J1Dmk

What I should try to do next ?
 
Status
Not open for further replies.
Back
Top