Windows Sound
in
Integration and Hardware
•
2 years ago
Hello,
This is my first post on a forum for me, so I'm quite new with this.
I'm working on a small project to make led's blink to music.
I'm using a the arduino environment and the processing environment for that.
In Processing I'm using the Minim Audio library.
I am able to read value's from my mic. wich is connected to my computer, but I actually want to read the sound value's from windows. Is there a way to read the sound wich is coming from windows?
This is the code wich I'm currently using.
- import processing.serial.*;
- import ddf.minim.*;
- Serial myPort;
- int beat1 = 5;
- int beat2 = 8;
- int beat3 = 10;
- Minim minim;
- AudioInput in;
- float i= 0;
- void setup()
- {
- size(512, 200);
- minim = new Minim(this);
- minim.debugOn();
- String portName = Serial.list()[1]; // weer wat serial gedoe.
- myPort = new Serial(this, portName, 9600);
- // get a line in from Minim, default bit depth is 16
- in = minim.getLineIn(Minim.STEREO, 512);
- }
- void draw()
- {
- background(0);
- stroke(255);
- i = in.left.get(0)+ in.right.get(0)*1000;
- i = map(i, 0, 1023, 0, 100);
- if (i > 0){
- println(i);
- }
- if (i > beat1){
- myPort.write("a");
- }
- else if (i < beat1){
- myPort.write("b");
- }
- if (i > beat2){
- myPort.write("c");
- }
- else if (i < beat2){
- myPort.write("d");
- }
- if (i > beat3){
- myPort.write("e");
- }
- else if (i < beat3){
- myPort.write("f");
- }
- }
- void stop()
- {
- in.close();
- minim.stop();
- super.stop();
- }
1