Cabbage Logo
Back to Cabbage Site

Send from UDO, event_i to instrument

Hi everyone, i’m new to Csound, I’m building a UDO for a project,and I can’t send the score generated from event_i inside an UDO to the instrument outside…
If anyone could shed any light it would be very much appreciated.

Can you share your code so we can take a look? Should be straightforward enough to do…

yes, I have already done some udo,
it would seem simple, but I can’t do it

`


sr = 44100
kr = 4410
ksmps = 10
nchnls = 1
0dbfs = 1

;-----------i want-put this in UDO file-------------
instr 1

event_i “i”,2, 0, 5, 0.3, 220
event_i “i”,2, 5, 5, 0.3, 343
event_i “i”,2, 10, 5, 0.3, 457

endin
;-------------end UDO --------------------------------
;-------------and this if is necessary-------------------
instr 2

a1 poscil p4,p5,1
kenv linseg 0,p30.5,1,p30.5,0

;----------------------------------------------------------

out a1*kenv
endin`

the looOsc.txt is the udo file (the estension is not .txt but .udo)

looOsc.txt (141 Bytes)
read_event_i in_udo.csd (668 Bytes)

You don’t call your UDO at all. You can do something like this:

instr 1
    looosc()
endin

Instrument 1 is already triggered to play so you only need to add an instrument block for it. Note that I use () here even though I don’t need to, both approaches are fine. It just feels odd writing looosc on its own!

Also note that ksmps = 10 overrides the kr settings; only one of these is actually needed. But it’s always best to set it to a multiple of 2. The standard Cabbage template code uses ksmps = 32 or ksmps = 64, which seems optimal for most applications. And gives good realtime performance.

Thank you, really simple, but I didn’t know how to do it, now how they work udo appears more clear to me.
and thanks for the advice on ksmps.