How to generate and sense a MIDI event inside a Csound instance? E.g. if a MIDI event is generated using midion opcode in one instrument, how to detect it in another instrument using midiin opcode?
Here is a code example of what I mean/want to do but the midi events are never detected by instrument 2.
Iâm not sure this approach will work as Csound wonât pick up the newly generated MIDI event. midiin only parses incoming MIDI info as far as I know, but I could be wrong.
I was thinking about how to implement a ASCII to MIDI converter in CSound.
My plan was to detect a pressed key with sensekey opcode and then generate some MIDI event, based on its value, that could be seen in that same csound instance as if itâs comming from a ânormalâ MIDI keyboard.
But it seems that it is not that straight forward.
yes i think so, too.
midi events are somehow communication with the world outside of csound
(mostly to receive but also to send).
inside csound there are many ways to communicate:
score events as mentioned
software channels (chnset / chnget)
global variables
OSC is also possible for both, external and internal communication.
alex once did a nice example for csoundqt:
feel free to share more details of your situation, best -
joachim
âmidi events are somehow communication with the world outside of csoundâ â this is a really good sentence. It clarifies exactly that what I was missing.
âfeel free to share more details of your situationâ â there are a lot of cool midi based instruments in csound examples and I wanted for my young daughter to experiment a bit with them. Since I donât have a midi keyboard at home, I thought if I make a simple ASCII2MIDI converter she could make some noise using an old pc keyboard so she can freely channel all her energy on it
But now I know what is the problem so I will find some solution
i think all frontends offer a virtual midi keyboard. for instance in
csoundqt, click on the Show Virtual MIDI Keyboard button (or View > Show
Virtual Keyboard).
once you start your .csd (with an empy score), you can trigger events by
clicking on the virtual keyboard OR BY PUSHING KEYS on the computer
keyboard.
i think cabbage and blue have similar features.
if you want to use commandline csound on your old PC, you can trigger
instances of another instrument via sensekey, and send the key you
pressed. something like:
kKey,kDown sensekey
if changed(kDown) && kDown==1 then
schedulek(âmyInstrâ,0,1,kKey)
endif