Bonjour a tous
grace a necrotek j ai pu faire fonctionner processing avec JACK
mon but est seulement d'avoir le waveform entre 2 point de ce qui joue sur le canal 1, 2 etc jusqu a 16 venant de pure data
maintenant j'ai trouver ce bout de code qui envoi une fréquence de 1000 hz et retourne la waveform mais elle me parais trop compliquer il y a t il une façon plus facile de faire sa du genre
bead.getlinein(1);
pi ensuite avec une ligne la faire osciller ?
voici le code qui me parais compliquer il vient du site de processing
import beads.*; AudioContext ac; void setup() { size(300,300); ac = new AudioContext(); Envelope freqEnv = new Envelope(ac, 500); WavePlayer wp = new WavePlayer(ac, freqEnv, Buffer.SINE); freqEnv.addSegment(1000, 1000); Gain g = new Gain(ac, 1, 0.1); g.addInput(wp); ac.out.addInput(g); ac.start(); } void draw() { int[] p1 = {height/2,width/2}; // Set 1st point p1. int[] p2 = {mouseX,mouseY}; // Set 2nd point p2. int amp = 500; // Set the amplitube of the wave, in pixels. // Factors for the placement of the waveform ("polar" placement): float fi = atan2(p2[1]-p1[1],p2[0]-p1[0]); // fi sets the rotation angle. int yp = (int) sqrt(pow((p2[0]-p1[0]),2)+pow((p2[1]-p1[1]),2)); // yp sets the lenght. // Set the colors background(0); stroke(255); // Set points so can see the points... ellipse(p1[0],p1[1],10,10); ellipse(p2[0],p2[1],10,10); // Apply the transformation translate(p1[0],p1[1]); rotate(fi); for(int i = 0 ; i < yp; i++) { // In case it "throws exception out of bounds for sth" for this line, set yp-1 instead of yp. int buffIndex = i * ac.getBufferSize() / width; int buffIndex2= (i+1) * ac.getBufferSize() / width; int vOffset = (int)((1+ ac.out.getValue(0, buffIndex)) * amp); int vOffset2 = (int)((1+ ac.out.getValue(0, buffIndex2)) * amp); line(i,vOffset-amp,i+1,vOffset2-amp); // or point(i,vOffset-amp); /* Just for fun, try play by changing the prices at fact1 and fact2, see what happens. Sths are not good, thers are usefool... float fact1 = 1.1; // or float fact1 = 1.1; float fact2 = 0.9; // float fact2 = 1.1; line(i,vOffset-amp*fact1,i+1,vOffset2-amp*fact2); */ } }
Merci D'avance
Dernière modification par imdidi (2014-06-04 21:49:05)
Hors ligne