| icall related opcodes can be called only one time in a instrument (and I think in schedule
too). Read carefully the manual. To allow repeated call you must use schedulewhen (but i
never tested it). Each time the value of ktrigger parameter is different than zero, a new
instance of an instrument is activated.
I have some example, but, as I have renamed the opcodes to avoid namespace pollution, they
don't work with your version. Remember me to give you these examples as soon as
DirectCsound ver.2.7 will be available (current version is 2.601). BtW It will include
some nice things.
Gabriel
Lonce LaMar Wyse wrote:
>
> Content-Length: 3768
>
> System: Maldonado's DCsound2.5, Windows95, Peavy 1600 MIDI controller
>
> I just had a chance to explore a couple of opcodes I hadn't used
> before. I have a nice little example demonstrating the assignment of
> different instruments and controllers to different MIDI channels
> including when you want to initiate an instrument from the score (eg
> global reverb), but have it respond to external MIDI events. The
> example is attached to the end of this email.
>
> But first, my scheduling problem:
>
> I was not able to get scheduling (icall, schedwhen, schedule) to do
> what I wnated - periodically trigger an instrument on every period of
> a phasor in the controlling instrument. It should be clear what I want
> from the following:
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> instr 1
> kphaseold init 1
>
> kphase phasor 1
> if kphase > kphaseold kgoto cont
> ktim instimes
> schedule 2, 0, .2 ;; icall, schedwhen, ...
> cont:
>
> kphaseold=kphase
> endin
>
> ;;;;;;;;;;;;;;;
> instr 2
>
> asig oscili 8000, 330, 1
> out asig
> endin
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> This seems like a pretty basic thing to want to do with instrument
> scheduling, but all my attempts with combinations of icall, sched and
> schedwhen in combination with different trigger times (should it be 0?
> calculated from the instr1 init time?) etc. were to no avail. Help (or
> a bug fix or a new csound feature) would be dearly appreciated.
>
> -
>
> Here is that simple working channel assignment example:
> This was testing by setting up the Peavy1600 as follows:
> Button 0 - NOTEON, use channel 1
> Slider 0 - use Channel 1
> Button 1 - NOTEON, use channel 2
> Slider 1 - use Channel 2
> Button 2 - NOTEON, use channel 3
> Slider 2 - use Channel 3
>
> ;;;;;;;;;;;;;;;;
> instr
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ; Demonstrates the use of channel-directed notes and controllers
> ; including in score-initiated instruments
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
>
>
>
> ;***** command line flags ******
> ;------- prevents buffer
> ;------- breakup on laptop no display midi in DirectX audio out buff
> -+* -m0 -d -+K0 -+X0 -b400
>
>
>
>
>
> sr = 22050
> kr = 2205
> ksmps = 10
> nchnls = 2
>
> ;;;;;;;;;;;;;;;
> ;; Send messages that come on different channels to different instruments
> ;;;;;;;;;;;;;;;
> ;;;;;;;;ch, inst
> massign 1, 1
> massign 2, 2
> massign 3, 3
>
> ;;;;;;;;;;;;;;;
> ; Controllers can be set to respond to messages on any channel,
> ; but here we set them to the same channel that their instrument
> ; was set to in massign above.
> ;;;;;;;;;;;;;;;
> ; ctrl7 is used rather than midic7 because
> ; a) it does not cause csound to crash when the isntrument is
> ; initiated from within the score (see below)
> ; b) it can assign different controllers to different channels
> ;;;;;;;;;;;;;;;
> instr 1
> ;; ch, ctrl,min,max
> knote ctrl7 1, 0, 1, 2
> afoo oscili 8000, 330*knote,1
> outs afoo, afoo
> endin
>
> instr 2
> ;; ch, ctrl,min,max
> knote ctrl7 2, 1, 1, 2
> afoo oscili 8000, 330*knote,1
> outs afoo, afoo
> endin
>
> instr 3
> ;; ch, ctrl,min,max
> knote ctrl7 3, 2, 1, 2
> afoo oscili 8000, 330*knote,1
> outs afoo, afoo
> endin
>
>
>
>
>
> f0 600
>
> f1 0 1024 10 1 ;sinwave
>
> ;;;;;;;;;;;;;;;
> ; Initiate this instrument from the score
> ;;;;;;;;;;;;;;;
> i3 0 100
>
> e
>
>
>
>
> ;------------------------------------------------------------------
> Lonce Wyse
> Kent Ridge Digital Labs Tel: +65-874-3111
> National University of Singapore Fax: +65-774-4998
> 21 Heng Mui Keng Terrace, Kent Ridge internet: lwyse@krdl.com.org
> SINGAPORE 119613 acoustic: Yo, Lonce!
>
> http://www.krdl.org.sg/People/lwyse/lwyse.html
--
Gabriel Maldonado
http://www.agora.stm.it/G.Maldonado/home2.htm
|