Cabbage Logo
Back to Cabbage Site

Midi Out to a DAW, it should work... but it doesn't

Something sounds off there. Can yo try this beta:
https://dev.azure.com/rorywalsh/cabbage/_build/results?buildId=810&view=artifacts

I’d hate to lose you to M4L!!

I’d hate to lose you to M4L!!

:smiley:

Well, I’ve tried again with the nightly. At least Repaer doesn’t crash (but I’m on a different PC now, so I will double check on the other one too).
By the way I get a memory allocation failure inside the csound output window. (running as plugin inside Reaper)

image

Here you can find the VST2 synth compiled from Cabbage. Maybe it’s helpful to spot the issue: https://drive.google.com/file/d/1ug0MTHCz4DvvOpkPxpo2W26kovtCcLUj/view?usp=sharing

Does the VST still work? Even with that memory allocate failure error?

I still can’t get anything out from that (MIDI out) track.
Have you tried my version? Is it possible that Cabbage emits different dlls on different systems (excluding 32/64 bit differences)?

To be honest I’m not even sure how your example is expected to work. There isn’t any score, just an f0 which. If I’m not wrong, is only meant to keep the csound instance alive even without any score.

Are you working in windows or macos?

Windows 10, latest update

I will check on Windows tomorrow when i get a chance.

I just tried on Windows here, and it worked just as it did in OSX. I couldn’t access your plugin, but FWIW, I’ve attached a link below to the plugin I tested with. Please keep in mind that I’m not very good with Reaper, or most hosts for that matter :roll_eyes: I only ever use them to test Cabbage plugins!

https://1drv.ms/u/s!Ah4mHoWvP_GcgbQVtqyrR_TIiQw5qQ?e=5bPnkz

Your VST2 works. I can record it’s output in Reaper, and I double checked halving p5, and the result is MIDI notes with halved velocities:

The problem seems to be in the plugin generated from “my” Cabbage. Your DLL is 11.902 KB, mine is 11.857 KB. Something is missing in mine…

I try to attach my DLL again: https://drive.google.com/file/d/19knQ-uoVMQ_nBQ5OyRmYRzdhjdf-JJNY/view?usp=sharing

I think I recall that noteondur was one of the few Csound opcodes I could never get to work satisfactorily. I remember that I was able to get MIDI out to work fine using some other MIDI opcodes, but I can’t remember specifics. For some reason noteondur just didn’t quite work, can’t remember why but I think it was similar to the problem you’re describing.

Also, just because the noteoff timing isn’t affected by p3 (Csound note duration, that is the duration of the instrument containing the noteondur) that doesn’t necessarily mean that you can just set p3 to zero. It may be that the instrument needs to run for at least as long as the desired MIDI note, so that it has time to send that noteoff message (it doesn’t seem very ‘Csound-ish’ to have the noteoff MIDI message sent out from an instrument that isn’t currently instantiated). But I don’t know exactly how noteondur is supposed to work.

I just tested your plugin and it behaves the same as mine does. I’m not sure why it’s not working the same for you. You’re definitely using the latest beta from here?

Oh, this thing is getting me mad! Now it works for me too. I suspect there’s something happening inside the Reaper cache with multiple plugins generated by Cabbage.
By the way this one works fine in Cabbage (I tried with the patcher transport too) but makes Reaper crash: https://drive.google.com/file/d/1U3Sg__eHwigM67movRC2X7CRcitDdGLH/view?usp=sharing

@cybilopsin I’m trying to use noteondur2 for the reasons you mentioned. This version should make note on last beyond the event that triggered it.

Considering @cybilopsin also had issues with noteondur2, perhaps it’s best to stick with midion2, which works in the other examples. So you can try this maybe:

instr 1 
    kIsPlaying chnget "IS_PLAYING";
    kPPQPosition chnget "HOST_PPQ_POS";
    kTimeSigNum  chnget "TIME_SIG_NUM";
    kTimeSigDenom chnget "TIME_SIG_DENOM";
    kquarterNotesPerBar = kTimeSigNum *4 / kTimeSigDenom;
    klastBarPos = int(kPPQPosition/kquarterNotesPerBar)*kquarterNotesPerBar;
    kTrigger metro 1
    if kIsPlaying==1 && changed:k(klastBarPos)==1 then
        printk 1, klastBarPos;
        event "i", "MIDI_OUT", 0, 1
    endif
endin

instr MIDI_OUT
    ;MIDI note 60, vel 80, 0.5 secs duration on channel 1
    ktrig   init    1
    midion2 1, 60, 90, ktrig
    ktrig   =   0
endin 

Very like your one, but we set the duration of the MIDI note when we call the MIDI_OUT instrument using the event opcode. Also note that for now it will just write MIDI note number 60 for each note it outputs, but this can easily be changed.

I don’t know what happens with Reaper and the namings of the VSTs generated by Cabbage, by the way I was able to test several alternative codes only if I assign a different name to each version.
I will spend more time to investigate (and replicate) the issue to find what is afftecting Reaper’s cache.

Finally noteondur2 works as well as midion2.
midion2 is prabably better here, since with noteondur2 I have to make both event and noteondur2 the same duration.

I thought I also hit an issue, but I can’t recreate it. Everything works again now as expected. Strange. If you figure how to recreate the problem let me know and I can try it here :+1:

Sure, I will try to replicate it while experimenting with the development.

I think I’ve found the problem (at least one that I was able to reproduce)! If the file name is less then 8 chars Reaper crashes.

“aaaaaaa.dll” -> CRASH!
“aaaaaaaa.dll” -> OK

I can’t recreate this issue here I’m afraid :thinking: I tried with the very latest beta and I cannot reproduce the problem. Can you try this one: v2.4.2. It should report v2.4.2 when you go to the about menu item. It’s the one I tested with here on my Windows laptop and it works fine. I suspect there might have been an issue with a previous version, but I’m not sure…

I confirm that with v2.4.2 crashes seem to be gone. I could replicate the crashes with the previous beta. while with 2.4.2 all the plugin exports are loaded correctly by Reaper.

I’ve reverted to the previous beta (2.4.0) now I can’t reproduce what I’ve described in my comment. Believe me, yesterday evening I spent half an hour creating DLLs with different chars and the rule I could find was always honored. Today I have other random crashes with the previous bets (sometimes it seems when I change ksmps init value).

By the way with 2.4.2 I’m not facing crashes anymore. So, whatever the reason it seem to be fixed (hopefully!) :slight_smile: