added audioreactivity, mousewheel over black dot to control sensitivity

This commit is contained in:
2024-08-24 12:15:53 +02:00
parent 7208035df0
commit 821092116f
4 changed files with 59 additions and 14 deletions

5
audioreactivity.pde Normal file
View File

@@ -0,0 +1,5 @@
AudioIn audioIn;
Amplitude loudness;
float volume;
float volumeRoof = 1.0;

View File

@@ -9,6 +9,7 @@
import drop.*;
import controlP5.*;
import processing.sound.*;
import java.util.*;
//import processing.net.*;
@@ -42,10 +43,15 @@ boolean autoPlay = false;
boolean videoRecord = false;
//boolean webcamMode = false;
int micChannel = 0; //which microphone?
//Capture[] cams;
//ArrayList<Capture> cams = new ArrayList<Capture>();
Capture cam;
Capture cam2;
String[] cameras;
int currentCam;
@@ -88,19 +94,26 @@ void setup() {
fallbackImage = loadImage(dataPath("0.png"));
bin = loadImage(dataPath("bin.png"));
audioIn = new AudioIn(this, micChannel);
audioIn.start();
loudness = new Amplitude(this);
loudness.input(audioIn);
cameras = Capture.list();
/*
for (int i = 0; i < cameras.length-1; i++) {
try {
cams.add(new Capture(this, 1920, 1080, cameras[i]));
}
catch(Exception e) {
println(e);
}
}
*/
cam = new Capture(this, 1920,1080, "pipeline:autovideosrc");
try {
cams.add(new Capture(this, 1920, 1080, cameras[i]));
}
catch(Exception e) {
println(e);
}
}
*/
//cam = new Capture(this, 1920,1080, "pipeline:autovideosrc");
//cam = new Capture(this, 1920,1080, "Video Assist 5\" 3G");
cam = new Capture(this, 1920, 1080, "OBS Virtual Camera", 60);
cam2 = new Capture(this, 1920, 1080, "Kamera von „Victors iPhone“", 60);
OS = getOS();
@@ -122,8 +135,15 @@ void setup() {
PImage webcamImg;
void captureEvent(Capture c) {
c.read();
Capture cam = cams.get(currentCam);
webcamImg = cam.get();
//webcamImg = cam.get();
if (c == cam) {
webcamImg = cam.get();
}
if (c == cam2) {
println("iphone img incoming");
}
}
@@ -132,12 +152,16 @@ void draw() {
uptime+=1;
renderFrameRate = frameRate;
volume = map(loudness.analyze(),0,1,0,volumeRoof);
if(volume > 1) volumeRoof -= 0.008;
//if(webcamRunning){
//webcamImg =
// }
background(255);
sourceManager.update(); //will write some image to the renderer
sourceManager.setSource();
if (autoPlay) gui.robot();

View File

@@ -180,6 +180,13 @@ public class SecondApplet extends PApplet {
noStroke();
rect(mouseX, mouseY, 35, 15);
}
//audioindicator
fill(map(volume,0,0.5,0,255));
noStroke();
ellipse(260,15,15,15);
}
boolean heightOverLimit;
@@ -721,6 +728,14 @@ public class SecondApplet extends PApplet {
}
}
textSize(10);
if (mouseX > 245 && mouseY < 30) {
volumeRoof -= float(event.getCount())/1000;
if(volumeRoof > 1.0) volumeRoof = 1;
if(volumeRoof < 0.0) volumeRoof = 0;
println(volume);
println(volumeRoof);
}
}
int numberTypedFrame;
boolean typingNumber;

View File

@@ -1,5 +1,6 @@
String FX[] = {
"WEBCAM",
"MASK",
"ASDFPIXELSORT",
"DISTORTER",
"FM",
@@ -18,7 +19,6 @@ String FX[] = {
"COPYZOOM",
"SUBTLESORT",
"SCANKER",
"MASK",
"DRAWSTROKES",
"DRAWGENERATIVE",
"PIXELDRIFTER",
@@ -32,7 +32,8 @@ String FX[] = {
"SEGMENTER",
"COLORCRUSHER",
"JPGCORRUPTION",
"WEBPCORRUPTION",
"WEBPCORRUPTION"
/*,
"SOXALLPASS",
"SOXBAND",
"SOXBANDPASS",
@@ -96,7 +97,7 @@ String FX[] = {
"SOXTRIM",
"SOXUPSAMPLE",
"SOXVAD",
"SOXVOL"
"SOXVOL"*/
};