diff --git a/chuck/README.md b/chuck/README.md index d8a6ba9..34397bc 100644 --- a/chuck/README.md +++ b/chuck/README.md @@ -1,5 +1,9 @@ # trucs en ChucK +Attention, il faut parfois utiliser l'option `--silent` +pour lancer Chuck sans connexion audio. + + ## dessiner.ck ## pouet.ck diff --git a/chuck/dessiner.ck b/chuck/dessiner.ck index 2c4b465..53615d0 100644 --- a/chuck/dessiner.ck +++ b/chuck/dessiner.ck @@ -7,7 +7,7 @@ * */ -9000 => int OSCPort; +7777 => int OSCPort; 31000.0 => float Amplitude; OscOut xmit; @@ -15,13 +15,7 @@ float dx, dy; xmit.dest("localhost", OSCPort); -// ---- clear the screen -xmit.start("/joystick/b"); -50 => xmit.add; 1 => xmit.add; -xmit.send(); -xmit.start("/joystick/b"); -50 => xmit.add; 0 => xmit.add; -xmit.send(); +clear_the_screen(); for (0 => int foo; foo<25800; foo++) { <<< foo >>>; @@ -34,7 +28,15 @@ for (0 => int foo; foo<25800; foo++) { Std.ftoi(dy) => xmit.add; xmit.send(); - 0.03::second => now; - + 0.02::second => now; } +fun void clear_the_screen() +{ +xmit.start("/joystick/b"); +50 => xmit.add; 1 => xmit.add; +xmit.send(); +xmit.start("/joystick/b"); +50 => xmit.add; 0 => xmit.add; +xmit.send(); +} diff --git a/chuck/midi2osc.ck b/chuck/midi2osc.ck index 963c235..eed519e 100644 --- a/chuck/midi2osc.ck +++ b/chuck/midi2osc.ck @@ -5,6 +5,29 @@ * nouveau Rural Art System 2021 - TerreBlanque */ +MidiIn input; +MidiMsg msg; + +1 => int port; // please explain + +if (!input.open(port)) { + <<< "erreur open" >>>; + me.exit(); + } + +// print out device that was opened +<<< "MIDI device:", input.num(), " -> ", input.name() >>>; + +// infinite loop +while (1) { + input => now; + + while ( input.recv(msg) ) { + <<< msg.data1, msg.data2, msg.data3 >>>; + } + } + + diff --git a/chuck/pouet.ck b/chuck/pouet.ck index 9750b70..943b073 100644 --- a/chuck/pouet.ck +++ b/chuck/pouet.ck @@ -26,14 +26,14 @@ while( true ) { msg.getInt(1) => value; <<< "got (via ", InPort,")\tb", button, "\tv", value >>>; if (1 == value) { /* button down */ - Std.mtof(base+(button)) => sl.freq; + Std.mtof(base+(button)) => sl.freq; Std.mtof(base+12+(button)) => sr.freq; 1 => envl.keyOn => envr.keyOn; } else { 1 => envl.keyOff => envr.keyOff; } - // 0.2::second => now; + 0.2::second => now; } } diff --git a/chuck/zwouit.ck b/chuck/zwouit.ck index d207d81..b605afd 100644 --- a/chuck/zwouit.ck +++ b/chuck/zwouit.ck @@ -11,13 +11,14 @@ SawOsc sr => dac.right; OscIn oscin; OscMsg msg; - InPort => oscin.port; oscin.addAddress( "/joystick/xy, ii" ); int x, y; 55 => int base; +0.5 => sl.gain => sr.gain; + <<< "listening on port", InPort >>>; while( true ) { @@ -25,9 +26,17 @@ while( true ) { while ( oscin.recv(msg) ) { msg.getInt(0) => x; msg.getInt(1) => y; - <<< "got (via ", InPort,") ", x, y >>>; + <<< "got (via ", InPort,") ", x, y >>>; + x => sl.freq; + y => sr.freq; } + } /* made in doubledragon2 by tTh */ +/* -------------------------------------------------------- + conversion coordonnées vers frequence */ + + +