MIDI does not make sound, HELP

I’m new to cabbage and have been experimenting with making midi vst plugins. Everything was working fine and then suddenly my midi stopped making sound after I closed the session and opened it again.

I did everything I could think of to solve the issue, downloaded the newest cabbage and csound, confirmed that midi worked in csound, set up the proper audio and midi status, restarted the audio device, restarted the graph, enabled auto connect to graph, checked the cabbage patch, and restarted my computer. I tested just audio and that works. When I press a key it does trigger a midi event there’s just no sound.

Any wisdom would be much appreciated thank you.
I attached some screenshots of my setup, I’m using an Arturia Minilab which confirmed works in other programs including csoundQT.

Looks like you’re not actually running the instrument or?

Try placing this in the Score-section

<CsScore>
i 1 0 [60*60*24*7]
</CsScore>

It will be triggered by the MIDI. Does it trigger any sound when you press the on-screen keyboard? Can you try one of the examples? Maybe try the Widgets/Combobox example and run it. Does it sound? I don’t have access to a MIDI device here to test.

There is no sound when I use the keyboard with mouse click or ascii but there is a midi event in all cases. @hdale94 I tried that without success. The padsynth.csd example is working. Also I’m running it on mac High Sierra 10.13.6 if that makes a difference. Also here’s my code:

form caption("Simple ADSR") size(800, 300), colour(58, 110, 182), pluginId("def1") keyboard bounds(8, 119, 778, 134)

rslider bounds(26, 30, 63, 69), text(“Gain”), channel(“gain”), range(0, 6, 1, 0.5, 0.001)
rslider bounds(128, 30, 63, 69), text(“Attack”), channel(“att”), range(0.0001, 1, 0.001, 0.5, 0.001)
rslider bounds(192, 30, 63, 69), text(“Decay”), channel(“dec”), range(0.0001, 1, 0.2, 0.5, 0.001)
rslider bounds(256, 30, 63, 69), text(“Sustain”), channel(“sus”), range(0, 1, 0.6, 0.5, 0.001)
rslider bounds(320, 30, 63, 69), text(“Release”), channel(“rel”), range(0.0001, 1, 0.4, 0.5, 0.001)

-n -d -+rtmidi=NULL -M0 /*-m0d*/ --midi-key-cps=4 --midi-velocity-amp=5 ; Initialize the global variables. ksmps = 32 nchnls = 2 0dbfs = 1

;instrument will be triggered by keyboard widget
instr 1
;get knob info
kgain chnget “gain”
katt chnget “att”
kdec chnget “dec”
ksus chnget “sus”
krel chnget “rel”

;convert k values to i values 
kEnv mxadsr i(katt), i(kdec), i(ksus), i(krel)
aOut vco2 p5, p4, 10
outs aOut*kEnv*kgain, aOut*kEnv*kgain

endin

;causes Csound to run for about 7000 years... f0 z ;i 1 0 [60*60*24*7]

Use irate variables for the adsr, i.e, iatt chnget "att"

I just tried that, still no sound

This makes sound for me with a midi-controller:

<Cabbage>
form caption("Simple ADSR") size(800, 300), colour(58, 110, 182), pluginId("def1") keyboard bounds(8, 119, 778, 134)
rslider bounds(26, 30, 63, 69), text(“Gain”), channel("gain"), range(0, 1, 1, 0.5, 0.001)
rslider bounds(128, 30, 63, 69), text(“Attack”), channel("att"), range(0.0001, 1, 0.001, 0.5, 0.001)
rslider bounds(192, 30, 63, 69), text(“Decay”), channel("dec"), range(0.0001, 1, 0.2, 0.5, 0.001)
rslider bounds(256, 30, 63, 69), text(“Sustain”), channel("sus"), range(0, 1, 0.6, 0.5, 0.001)
rslider bounds(320, 30, 63, 69), text(“Release”), channel("rel"), range(0.0001, 1, 0.4, 0.5, 0.001)
keyboard bounds(8, 158, 381, 95)
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d --midi-key-cps=4 --midi-velocity-amp=5
</CsOptions>
<CsInstruments>
; Initialize the global variables. 
ksmps = 32
nchnls = 2
0dbfs = 1

instr 1
;get knob info
kgain chnget "gain"
katt chnget "att"
kdec chnget "dec"
ksus chnget "sus"
krel chnget "rel"

;convert k values to i values 
kEnv mxadsr i(katt), i(kdec), i(ksus), i(krel)
aOut vco2 p5, p4, 10
outs (aOut*kgain)*kEnv, (aOut*kgain)*kEnv
endin
</CsInstruments>
<CsScore>
;causes Csound to run for about 7000 years...
i 1 0 [60*60*24*7]

</CsScore>
</CsoundSynthesizer>

Thank you, that worked! It’s weird though that when I changed my code to (what I think is) exactly that it didn’t work but when I copy pasted it was fine. Maybe there’s a spelling error somewhere?

Could this be it? Parantheses are important :wink:

Yeah it was that. Thank you. :pray:

I’m curious why are the parenthesis important in this case? Why does it produce no sound without them?

You’re right, seems like the paranthesis wasn’t the fix here. I think it was that rcohen commented out -m0d in the Options-section, so this warning appeared in the console window:

WARNING: instr 1 uses 5 p-fields but is given 3

Removing the comment fixed it, but I can’t seem to find any consise information here Command-line Flags (by Category) about what it actually does? Maybe someone has a explanation to this? @rory

I investigated this issue and found C-style comment in CsOptions can cause this confusion.

For example,

-n -d -+rtmidi=NULL -M0 /*-m0d*/ --midi-key-cps=4 --midi-velocity-amp=5
results in no sound, but

-n -d -+rtmidi=NULL -M0 --midi-key-cps=4 --midi-velocity-amp=5 /*-m0d*/
can generate sound.

I guess we should avoid C-style comment in the middle of effective options, though I can find no description on it in the Csound manual.

That makes a lot of sense. I must’ve uncommented that when I put the parentheses because I figured I didn’t need to view the midi events anymore. I also discovered that cmd+, disables auto-connect to the graph and I most definitely toggled that several times expecting to open settings.