Cabbage Logo
Back to Cabbage Site

Ascii midi keyboard control

What’s up everyone.

Has anyone already mentioned how to use the computer’s keyboard for quick instrument and polyhony testing, using the computer keys’ ascii codes ?

Is it done with the sensekey opcode ?



You can click on the on-screen MIDI keyboard, and then start playing notes using your ascii keyboard. That’s about as afar as it goes. Polyphony is no problem. The sensekey opcode probably won’t work so well in this context.

Using the ascii keyboard to control Cabbage instruments for something more than basic testing is problematic. The reason is that DAWs tend to rob certain keystrokes from plugins. A classic example is space bar, which in almost all DAWs is attached to the transport controls. DAWs like reaper let you steal back keypresses through settings, but many DAWs don’t. As Cabbage is primarily a plugin framework, there is little point is trying to wrangle with DAWs on this issue. I have tried in the past, and didn’t have great results. In the end I had to give up as each DAW was different. On the other hand, most DAWs feature virtual keyboards that can be configured to behave in lots of different ways. So if the basic ascii-MIDI connection in Cabbage doesn’t live up to expectations, try the ascii-MIDI functions in your favourite DAW instead. :+1:

1 Like

Is it ok for just testing multiple keys within cabbage as to not having to export it every time and pull out my 88 key midi keyboard?

I have some utilities I have to test like : play the lowest string possible and if you release a key, the next string will be the one you released etc.; things like that.

Also, how do you go up the octaves ?
I can only hear the lowest bass notes.

You can change the bass note but I’m not sure about octaves, have you tried hold shift while playing the notes?

I tried holding down the shift while hitting the keys but there is no sound and no key lighting up whatsoever.
The highest note I can hit is E2 (82 Hz). I would have to need at least 2 notes as high or higher than E2 to be in the tuning range of a guitar, to test the sound and visuals.

I noticed chatgpt is quite adept at writing code in some languages and also providing help at solving problems.

That’s interesting. Almost true, but doesn’t give the full picture. I’ll take a look at the source and see if I can add a modifier key to play up and down octaves :+1:

1 Like

Thanks a l lot !

Right, this isn’t so simple. It seems that the MIDI component I’m using in JUCE doesn’t allow multiple ascii mappings for notes. So while I can implement a shift -> octave up, it will remove the other default keypress for that note. So for example, right now the letter a is the first note of a C major scale. And k is the C one octave above it. If I add a shift for octave the k is no longer playback, and the only way to get an octave above the base C is to press shift+a. It seems a little clunky. I’ll keep digging…

Do you think that shift+a not giving sound is due to my hardware or operating system settings as chatgpt mentioned ?
I remember I have no problems with multi-key commands in blender.

The output from ChatGPT is not right. It reads like someone trying to bluff their way through the topic. It’s due to the answer i gave previously. Shift+a is not an accepted keystroke with the JUCE midi keyboard component. I can add it, but then we lose the k key, which seems wrong. Because then we can only play 7 notes of a scale before we have to hit the shift key.

Let me know what it’s going to be.

I’m not sure this is going to change. It doesn’t look like it will be easy to add this behavior. You could reserve one midi note to toggle octaves in your instrument for testing purposes?

There are other ways to deal with this inside the code like messing with the tuning and the like.
I’ll see :+1:

Let me know if you need any help :+1:


Just went through a lot of triggers and value testing and honestly didn’t expect it taking so much time and many things not working as predicted :face_with_monocle: but I’ll get there.

Now, when i hold 2 keys the release opcode triggered by that second key seems to attach to the first key.
I was already afraid and expected somewhat for this to happen.
I really specified separate conditions so that first key’s release wouldn’t trigger on the following notes (because the release opcode page on the reference manual states the “current” note). But the problem is now the other way around.
Is there preferably the same opcode that looks at the last added note/ or using the p4 and p5 as inputs ? If not another way to work around this ?

What I would do is simply reserve a MIDI note for toggling octaves up and down. It should only ever be played alone and acts as a simple switch. If you try to use it in combination with another key, or try to create that type of functionality, you’ll end up pulling your hair out! It won’t be easy to build a bespoke MIDI parser for something like this. And if this is only for testing purposes, I would wonder whether or not it’s worth the hassle.

Sorry for the confusion,
It is another problem from the previous one. I tested it on my physical midi keyboard and then decided to do thorough testing of the code on the console.
Halfway there I stumbled again on my problem of even before that, which is to get a sign of when a specific midi note instance is held and released.
So I play one key and while holding, another.
Then, the first key should release when releasing the first key and idem for the second. Instead, the release opcode statements I set for both release on the first key releasing. Nothing happens after releasing the second key.
This gives me the impression that the release opcode is not useful for chords and arpeggio playing and anything that includes multiple notes sounding.
After reading this you may wonder why I need to have these signs. The reason is that my project is based on a guitar, on which the same note can be voiced on more than one string.
This sets it apart from a piano or keyboard types, on which a specific pitch is only possible on a specific key. But this was exactly what I’m trying to program, to play a guitar through a keyboard.

I hope this clears up my issue.