From 5216e5be535099810bc68456159b8a1b71f4601c Mon Sep 17 00:00:00 2001 From: Pete Shadbolt Date: Tue, 23 Dec 2014 17:45:56 +0000 Subject: [PATCH] Started working on OSC --- main.csd => delay.csd | 0 osc.csd | 58 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) rename main.csd => delay.csd (100%) create mode 100644 osc.csd diff --git a/main.csd b/delay.csd similarity index 100% rename from main.csd rename to delay.csd diff --git a/osc.csd b/osc.csd new file mode 100644 index 0000000..7aa756d --- /dev/null +++ b/osc.csd @@ -0,0 +1,58 @@ + + +-o dac + + +sr = 48000 +ksmps = 32 +nchnls = 2 +0dbfs = 1 + +; localhost means communication on the same machine, otherwise you need +; an IP adress +#define IPADDRESS # "localhost" # +#define S_PORT # 47120 # +#define R_PORT # 47120 # + +turnon 1000 ; starts instrument 1000 immediately +turnon 1001 ; starts instrument 1001 immediately + + +instr 1000 ; this instrument sends OSC-values + kValue1 randomh 0, 0.8, 4 + kNum randomh 0, 8, 8 + kMidiKey tab (int(kNum)), 2 + kOctave randomh 0, 7, 4 + kValue2 = cpsmidinn (kMidiKey*kOctave+33) + kValue3 randomh 0.4, 1, 4 + ;Stext sprintf "%i", $S_PORT + OSCsend kValue1+kValue2, $IPADDRESS, $S_PORT, "/QuteCsound", + "fff", kValue1, kValue2, kValue3 +endin + + +instr 1001 ; this instrument receives OSC-values + kValue1Received init 0.0 + kValue2Received init 0.0 + kValue3Received init 0.0 + ;Stext sprintf "%i", $R_PORT + ihandle OSCinit $R_PORT + kAction OSClisten ihandle, "/QuteCsound", "fff", + kValue1Received, kValue2Received, kValue3Received + if (kAction == 1) then + ;printk2 kValue2Received + ;printk2 kValue1Received + + endif + aSine poscil3 kValue1Received, kValue2Received, 1 + outs aSine, aSine +endin + + + +f 1 0 1024 10 1 +f 2 0 8 -2 0 2 4 7 9 11 0 2 +e 3600 + + +; example by Alex Hofmann (Mar. 2011)