/*Getting started.. Realtime Interaction: MIDI Notes / MIDI Synth
Generating the frequency for one voice, has to become computed individually for each midi note. So a new instance of instr 1 is started for every key pressed on the keyboard.
Instruments 101 (Feedback Delay) and 102 (Reverb) are global effects, which are not necessary to compute for each individual voice independently. So started once from the score, one instance each runs constantly whether a note is played or not. The Widget Panel, gives access to some of their parameters. You can add more..
*/
--midi-key-cps=4 --midi-velocity=5
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1
gaOut init 0.0 ; a global audio variable is initialised, this can be seen as an "global audio Bus" (g.a.Bus), where audiodata can be send and read from, but first it is NULL
instr 1 ; Sawthooth Oscillator triggered with notes on MIDI CH: 1
icps = p4
iamp = p5/127 ; MIDI received velocity (from 0-127), becomes devided by 127 -> amplitude-range is now 0-1
kFfreq invalue "filter_freq"
kFfreq port kFfreq, 0.05
aSrc oscili iamp, icps, 1 ; reads form f-table 1, containing a sawthooth waveform
aFiltered moogvcf aSrc, kFfreq, 0.1 ; the source signal becomes low pass filtered
aEnv madsr 0.01, 0.1, 0.9, 0.01 ; defining the envelope
gaOut = (aFiltered*aEnv) + gaOut ; the signal becomes scaled by the envelope and is added to the "g.a.Bus"
; that no information (from other sources, or simultaneous voices) which already exists on the global variable will be lost, itself needs to become added as well
endin
instr 2 ; Sine Oscillator triggered with notes on MIDI CH: 2
icps = p4
iamp = p5/127
aSrc oscili iamp, icps, 2 ; this instrument reads from f-table 2, containing a sinus waveform
aEnv madsr 0.01, 0.1, 0.9, 0.01 ; defining the envelope
gaOut = (aSrc*aEnv) + gaOut
endin
instr 101 ; Global Feedback Delay
kDryWet invalue "d_w_delay" ; receive values from the Widget Panel
kDelTime invalue "time_delay"
kFeedback invalue "feedb_delay"
aDelay delayr 1 ; a delayline, with 1 second maximum delay-time is initialised
aWet deltapi kDelTime ; data at a flexible position is read from the delayline
delayw gaOut+(aWet*kFeedback) ; the "g.a.Bus" is written to the delayline, - to get a feedbackdelay, the delaysignal (aWet) is also added, but scaled by kFeedback
gaOut = (1-kDryWet) * gaOut + (kDryWet * aWet) ; the amount of pure-signal and delayed-signal is mixed, and written to the "g.a.Bus"
endin
instr 102 ; Global Reverb
kroomsize init 0.4 ; fixed values for reverb-roomsize and damp, but you can add knobs or faders on the Widget Panel and invalue the data here...
khfdamp init 0.8
kDryWet invalue "d_w_reverb"
aWetL, aWetR freeverb gaOut, gaOut, kroomsize, khfdamp ; the freeverb opcode works with stereo input, so we read twice the "g.a.Bus"
aOutL = (1-kDryWet) * gaOut + (kDryWet * aWetL) ; the amount of pure-signal (g.a.Bus) and reverbed-signal for the left side is mixed, and written to a local variable
aOutR = (1-kDryWet) * gaOut + (kDryWet * aWetR)
outs aOutL, aOutR ; main output of the final signal
gaOut = 0.0 ; clear the global audio channel for the next k-loop
endin
f 1 0 1024 7 0 512 1 0 -1 512 0
f 2 0 1024 10 1
i 101 0 3600 ; the delay runs for one hour
i 102 0 3600 ; the reverb runs for one hour
e
; written by Alex Hofmann (Dec. 2009) - Incontri HMT-Hannover
1013279563397true1821090d_w_reverb2245831138{965ddedd-20e0-4abd-859a-dfd4ff860060}true0-30.000000001.000000000.18971100lincontinuous-1.00000000false2242113135{26d8fbb2-0a09-4332-9b18-5cc0250b8cf2}true0-3lefttop
Lucida Grande
183000255255255noborder10d_w_delay2227731138{b8bc48f2-c2b1-4687-85e7-1066b06a33c7}true0-30.000000001.000000000.07074000lincontinuous-1.00000000false2224013135{1c5ee867-4ad1-434f-a5e0-6ea3dafd89b3}true0-3lefttop
Lucida Grande
183000255255255noborder10time_delay24414720100{8dbbbd5a-8e3f-48ad-9b17-4d4ec077d56f}true0-30.050000001.000000000.35400000lincontinuous-1.00000000falsefeedb_delay31314820100{60c2bf77-6001-4508-98c7-9b589819aee1}true0-30.050000001.000000000.47750000lincontinuous-1.00000000false2351214523{db1823ae-b35e-452a-9d18-71821c7feb40}true0-3lefttop
Lucida Grande
103000255255255noborder102941215723{d7b1bce9-3493-4b44-81cb-6fe3917d3e79}true0-3lefttop
Lucida Grande
103000255255255noborder102211618435{bff2f5ef-9393-4a63-be7d-f9ba7f9e6ed9}true0-3lefttop
Noto Sans
183000255255255true11213138025{f1ea1508-3b35-40d8-8a18-b3866212a5cd}true0-3lefttop
Lucida Grande
103000255255255noborder102943153727{8e7b41c0-8c87-4bea-ad04-4b8cf886cd69}true0-3lefttop
Lucida Grande
103000255255255noborder10224948025{0e2fb652-9ae9-43f4-b61e-b22ab50a5607}true0-3lefttop
Lucida Grande
103000255255255noborder102964943725{6dbb3852-766d-478f-a270-db1249eca234}true0-3lefttop
Lucida Grande
103000255255255noborder102038118435{2c94e6b7-a8b7-4a2c-a420-a95fc5a7fd7a}true0-3lefttop
Noto Sans
183000255255255true112232506924{71d02974-0a9e-46d9-9bf5-13f597e24907}true0-3lefttop
Lucida Grande
103000255255255noborder103002516924{9805b83f-cbfb-4f90-bc8a-4fb9d0cf4bc4}true0-3lefttop
Lucida Grande
103000255255255noborder10194427325{93d0d968-20d9-4e1a-b1c0-224bf6a4f360}true0-3lefttop
Lucida Grande
103000255255255noborder1019918435{f8582472-2877-4113-8834-13da608069b8}true0-3lefttop
Noto Sans
183000255255255true11filter_freq186831138{b868baaf-46dd-40eb-8b7b-f7afa7925c6a}true0-310.000000005000.000000001919.35691300lincontinuous-1.00000000false