From 85c1846a0be8ba167e4d896c16a95fc7df74ee33 Mon Sep 17 00:00:00 2001 From: tth Date: Sat, 8 Jan 2022 03:34:05 +0100 Subject: [PATCH] 2020+2 a new hope ? --- chuck/README.md | 2 ++ chuck/dessiner.ck | 14 +++++++++----- chuck/midi2osc.ck | 10 ++++++++++ chuck/pouet.ck | 2 +- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/chuck/README.md b/chuck/README.md index 34397bc..d04c080 100644 --- a/chuck/README.md +++ b/chuck/README.md @@ -6,6 +6,8 @@ pour lancer Chuck sans connexion audio. ## dessiner.ck +Faire des courbes de Lissajous... + ## pouet.ck ## midi2osc.ck diff --git a/chuck/dessiner.ck b/chuck/dessiner.ck index 53615d0..e115526 100644 --- a/chuck/dessiner.ck +++ b/chuck/dessiner.ck @@ -7,8 +7,8 @@ * */ -7777 => int OSCPort; -31000.0 => float Amplitude; +9000 => int OSCPort; +32760.0 => float Amplitude; OscOut xmit; float dx, dy; @@ -20,17 +20,19 @@ 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; + Amplitude * Math.sin(foo * 0.3001) => dx; + Amplitude * Math.cos(foo * 0.4999) => dy; xmit.start("/joystick/xy"); Std.ftoi(dx) => xmit.add; Std.ftoi(dy) => xmit.add; xmit.send(); - 0.02::second => now; + 0.025::second => now; } +// ---------------------------------------------------- + fun void clear_the_screen() { xmit.start("/joystick/b"); @@ -40,3 +42,5 @@ xmit.start("/joystick/b"); 50 => xmit.add; 0 => xmit.add; xmit.send(); } + +// ---------------------------------------------------- diff --git a/chuck/midi2osc.ck b/chuck/midi2osc.ck index eed519e..9574c12 100644 --- a/chuck/midi2osc.ck +++ b/chuck/midi2osc.ck @@ -7,8 +7,10 @@ MidiIn input; MidiMsg msg; +OscOut xmit; 1 => int port; // please explain +9000 => int OSCPort; if (!input.open(port)) { <<< "erreur open" >>>; @@ -18,12 +20,20 @@ if (!input.open(port)) { // print out device that was opened <<< "MIDI device:", input.num(), " -> ", input.name() >>>; +xmit.dest("localhost", OSCPort); + + // infinite loop while (1) { input => now; while ( input.recv(msg) ) { <<< msg.data1, msg.data2, msg.data3 >>>; + + xmit.start("/joystick/b"); + + + } diff --git a/chuck/pouet.ck b/chuck/pouet.ck index 757d657..2c98804 100644 --- a/chuck/pouet.ck +++ b/chuck/pouet.ck @@ -9,7 +9,7 @@ SqrOsc sl => Envelope envl => dac.left; SawOsc sr => Envelope envr => dac.right; 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;