Cabbage Logo
Back to Cabbage Site

Harvesting events using midiin opcode

Hi all (Rory …)

I managed to get a .vst output from Cabbage using a couple of the examples & loading it into Reaper & this time it worked … so I’m ‘away’ …

Whilst a lot of my csound FFT usage is not very ‘MIDI’ or realtime friendly, this could be a good opportunity non the less to create a few simple synths & ‘mock up’ instruments …

The issue i am facing really at this point is i tend to, when i occasionally route MIDI via the (somewhat flakey) IAC driver to csound running in the command line …

  • set massign 0,0

  • use midiin opcode to harvest my events & send off schedkwhen events to the target instruments … largely as this gives greatest ease & flexibility in managing release phases, & i use tiestatus & tigoto in the receiving instrument to manage the different noteon vs noteoff phases …

i am suspecting this is a little ‘incompatible’ with the method of routing MIDI into Cabbage plugins …

I guess the short Q therefore is ‘what flag / massign combination can i use to get all incoming MIDI events to a single ‘MIDI message manager’ instrument, & route to a second performance instrument from there?’, rather than have to use extratim, linsegr & all those other opcodes that i generally find a lot less flexible & kind of messy to use …

this it also it seems would be a preferred option when dealing with designs that are effectively about ‘natural decay’ etc, i.e. that effectively ignore note off events in favour of fixed p3 durations etc … sustain pedal implementations etc etc …

anyway, i attach a plain garden variety example .csd of a fairly typical looking MIDI based implementation for me, & ask simply ‘what’s the easiest way to dump this into the guts of a cabbage host without redesigning the whole thing’ …

many thanks …

simple sine example.csd (1.5 KB)

Hi Tim. Good to hear from you. Cabbage will work fine for your needs by the sounds of things. I’ve attached a Cabbafied version of your instrument. simple sine example.csd (1.7 KB)
Note that -odac won’t work with Cabbage. Cabbage will simply overwrite it and use its own audio IO callbacks. Check out the CsOptions I’ve added. These will route all MIDI information from Cabbage to Csound. After that the MIDI opcodes should work as usual. Let me know if you have any problems.

Thanks Rory …

unfortunately that doesn’t seem to work … which kind of explains the origin of my question …

no MIDI messages are getting through to the target. Or at least i can’t hear any output thereof …

just confirming i have saved as a .vst & am able to load it no problem … & the example save as .vst & load & playback of the ‘pad synth’ i made by comparison works fine … but it deals with midi to p field assignment by other means …

i read a thread discussing related issues, but a working example of this particular case seems not to be present … hopefully we can provide one as a result of getting to the bottom of this issue …

best wishes etc …

I ran that example before posting, it should work fine. Although i didn’t test it as a .vst. I can try again a little later today, or tomorrow at the latest.

No problem … absolutely no sense of urgency … this is just a periodic side issue for me, as i’m sure you are aware …

the csound part definitely works … it’s the cabbage hosting part that seems a bit finicky …

Leave it with me. It works fine when played in Cabbage. It should also work fine in a host but I’ll take a look.

Swap out the turnon opcode for a score statement, I’m using

i1 0 z

Looks like the turnon opcode isn’t working on Windows for some reason. No biggie. It’s a simple fix. Tested with Reaper on Windows and Bitwig on Linux.

OK that’s fantastic!

I have to admit that was on my list of considerations, however i was having a bit of a problem just making & testing minor adjustments to this as i was uncertain about to what extent every rewrite of the output .vsti necessitated a plugin rescan / restart of the host DAW … (if you have a general advisory in that regard i’m happy to hear it …)

I’m also finding Cabbages built in editor a bit more problematic to use than the CsoundQT text editor … some of the cursor / scrolling behaviour seems a little ‘idiosyncratic’ … hardly a deal breaker but it means i’m just trying to establish a fairly ‘non-tinkering’ workflow by writing my csound instrument first & then ‘dropping it in’, hence another reason for consistency of approach to MIDI handling …

I have also had a few odd messages pop up on export like ‘you must specify a 4 letter file suffix etc etc’ … that seems to have no effect on the resultant output however (which i can at least now confirm, & not wonder if that is a hidden source of a problem i was experiencing …)

as an aside, i did just observe however, in Cabbage studio, the GUI keyboard works fine on the instrument itself, but the keyboard across the bottom of the screen seems to not be transmitting note offs (or my instrument isn’t processing them more likely …) not sure if that is something you wish to / care to examine …

the good news from my perspective however is that this now appears to be working in Reaper … hopefully this will keep me quiet for a while & i can look into getting a few basic plugins happening …

Thank you Rory … wonderful stuff!

(ps, I’m on mac so we can confirm 3 out of 3 in this case …)

Each time you make changes to your code you will need to reinstatement the plugin. Simply reloading your Reaper sessions should be enough. And quicker than deleting and re-instantiating the plugin. Btw, once you have exported your plugin you only need to modify the associated .csd, in your case the one inside the plugin bundle. Cabbage 1 could load a .vst bundle, Cabbage 2 does have support for this yet, but will do soon.

Tell me about it. I’m stuck to using the text editor provided by the JUCE library. It’s nowhere near as smooth as the QT text editor widget. I believe the editor in Cabbage 2 is better, but it’s can’t compare to other text editor. My hands are more or less tied here. [quote=“Tim_Mortimer, post:8, topic:760”]

I have also had a few odd messages pop up on export like ‘you must specify a 4 letter file suffix etc etc’ … that seems to have no effect on the resultant output however (which i can at least now confirm, & not wonder if that is a hidden source of a problem i was experiencing …)
[/quote]

Sounds like you’re using the older version of Cabbage. Try out the latest beta for Cabbage 2.[quote=“Tim_Mortimer, post:8, topic:760”]
as an aside, i did just observe however, in Cabbage studio, the GUI keyboard works fine on the instrument itself, but the keyboard across the bottom of the screen seems to not be transmitting note offs (or my instrument isn’t processing them more likely …) not sure if that is something you wish to / care to examine …
[/quote]

Cabbage Studio was a proof of concept. It has been swallowed up by Cabbage 2. Each instrument you run is itself a plugin node in an underlying audio graph. [quote=“Tim_Mortimer, post:8, topic:760”]

the good news from my perspective however is that this now appears to be working in Reaper …
[/quote]

That’s good. Reaper is pretty solid. I know people are doing some very extraordinary things with it and Cabbage, so the are proving to be quite a good fit for each other.

Make as much noise as you like :wink: For what it’s worth, one of the next things for me to do is to build a small Cabbage lite interface that will work with any editor. Cabbage 1 could be used with any editor you liked so long as you coded the GUI yourself. Many people were happy with this arrangement and could use Sublime, Atom, WinXound or any other editor for that matter, to create their instruments. To be honest, I tended to use it this way myself, which is why the text editor in Cabbage 1 didn’t get much love!