image transparency with minim
in
Core Library Questions
•
7 months ago
Hey guys,
i already wrote the first steps:
-> sound is going into processing with minim
-> minim analyzis the sound an gives feedback to rect
-> the rect transparency is depending on the feedback
now is it possible just to switch to an image instead of the rect
i tried with easy replacing the rect and loading an img. but it didnt work :/
heres the code excerpt, hope you can help me :)
i already wrote the first steps:
-> sound is going into processing with minim
-> minim analyzis the sound an gives feedback to rect
-> the rect transparency is depending on the feedback
now is it possible just to switch to an image instead of the rect
i tried with easy replacing the rect and loading an img. but it didnt work :/
heres the code excerpt, hope you can help me :)
- import ddf.minim.spi.*;
import ddf.minim.signals.*;
import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.ugens.*;
import ddf.minim.effects.*;
import geomerative.*;
import org.processing.wiki.triangulate.*;
PImage img;
RFont f;
RShape grp;
//RPoint[] points;
Minim minim;
AudioPlayer player;
float audioLevel;
//float transparenz = audioLevel*255;
ArrayList triangles = new ArrayList();
ArrayList points = new ArrayList();
void setup() {
size(300, 300);
reset();
img = loadImage("THF.jpg");
RG.init(this);
grp = RG.getText("THF", "Berthold Akzidenz.ttf", 137, CENTER);
smooth();
minim = new Minim (this);
//minim.debugOn();
player = minim.loadFile ("soundfile.mp3", 1024);
player.play ();
}
void reset() {
// clear the list
points.clear();
// fill the points arraylist with random points
for (int i = 0; i < 1000; i++) {
// PVector.z is used to store an angle (particle's direction)
points.add(new PVector(random(width), random(height), random(TWO_PI)));
}
}
void mouseClicked() {
reset();
}
void draw() {
model();
view();
println(audioLevel);
noStroke();
if (audioLevel > 0.002 && audioLevel <= 0.08){
fill(0, map(audioLevel, 0.002, 0.08, 0, 255));
rect(150, 150, 50, 50); - //heres the rect and there should be an image
}
calcSoundLevel();
}
void viereck() {
}
1