Cabbage Logo
Back to Cabbage Site

How many instruments you can play at a time?

Hi,

I have problems to understand how Cabbage (or Csound) instruments play at time. I would like to play two or three instruments when I play a note but I can not.

I was convinced that what played via MIDI, activated all the “instrS” provided with appropriate opcodes (imidi an so on)

In the EXAMPLE code below, you can see “instr 1” and “instr 2”; if I comment “turnon 2”, only instr 1 midi values are printed correctly, (and even now I wonder why). But if UNcomment “turnon 2” also instrument 2 is played but the MIDI values printed is 0…

I seems that Cabbage runs only 1 instrument at time. What I not understand? Can anyone help me?

Thanks, R

Example.csd (545 Bytes)

Time for a peek at the massign opcode in Csound:

https://csound.github.io/docs/manual/massign.html

Hi,

thank’s for your quickly response!

I use a couple of massign opcode but only the instr 2 is activated…

R

Sorry, but if I change the order of massign opcode, the instrument that receive MIDI input is the last:

massign 1, 2
massign 1,1 <---- this is printed but if I invert the order:

massign 1,1
massign 1.2 <— this is printed

in any case only one instr work… I don’t understand…

R

yup. You are right. Ok, what you should do is chanin the instruments you want playing at the same time together using subinstr.

instr 100
	imidi1 = p4
	print imidi1
	aOut subinstr 200, p4
endin

instr 200 
	imidi2 = p4
	print imidi2 ; imidi = 0?
endin

subinstr will spawn instrument 200 and play it for as long as it plays. I’ve attached the full .csd
testMIDI.csd (637 Bytes)

Many thanks Rory!

I’m working about an other Organ instrument (named “Caborgan”, coming soon :wink: ) more complex respect “Additive”. This help was essential!

Many Thanks!

R