/*Getting started.. Realtime Interaction: MIDI Controller 01 (Modulation) The quickest way to control instruments with MIDI control-data (Modulation, Aftertouch, etc.) can be set up, by using 'ctrl7' opcode. It can be used directly in an instrument definition, and outputs the desired k-rate data. .. kMidiCC ctrl7 1, 1, 10, 5000 ; read 7-bit MIDI CC data from Ch.1, CC 01, and map to a range between 10-5000 aSrc oscili 0.8, kMidiCC, 1 ; now CC 01 controlls the frequency of this oscillator .. The disadvantage of that method would be, that you have no communication with the Widget-GUI. In the example below, a separate instrument (instr 100) is built to receive the MIDI CC 01 (Modulation) constantly and send its values on channel "filter_freq". In Instrument 101 the data from this channel is read and mapped to the filters frequency input. By sending MIDI-Control-Data 01 on Channel 1 (CC 01 - with your keyboards modualtion wheel, or any other MIDI faderbox) you see the Widget-fader moving and can hear the filter adjustments in realtime, when playing a note. Adjusting the fader with the mouse is also still possible. */ --midi-key-cps=4 --midi-velocity=5 sr = 44100 ksmps = 32 nchnls = 2 0dbfs = 1 massign 1, 101 ; send notes on MIDI Ch.1 to instr 101 gaOut init 0.0 instr 100 ; MIDI Controller Receive Instrument kFilterCC1 ctrl7 1, 1, 10, 5000 ; read 7-bit MIDI CC data from Ch.1, CC1, and map to a range between 10-5000 printk2 kFilterCC1 ; print the value to the console kChanged changed kFilterCC1 ; check if new values are incoming if kChanged == 1 then ; so if, update the chanel.. outvalue "filter_freq", kFilterCC1 ; send the value to the widgetpanel endif endin instr 101 ; Sawthooth Oscillator triggered by notes on MIDI CH: 1 icps = p4 iamp = p5/127 kFfreq invalue "filter_freq" kFfreq port kFfreq, 0.05 aSrc oscili iamp, icps, 1 aFiltered moogvcf aSrc, kFfreq, 0.1 aEnv madsr 0.01, 0.1, 0.9, 0.01 gaOut = gaOut + aFiltered*aEnv endin instr 102 ; Global Feedback Delay kDryWet invalue "d_w_delay" kDelTime invalue "time_delay" kFeedback invalue "feedb_delay" kDelTime port kDelTime, 0.05 aDelTime = a(kDelTime) aDelay delayr 1 aWet deltapi aDelTime delayw gaOut+(aWet*kFeedback) gaOut = (1-kDryWet) * gaOut + (kDryWet * aWet) endin instr 103 ; Global Reverb kroomsize init 0.4 khfdamp init 0.8 kDryWet invalue "d_w_reverb" aWetL, aWetR freeverb gaOut, gaOut, kroomsize, khfdamp aOutL = (1-kDryWet) * gaOut + (kDryWet * aWetL) aOutR = (1-kDryWet) * gaOut + (kDryWet * aWetR) outs aOutL, aOutR gaOut = 0.0 endin f 1 0 256 7 0 128 1 0 -1 128 0 i 100 0 3600 ; the MIDI CC 01will become received for one hour i 102 0 3600 ; the delay runs for one hour i 103 0 3600 ; the reverb runs for one hour e ; written by Alex Hofmann (Dec. 2009) - Incontri HMT-Hannover 0 0 599 453 true 182 109 0 d_w_reverb 22 458 311 38 {a933ecca-4f6f-4c37-8612-e80ccaeab1ff} true 0 -3 0.00000000 1.00000000 0.24437300 lin continuous -1.00000000 false 22 421 131 35 {8c2bf2d5-2f2a-4aa8-95f5-fd459644d3b3} true 0 -3 left Lucida Grande 18 3 0 0 0 255 255 255 noborder 1 1 d_w_delay 22 277 311 38 {252c3435-b659-4c63-a7eb-6d8ba725081a} true 0 -3 0.00000000 1.00000000 0.25723500 lin continuous -1.00000000 false 22 240 131 35 {b2a47e2f-a70f-4ac8-afd0-89ebec44cf27} true 0 -3 left Lucida Grande 18 3 0 0 0 255 255 255 noborder 1 1 time_delay 244 147 20 100 {9eda359f-2e35-416a-9486-75e2b8609bac} true 0 -3 0.05000000 1.00000000 0.40150000 lin continuous -1.00000000 false feedb_delay 313 148 20 100 {9b9faa01-b3b1-42b6-b3ea-942190c61015} true 0 -3 0.05000000 1.00000000 0.31600000 lin continuous -1.00000000 false 235 121 45 23 {a34714d9-8caa-4e71-993d-adc95b6d4ef6} true 0 -3 left Lucida Grande 10 3 0 0 0 255 255 255 noborder 1 1 294 121 57 23 {38d17cf1-8311-44a5-bbcd-e89f2a0a341e} true 0 -3 left Lucida Grande 10 3 0 0 0 255 255 255 noborder 1 1 22 116 184 35 {00c81148-ef01-44bb-af39-743e7597a9a3} true 0 -3 left Lucida Grande 22 3 0 0 0 255 255 255 border 1 1 21 313 80 25 {ff2f6506-d383-4b73-8cc8-325a13c76301} true 0 -3 left Lucida Grande 10 3 0 0 0 255 255 255 noborder 1 1 294 315 37 27 {deb507a6-bbc9-4875-ab32-b98d0fd9ca21} true 0 -3 left Lucida Grande 10 3 0 0 0 255 255 255 noborder 1 1 22 494 80 25 {1a2bb9cb-d541-4c5f-8c71-07b4c279ed43} true 0 -3 left Lucida Grande 10 3 0 0 0 255 255 255 noborder 1 1 296 494 37 25 {c0a097a0-f5e0-4041-a760-cb8edbe42625} true 0 -3 left Lucida Grande 10 3 0 0 0 255 255 255 noborder 1 1 20 381 184 35 {6a214d2b-c15f-4749-81a6-00a359668d41} true 0 -3 left Lucida Grande 22 3 0 0 0 255 255 255 border 1 1 223 250 69 24 {c6be046b-6565-487b-82aa-7153da5ce460} true 0 -3 left Lucida Grande 10 3 0 0 0 255 255 255 noborder 1 1 300 251 69 24 {9dcc5341-ac6e-4568-b661-9a08ffa7bafd} true 0 -3 left Lucida Grande 10 3 0 0 0 255 255 255 noborder 1 1 19 44 273 25 {5f7f6f96-32f1-47ba-a896-ca4f6e4eaf11} true 0 -3 left Lucida Grande 10 3 0 0 0 255 255 255 noborder 1 1 20 10 184 35 {2f8d8395-c26a-4531-a1a5-d94df807fac9} true 0 -3 left Lucida Grande 22 3 0 0 0 255 255 255 border 1 1 filter_freq 18 68 311 38 {e0262b2c-5f78-4d11-9b16-1fd70b8bbefd} true 0 -3 10.00000000 5000.00000000 2288.39228300 lin continuous -1.00000000 false