Initially I had taken all of the main functions and combined the code, which worked, although the speech recognition did not record and produce in a typographic format as it should.
I went back and cleaned up the code, however now I have received an error. I have attached a screenshot of both windows in order to display what I am working with.
I think where there may be an error due to the audioinput doing two things at one time, although I am unsure how to resolve this. Also, I would like the text on the visualisation to be deleted.
If anyone could help that would be greatly appreciated.
Kind regards,
/**
z_fft by zambari
** parts based on* Get Line In by Damien Di Fede.
*
early, not very developed version
*/
import ddf.minim.analysis.*;
import ddf.minim.*;
import processing.opengl.*;
import com.getflourish.stt.*;
STT stt;
String result;
PFont fontA;
Minim minim;
Minim minim2;
FFT fft;
FFT fft2;
AudioInput in;
AudioInput in2;
int nrOfIterations=100; //=29 fps on windows
int iterationDistance=80;
int bufferSizeSmall=512;
int fftRatio=16; // how many times bigger is the big buffer for detailed analisis
I'm starting a project in which I'm manipulating type with sound, so I'm using this code as a basis. Although, I would like to change the input from an mp3 to the built on microphone on my Mac.
I've had a crack with the AudioInput function, although it seems to be giving me the following error;
/** * Frequency Energy * by Damien Di Fede. * * This sketch demonstrates how to use the BeatDetect object in FREQ_ENERGY mode. * You can use <code>isKick</code>, <code>isSnare</code>, </code>isHat</code>, * <code>isRange</code>, and <code>isOnset(int)</code> to track whatever kind * of beats you are looking to track, they will report true or false based on * the state of the analysis. To "tick" the analysis you must call <code>detect</code> * with successive buffers of audio. You can do this inside of <code>draw</code>, * but you are likely to miss some audio buffers if you do this. The sketch implements * an <code>AudioListener</code> called <code>BeatListener</code> so that it can call * <code>detect</code> on every buffer of audio processed by the system without repeating * a buffer or missing one. * * This sketch plays an entire song so it may be a little slow to load. */
in = minim.getLineIn(Minim.STEREO, 2048); // a beat detection object that is FREQ_ENERGY mode that // expects buffers the length of song's buffer size // and samples captured at songs's sample rate beat = new BeatDetect(in.bufferSize(), in.sampleRate()); // set the sensitivity to 300 milliseconds // After a beat has been detected, the algorithm will wait for 300 milliseconds // before allowing another beat to be reported. You can use this to dampen the // algorithm if it is giving too many false-positives. The default value is 10, // which is essentially no damping. If you try to set the sensitivity to a negative value, // an error will be reported and it will be set to 10 instead. beat.setSensitivity(300); kickSize = snareSize = hatSize = 16; // make a new beat listener, so that we won't miss any buffers for the analysis bl = new BeatListener(beat, in); textFont(createFont("SanSerif", 16)); textAlign(CENTER); }
void stop() { // always close Minim audio classes when you are finished with them song.close(); // always stop Minim before exiting minim.stop(); // this closes the sketch super.stop(); }
Any ideas as to how I can rectify this? I'm hoping to get this sorted in order to experiment and customise this outcome.