Cabbage Logo
Back to Cabbage Site

ASCII to MIDI

Hello there! I’m new to Cabbage and I was wondering if it is possible to send ASCII values as MIDI, example, send the letter “r” to a channel, so it can be interpreted to do something.

Greetings,
Slobodan

You can send text using the text editor widget. Then use that to trigger MIDI events, but if a little clunky. However, most DAWs do this out of the box?

Yes, but I don’t think you can program in DAWs, as long as I know. The text editor I have to erase every time I would like to send something different. So, Is there like keyboard MIDI Channel? Idk, maybe I’m not explaining so well. What I’m planning to do in a simple example is:

ON Open Plugin -> Press key “c” to Change type of Oscillator. (without using any widget, is there any MIDI channel for this)

Thank you.

I understand what you’re getting at, but I’m not sure this is possible. Perhaps some hosts allow mapping of ASCII characters to MID? The problem is that even if you could do this with a Cabbage plugin, as soon as you closed the plugin editor window it would no longer work, as the plugin would no longer be grabbing keystrokes. I think this is something that needs to be done at the DAW top level. Alternatively, you could run another Csound or Pd in the background and have it send MIDI messages to whatever DAW you have running? Seems like overkill, but it would probably work.

1 Like

Good to know. Thank you!

@rorywalsh I found this LINK that I was reading, about the midi inputs and ASCII values, and I notice that in Cabbage you have to use -"+rtmidi=NULL" instead of “-+rtmidi=virtual”. It is possible to receive MIDI inputs as that link says in Cabbage?

Greetings!

Of course. All midi messages are automatically sent to Cabbage. You can interpret them using any of Csound’s midi opcodes. The use of NULL in the CsOptions midi flag is to stop Csound from trying to open any midi devices, which might cause problems with host applications.

1 Like

Cool, so is possibly to send “z”, that has a MIDI value of “60”, and read it to achieve something? (This values are in the table of the link)
Like to change volume? If it is possible, how? I did my own research and I tried multiple things that didn’t work out.

Ah, no, hold on, you’re talking about the keyboard mapping that comes with the virtual MIDI keyboard in Csound. I’m afraid that won’t work here. Using the virtual MIDI keyboard and Cabbage is not advised. Sorry, I misunderstood your message.

Using the virtual MIDI keyboard and Cabbage is not advised.

Do you mean Csound’s MIDI keyboard and Cabbage?

… keyboard mapping that comes with the virtual MIDI keyboard in Csound.

I didn’t mean to use the Csound’s virtual keyboard, or in order to send values (like “z” as I mentioned before), you have to use that virtual keyboard?

Anyways, I have another question-related. When I use Cabbage’s virtual keyboard, I can play it by pressing the Keyboard, but usually in low octaves.

It is possible to change to higher octave without coding?
It is possible to know the keys assign to the virtual keyboard?
Is there a table in Cabbage that associates each keyboard Key to a MIDI Value? (EXAMPLE)

Yes. Using the FLTK graphics system together with Cabbage can cause unexpected results.

Yes. Use keypressbassoctave()

They are the top two rows of a sand QWERTY keyboard. a is C, w, C#, s, D, etc.

No table, but it’s pretty intuitive once you know it’s the top two rows of keys. Note that for this method of playing notes to work, the keyboard widget must have focus. If you close the instrument GUI, or interact with another widget, the keyboard will lose focus.

1 Like

Super, thank you.

@rorywalsh I found the opcode “sensekey”, it is possible to use it in Cabbage?

This will only work from the command line, so that rules it out for any GUI applications l think. You can try, but I don’t think it will work.