GeppettoLab
Active member
Hi!
I have a little problem with my software.
I use Teensy 3.1 and audio board, acquiring the audio signal from a condenser Mic and a. From the main out of this one I go in the Line input of the audio board, trough a jack, connecting the 3 wires ( + - and GND).
I compute an FFT and i sum the values of the different bins in four different ranges. With this values I control the amplitude of 4 frequency (under 20Hz) and trough the headphones jack I go in an amplifier that control a big woofer.
In this way I convert the audio frequencies in infrasound frequency that can be seen in the movement of the subwoofer.
It's great, it works well, with huge movements but...
If I start the sketch the subwoofer is silent and respond correctly to my inputs, but when the input signal clips (I can control it from the mixer leds) the sub start to emit a repetitive click ( 4 for second) and doesn't stop until I restart the sketch.
And when I make noise in the Mic, the resulting movement of the subwoofer produces a distorted audio that is well percivable and it's very similar to the input (but it should be produced only that infrasound frequency!)
Have you an idea of which problem can be?
I think that for some frequency leaking I perceive this last noise but that cannot explain the repetitive click.
I suppose it can be an amplitude problem but reducing the output the clik is still there.
Can you help me?
This is the code in which I analyze only the first bin sum and produce only one frequency
Thanks!!
Luca
I have a little problem with my software.
I use Teensy 3.1 and audio board, acquiring the audio signal from a condenser Mic and a. From the main out of this one I go in the Line input of the audio board, trough a jack, connecting the 3 wires ( + - and GND).
I compute an FFT and i sum the values of the different bins in four different ranges. With this values I control the amplitude of 4 frequency (under 20Hz) and trough the headphones jack I go in an amplifier that control a big woofer.
In this way I convert the audio frequencies in infrasound frequency that can be seen in the movement of the subwoofer.
It's great, it works well, with huge movements but...
If I start the sketch the subwoofer is silent and respond correctly to my inputs, but when the input signal clips (I can control it from the mixer leds) the sub start to emit a repetitive click ( 4 for second) and doesn't stop until I restart the sketch.
And when I make noise in the Mic, the resulting movement of the subwoofer produces a distorted audio that is well percivable and it's very similar to the input (but it should be produced only that infrasound frequency!)
Have you an idea of which problem can be?
I think that for some frequency leaking I perceive this last noise but that cannot explain the repetitive click.
I suppose it can be an amplitude problem but reducing the output the clik is still there.
Can you help me?
This is the code in which I analyze only the first bin sum and produce only one frequency
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
const int myInput = AUDIO_INPUT_LINEIN;
//const int myInput = AUDIO_INPUT_MIC;
// Create the Audio components. These should be created in the
// order data flows, inputs/sources -> processing -> outputs
//
AudioInputI2S audioInput; // audio shield: mic or line-in
AudioSynthWaveformSine sinewave2;
AudioSynthWaveformSine sinewave6;
AudioSynthWaveformSine sinewave10;
AudioSynthWaveformSine sinewave14;
AudioSynthWaveformSine *sinewaves[4]={&sinewave2,&sinewave6,&sinewave10,&sinewave14};
AudioAnalyzeFFT1024 myFFT;
AudioMixer4 mixer1;
AudioOutputI2S audioOut; // audio shield: headphones & line-out
// Connect either the live input or synthesized sine wave
AudioConnection patchCord1(audioInput, 0, myFFT, 0);
AudioConnection patchCord2(sinewave2, 0, mixer1, 0);
AudioConnection patchCord3(sinewave6, 0, mixer1, 1);
AudioConnection patchCord4(sinewave10, 0, mixer1, 2);
AudioConnection patchCord5(sinewave14, 0, mixer1, 3);
AudioConnection patchCord6(mixer1, 0, audioOut, 0);
AudioControlSGTL5000 audioShield;
int fib[5] = {3,13,55, 200, 233};
float smo[4] = {0.00,0.00,0.00,0.00};
float inc = 0.01;
float gainMix = 0.1;
void setup() {
// Audio connections require memory to work. For more
// detailed information, see the MemoryAndCpuUsage example
AudioMemory(12);
// Enable the audio shield and set the output volume.
audioShield.enable();
audioShield.inputSelect(myInput);
audioShield.volume(0.9);
audioShield.lineInLevel(1);
audioShield.lineOutLevel(13);
audioShield.unmuteLineout();
// Configure the window algorithm to use
myFFT.windowFunction(AudioWindowHanning1024);
sinewave2.frequency(20);
sinewave6.frequency(11);
sinewave10.frequency(15);
sinewave14.frequency(20);
sinewave2.amplitude(0.0);
sinewave6.amplitude(0.0);
sinewave10.amplitude(0.0);
sinewave14.amplitude(0.0);
mixer1.gain(0,gainMix);
mixer1.gain(1,gainMix);
mixer1.gain(2,gainMix);
mixer1.gain(3,gainMix);
}
void loop() {
float n;
float m;
int i;
int y;
if (myFFT.available()) {
// each time new FFT data is available
// print it all to the Arduino Serial Monitor
Serial.print("FFT: ");
for (i=0; i<1; i++) {
m=0;
for (y=fib[i]; y<fib[i+1]; y++) {
m = m + myFFT.read(y);
}
n = m-inc;
if (n >= 0.01) {
Serial.print("| ");Serial.print(n); Serial.print(" - ");
if (smo[i]<n){
smo[i] += inc;
}else if (smo[i]>n){
smo[i] -= inc;
}
//smo[i]=n;
Serial.print(smo[i]);
Serial.print(" ");
sinewaves[i]->amplitude(smo[i]);
} else {
if(smo[i] != 0) smo[i] -= inc;
if(smo[i] <0) smo[i] = 0;
Serial.print("| ");Serial.print(n); Serial.print(" - ");
Serial.print(smo[i]); // don't print "0.00"
Serial.print(" ");
sinewaves[i]->amplitude(smo[i]);
}
}
Serial.println();
}
}
Thanks!!
Luca