2020+2 a new hope ?

This commit is contained in:
tth 2022-01-08 03:34:05 +01:00
parent 95046aa71d
commit 85c1846a0b
4 changed files with 22 additions and 6 deletions

View File

@ -6,6 +6,8 @@ pour lancer Chuck sans connexion audio.
## dessiner.ck ## dessiner.ck
Faire des courbes de Lissajous...
## pouet.ck ## pouet.ck
## midi2osc.ck ## midi2osc.ck

View File

@ -7,8 +7,8 @@
* *
*/ */
7777 => int OSCPort; 9000 => int OSCPort;
31000.0 => float Amplitude; 32760.0 => float Amplitude;
OscOut xmit; OscOut xmit;
float dx, dy; float dx, dy;
@ -20,17 +20,19 @@ clear_the_screen();
for (0 => int foo; foo<25800; foo++) { for (0 => int foo; foo<25800; foo++) {
<<< foo >>>; <<< foo >>>;
Amplitude * Math.sin(foo * 0.30001) => dx; Amplitude * Math.sin(foo * 0.3001) => dx;
Amplitude * Math.cos(foo * 0.50001) => dy; Amplitude * Math.cos(foo * 0.4999) => dy;
xmit.start("/joystick/xy"); xmit.start("/joystick/xy");
Std.ftoi(dx) => xmit.add; Std.ftoi(dx) => xmit.add;
Std.ftoi(dy) => xmit.add; Std.ftoi(dy) => xmit.add;
xmit.send(); xmit.send();
0.02::second => now; 0.025::second => now;
} }
// ----------------------------------------------------
fun void clear_the_screen() fun void clear_the_screen()
{ {
xmit.start("/joystick/b"); xmit.start("/joystick/b");
@ -40,3 +42,5 @@ xmit.start("/joystick/b");
50 => xmit.add; 0 => xmit.add; 50 => xmit.add; 0 => xmit.add;
xmit.send(); xmit.send();
} }
// ----------------------------------------------------

View File

@ -7,8 +7,10 @@
MidiIn input; MidiIn input;
MidiMsg msg; MidiMsg msg;
OscOut xmit;
1 => int port; // please explain 1 => int port; // please explain
9000 => int OSCPort;
if (!input.open(port)) { if (!input.open(port)) {
<<< "erreur open" >>>; <<< "erreur open" >>>;
@ -18,12 +20,20 @@ if (!input.open(port)) {
// print out device that was opened // print out device that was opened
<<< "MIDI device:", input.num(), " -> ", input.name() >>>; <<< "MIDI device:", input.num(), " -> ", input.name() >>>;
xmit.dest("localhost", OSCPort);
// infinite loop // infinite loop
while (1) { while (1) {
input => now; input => now;
while ( input.recv(msg) ) { while ( input.recv(msg) ) {
<<< msg.data1, msg.data2, msg.data3 >>>; <<< msg.data1, msg.data2, msg.data3 >>>;
xmit.start("/joystick/b");
} }

View File

@ -9,7 +9,7 @@ SqrOsc sl => Envelope envl => dac.left;
SawOsc sr => Envelope envr => dac.right; SawOsc sr => Envelope envr => dac.right;
0.5 => sl.gain => sr.gain; 0.5 => sl.gain => sr.gain;
0.01 => envl.time; 0.06 => envr.time; 0.01 => envl.time; 0.04 => envr.time;
OscIn oscin; OscMsg msg; OscIn oscin; OscMsg msg;