|
schedule does work!
The hint from Gerard van Dongen
to reinit it was the point!
Below you find an example
of an auto-composing orc.
Peter
;====================================================================
; AUTORUN.SCO
;--------------------------------------------------------------------
f 1 0 1024 -10 1 0.5 0.1 0.2 0.3
f 0 3600 ; run for ... seconds
i 1 0 1 ; start realtime composing instrument
e
;====================================================================
; AUTORUN.ORC
;--------------------------------------------------------------------
sr = 22050
kr = 220.5
ksmps = 100
nchnls = 2
giwave = 1
;====================================================================
instr 1 ; example event generating instrument: a simple fractal loop
;--------------------------------------------------------------------
ihold ; Run forever
;
kx1 init 0 ;
kx2 init 0 ;
;
idur = 1.5 ;
ispeed = 6 ;
;
ktime phasor ispeed ; Timer for
ktrig trigger ktime, 0.5, 0 ; event generation
if (ktrig<0.5) goto noevent ;
;
kx1 = kx1 * kx1 - 1.74 ; Some simple fractal
kx2 = kx2 * kx2 - 1.7499 ; parameter generation
kamp = 0.05 + (kx2+2) / 4 * 0.9 ;
kcps = 200 + 100 * kx1 / 2 ;
;
igoto noevent ; Don't schedule
initsched: ; at first init
schedule 2, 0, idur, i(kamp), i(kcps) ;
reinit initsched ; reinit schedule
; for each event
noevent: ;
;
endin ;
;====================================================================
instr 2 ; sound generating instrument
;--------------------------------------------------------------------
kenv expon 1, 1, 0.01
kamp = 20000*p4*kenv
asig oscili kamp, p5, giwave
outs asig, asig
endin
;-------------------------------------------------------------------- |