Compare commits

...

4 Commits

Author SHA1 Message Date
tth 7c91072873 osc+chuck=wip 2021-07-23 14:13:56 +02:00
tth 2e9b344922 typo 2021-07-23 12:15:18 +02:00
tth 11cd7dbf5e dessiner avec chuck, premier pas 2021-07-22 18:34:34 +02:00
tth 2a8c892e33 ok 2021-07-20 22:24:05 +02:00
6 changed files with 82 additions and 8 deletions

View File

@ -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

View File

@ -1,4 +1,42 @@
#
# dessiner par OSC avec le laser de Gaby
#
/*
* dessiner par OSC
* (avec le laser de Gaby ?)
*
* nouveau Rural Art System 2021 - TerreBlanque
*
*/
7777 => int OSCPort;
31000.0 => float Amplitude;
OscOut xmit;
float dx, dy;
xmit.dest("localhost", OSCPort);
clear_the_screen();
for (0 => int foo; foo<25800; foo++) {
<<< foo >>>;
Amplitude * Math.sin(foo * 0.30001) => dx;
Amplitude * Math.cos(foo * 0.50001) => dy;
xmit.start("/joystick/xy");
Std.ftoi(dx) => xmit.add;
Std.ftoi(dy) => xmit.add;
xmit.send();
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();
}

View File

@ -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 >>>;
}
}

View File

@ -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;
}
}

View File

@ -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 */

View File

@ -86,7 +86,7 @@ if (do_dump) {
if (verbosity) {
fprintf(stderr, "%s is sending to %s:%s\n", argv[0],
remote_host, remote_port);
fprintf(stderr, " the stick '%s'is on %s\n", my_id, joy_device);
fprintf(stderr, " the stick '%s' is on %s\n", my_id, joy_device);
}
lo_address t = lo_address_new(remote_host, remote_port);