We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, I am new to processing and trying to do simple(averaged?) wave forms from Minim MonitorInput. The waveform I keep having has complex spectrum of waveform but I am trying to simplify the points of waveforms. Or how can I change it to the linear averages? which will produce averaged data of input sound?
Thanks.
/** * This sketch demonstrates how to monitor the currently active audio input * of the computer using an AudioInput. What you will actually * be monitoring depends on the current settings of the machine the sketch is running on. * Typically, you will be monitoring the built-in microphone, but if running on a desktop * it's feasible that the user may have the actual audio output of the computer * as the active audio input, or something else entirely. *
<
p> * Press 'm' to toggle monitoring on and off. *
<
p> * When you run your sketch as an applet you will need to sign it in order to get an input. *
<
p> * For more information about Minim and additional features, * visit http://code.compartmental.net/minim/ */
import ddf.minim.*;
Minim minim; AudioInput in;
import hypermedia.net.*; UDP udps;
void setup() { size(70, 70, P3D); udps = new UDP( this, 6000 );
minim = new Minim(this);
// use the getLineIn method of the Minim object to get an AudioInput in = minim.getLineIn(); }
void draw() { background(0); stroke(100); String message = "";
// draw the waveforms so we can see what we are monitoring for(int i = 0; i < in.bufferSize() - 1; i++) { rect( i, 50 + in.left.get(i)50, i+1, 50 + in.left.get(i+1)50 ); rect( i, 150 + in.right.get(i)50, i+1, 150 + in.right.get(i+1)50 ); float x1 = map(i, 0, in.bufferSize(), 0, width); float x2 = 20 + in.left.get(i)*10;
message = message + String.valueOf(x1) + "," + String.valueOf(x2)+ ";";
}
String ip = "127.0.0.1"; // the remote IP address int port = 107; // the destination port udps.send( message, ip, port ); message = ""; delay(50); }
void keyPressed() { if ( key == 'm' || key == 'M' ) { if ( in.isMonitoring() ) { in.disableMonitoring(); } else { in.enableMonitoring(); } } }
Answers
http://forum.processing.org/two/discussion/8045/how-to-format-code-and-text
GoToLoop,
Thank you for reply but it is a bit hard to understand what you are trying to say with the link. Would you please explain little bit more detaily?
Thanks.
He's recommending you reformat your post so it could be more clearly understood.
I'm trying to do the same thing. My concern is that I'm trowing out valuable information. To get an average start a variable at 0, incrementally at it when you go through each for-loop, then divided by the amount of loops. I did the same thing but it doesn't look less crazy.
I'm struggling to parse the high and lows, and frequency. I can imagine how to do it programmatically, but it feels like overkill.
"it is a bit hard to understand what you are trying to say with the link. Would you please explain little bit more detaily?"
Have you looked back at your first message? It is a mess. Do you expect us to read it?
Have you followed the link and read the topic? Is there anything unclear in it? (I wrote it, so I am interested for feedback.)