Constructor is undefined - Minim AudioInput
in
Core Library Questions
•
3 months ago
Hello,
I've patched together some of the minim examples to achieve what I thought would be real-time audio reactive animation. I have the "kick, snare, hat" example (beatListener) open that I've modified with the AudioRecord example so that instead of kick,snare, and hat responding to a playing .mp3 file, they respond to the live record stream on my PC.
My attempt at the most obvious solution comes up to swap the 'song' variables with the 'line in' values produces the error "Line 23: The constructor AudioResponse.BeatListener(BeatDetect, AudioInput) is undefined" - which I've come to determine is because AudioInput is the wrong kind of value to be passed to BeatListener.
So my question is how would I go about achieving what I want? Can beatlistener not be used in a live recording stream way that I would like to? Will I need to do some type of value conversion?
Any and ALL feedback is always appreciated.
Thanks.
- import ddf.minim.*;
- import ddf.minim.analysis.*;
- Minim minim;
- BeatDetect beat;
- BeatListener bl;
- AudioInput in;
- float kickSize, snareSize, hatSize;
- void setup()
- {
- size(512, 200, P3D);
- minim = new Minim(this);
- in = minim.getLineIn(Minim.STEREO, 2048);
- beat = new BeatDetect(in.bufferSize(), in.sampleRate());
- beat.setSensitivity(300);
- kickSize = snareSize = hatSize = 16;
- bl = new BeatListener(beat, in);
- textFont(createFont("Helvetica", 16));
- textAlign(CENTER);
- }
- void draw()
- {
- background(0);
- fill(255);
- if ( beat.isKick() ) kickSize = 32;
- if ( beat.isSnare() ) snareSize = 32;
- if ( beat.isHat() ) hatSize = 32;
- textSize(kickSize);
- text("KICK", width/4, height/2);
- textSize(snareSize);
- text("SNARE", width/2, height/2);
- textSize(hatSize);
- text("HAT", 3*width/4, height/2);
- kickSize = constrain(kickSize * 0.95, 16, 32);
- snareSize = constrain(snareSize * 0.95, 16, 32);
- hatSize = constrain(hatSize * 0.95, 16, 32);
- }
- 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();
- }
1