Cabbage Logo
Back to Cabbage Site

Csd not reloading on save on MacOS

hi! I’m finally digging in but I’m having some trouble setting up. Sorry if I missed anything key in that long thread!

I’m on MacOS. I’ve got the vscode extension running (figured out the whole jsSourceDir thing), and if I run Cabbage: Compile Cabbage Instrument, I can run the examples. Here I’m running the keyboard example. My midi keyboard triggers sound just fine, and tweaking the rotary knobs does update the values and affect the sound. However clicking the keys on the keyboard widget doesn’t create sound and throws an error in the console (see below)

But my main problem is that cabbage doesn’t reload/recompile when I save changes in the CSD.

I can get it to reload by manually running Cabbage: Compile cabbage instrument again, but after about 10 of those, I seem to run out of ports and have to restart VS Code.

Here is my settings.json file:

{
    "currentConfig": {
        "audio": {
            "buffer": 512,
            "driver": 0,
            "in1": 1,
            "in2": 2,
            "inputDevice": "RME-Audio: Babyface Pro (73043870)",
            "out1": 1,
            "out2": 2,
            "outputDevice": "RME-Audio: Babyface Pro (73043870)",
            "sr": 48000
        },
        "jsSourceDir": "/Users/luba/.vscode/extensions/cabbageaudio.vscabbage-1.0.23-alpha/src/",
        "midi": {
            "inChan": 0,
            "inputDevice": "KOMPLETE KONTROL S61 MK2 Port 1",
            "outChan": 0,
            "outputDevice": "off"
        }
    },
    "systemAudioMidiIOListing": {
        "audioDrivers": "CoreAudio",
        "audioInputDevices": {
            "Apple Inc.: EVO for Reaper": {
                "deviceId": 140,
                "numChannels": 16
            },
            "Apple Inc.: MacBook Pro Microphone": {
                "deviceId": 134,
                "numChannels": 1
            },
            "Apple Inc.: Worms Microphone": {
                "deviceId": 129,
                "numChannels": 1
            },
            "CalDigit, Inc.: CalDigit Thunderbolt 3 Audio": {
                "deviceId": 132,
                "numChannels": 2
            },
            "Existential Audio Inc.: BlackHole 16ch": {
                "deviceId": 133,
                "numChannels": 16
            },
            "RME-Audio: Babyface Pro (73043870)": {
                "deviceId": 136,
                "numChannels": 14
            },
            "Rogue Amoeba Software, Inc.: EVO Headphones": {
                "deviceId": 139,
                "numChannels": 2
            },
            "Rogue Amoeba Software, Inc.: EVO Mic 3/4": {
                "deviceId": 138,
                "numChannels": 2
            }
        },
        "audioOutputDevices": {
            "Apple Inc.: EVO for Reaper": {
                "deviceId": 140,
                "numChannels": 16,
                "sampleRates": [
                    44100,
                    48000,
                    88200,
                    96000,
                    176400,
                    192000
                ]
            },
            "Apple Inc.: MacBook Pro Speakers": {
                "deviceId": 135,
                "numChannels": 2,
                "sampleRates": [
                    44100,
                    48000,
                    88200,
                    96000
                ]
            },
            "CalDigit, Inc.: CalDigit Thunderbolt 3 Audio": {
                "deviceId": 131,
                "numChannels": 2,
                "sampleRates": [
                    8000,
                    11025,
                    16000,
                    22050,
                    32000,
                    44100,
                    48000,
                    88200,
                    96000
                ]
            },
            "Default Device": {
                "numChannels": 2,
                "sampleRates": [
                    32000,
                    44100,
                    48000,
                    88200,
                    96000,
                    176400,
                    192000
                ]
            },
            "Existential Audio Inc.: BlackHole 16ch": {
                "deviceId": 133,
                "numChannels": 16,
                "sampleRates": [
                    8000,
                    16000,
                    44100,
                    48000,
                    88200,
                    96000,
                    176400,
                    192000,
                    352800,
                    384000,
                    705600,
                    768000
                ]
            },
            "RME-Audio: Babyface Pro (73043870)": {
                "deviceId": 136,
                "numChannels": 14,
                "sampleRates": [
                    32000,
                    44100,
                    48000,
                    88200,
                    96000,
                    176400,
                    192000
                ]
            },
            "Rogue Amoeba Software, Inc.: EVO Headphones": {
                "deviceId": 139,
                "numChannels": 2,
                "sampleRates": [
                    44100,
                    48000,
                    88200,
                    96000,
                    176400,
                    192000
                ]
            },
            "SAM: U28E590": {
                "deviceId": 130,
                "numChannels": 2,
                "sampleRates": [
                    32000,
                    44100,
                    48000
                ]
            },
            "Sonarworks: SoundID Reference": {
                "deviceId": 137,
                "numChannels": 2,
                "sampleRates": [
                    32000,
                    44100,
                    48000,
                    88200,
                    96000,
                    176400,
                    192000
                ]
            }
        },
        "midiInputDevices": {
            "IAC Driver Daw2StreamDeck": {
                "deviceId": 1
            },
            "IAC Driver Reaper2Touchdesigner": {
                "deviceId": 2
            },
            "IAC Driver StreamDeck2Daw": {
                "deviceId": 0
            },
            "KOMPLETE KONTROL S61 MK2 Port 1": {
                "deviceId": 3
            },
            "KOMPLETE KONTROL S61 MK2 Port 2": {
                "deviceId": 4
            },
            "Komplete Kontrol DAW - 1": {
                "deviceId": 6
            },
            "USB MIDI Device": {
                "deviceId": 5
            }
        },
        "midiOutputDevices": {
            "IAC Driver Daw2StreamDeck": {
                "deviceId": 1
            },
            "IAC Driver Reaper2Touchdesigner": {
                "deviceId": 2
            },
            "IAC Driver StreamDeck2Daw": {
                "deviceId": 0
            },
            "KOMPLETE KONTROL S61 MK2 Port 1": {
                "deviceId": 3
            },
            "KOMPLETE KONTROL S61 MK2 Port 2": {
                "deviceId": 4
            },
            "Komplete Kontrol DAW - 1": {
                "deviceId": 6
            },
            "USB MIDI Device": {
                "deviceId": 5
            }
        }
    }
}

and here’s the output from the Cabbage console when I first compile:

Cabbage VERBOSE: Resetting csound ...
csound = 0x0x15b31e120Cabbage.cpp (110) setupCsound [Thread ID: 0x1f9670f40]
Cabbage VERBOSE: IPlugAPPHost::IPlugAPPHostCabbageAPP_host.cpp (42) IPlugAPPHost [Thread ID: 0x1f9670f40]
Cabbage VERBOSE: 
RtAudio Version 6.0.1CabbageAPP_host.cpp (659) ProbeAudioIO [Thread ID: 0x1f9670f40]
Cabbage VERBOSE: RtApiCore::probeDeviceInfo: system error (CoreAudio unknown error) getting sample rate info.CabbageAPP_host.cpp (1279) errorCallback [Thread ID: 0x1f9670f40]
Cabbage INFO: UnifiedCSD:  /Users/luba/Audio/Cabbage/sliceman-c3/keyboard-example.csd
Cabbage INFO: --Csound version 7.0 (double samples) Jan  7 2025[commit: 6f7dfd8d3434c9c6f8be3d02110be2fcc5613cfb]
Cabbage INFO: libsndfile-1.2.2
Cabbage INFO: sr = 48000.0,
Cabbage INFO:  kr = 1500.000,
Cabbage INFO:  ksmps = 32
Cabbage INFO: 0dBFS level = 1.0,
Cabbage INFO:  A4 tuning = 440.0
Cabbage INFO: audio buffered in 1024 sample-frame blocks
Cabbage INFO: SECTION 1:
Cabbage VERBOSE: RtApiCore::probeDeviceInfo: system error (CoreAudio unknown error) getting sample rate info.CabbageAPP_host.cpp (1279) errorCallback [Thread ID: 0x1f9670f40]
Cabbage VERBOSE: RtApiCore::probeDeviceInfo: system error (CoreAudio unknown error) getting sample rate info.CabbageAPP_host.cpp (1279) errorCallback [Thread ID: 0x1f9670f40]
Cabbage VERBOSE: Assigning called host callback function.CabbageAPP_host.cpp (136) InitProcessor [Thread ID: 0x1f9670f40]
Cabbage VERBOSE: RtApiCore::probeDeviceInfo: system error (CoreAudio unknown error) getting sample rate info.CabbageAPP_host.cpp (1279) errorCallback [Thread ID: 0x1f9670f40]
Cabbage VERBOSE: RtApiCore::probeDeviceInfo: system error (CoreAudio unknown error) getting sample rate info.CabbageAPP_host.cpp (1279) errorCallback [Thread ID: 0x1f9670f40]
Cabbage VERBOSE: RtApiCore::probeDeviceInfo: system error (CoreAudio unknown error) getting sample rate info.CabbageAPP_host.cpp (1279) errorCallback [Thread ID: 0x1f9670f40]
Cabbage VERBOSE: Attempting to start audio with the following settings:
SR: 48000
Buffer Size: 512
Input device: RME-Audio: Babyface Pro (73043870)
Number of channels: 2
Output device: RME-Audio: Babyface Pro (73043870)
Number of channels: 2CabbageAPP_host.cpp (1005) InitAudio [Thread ID: 0x1f9670f40]
Cabbage VERBOSE: Connection establishedCabbageAPP_host.cpp (302) operator() [Thread ID: 0x16db1f000]
Cabbage VERBOSE: Interface has loaded.CabbageProcessor.cpp (151) interfaceHasLoaded [Thread ID: 0x16db1f000]

and here’s the dev tools console (sorry, couldn’t think of a better way than a screenshot, let me know which parts are of most interest and I can copy paste the text)

At the bottom is what happens when I click a key on the keyboard widget. No sound plays. I wonder if this is related to the csd not reloading? This is the message:

Uncaught TypeError: vscode.postMessage is not a function
    at Cabbage.sendMidiMessageFromUI (cabbage.js:71:14)
    at MidiKeyboard.noteOn (keyboard.js:102:15)
    at MidiKeyboard.pointerDown (keyboard.js:61:12)

When I save the CSD in VS Code, nothing happens in either the Cabbage output console or the dev tools console.

Here’s what I see in dev tools when I re-compile manually:

ERR [Extension Host] Cabbage: Failed to find free port: Error: listen EADDRINUSE: address already in use :::9991
	at Server.setupListenHandle [as _listen2] (node:net:1908:16)
	at listenInCluster (node:net:1965:12)
	at Server.listen (node:net:2067:7)
	at /Users/luba/.vscode/extensions/cabbageaudio.vscabbage-1.0.23-alpha/dist/extension.js:2:57483
	at new Promise (<anonymous>)
	at u.findFreePort (/Users/luba/.vscode/extensions/cabbageaudio.vscabbage-1.0.23-alpha/dist/extension.js:2:57204)
	at /Users/luba/.vscode/extensions/cabbageaudio.vscabbage-1.0.23-alpha/dist/extension.js:2:43317

And then:

Then the rest seems to be as before.

Just to be sure, I created a new profile in VS Code and disabled all extensions except for cabbage and Csound from kunstmusik but it didn’t solve the issue.

Let me know if there’s anything you’d like me to try.

Looking forward to tinkering! Cheers

Thanks for trying this out. The first thing is the instruments don’t compile each time you save unless you configure that in your settings. I usually just map a keyboard shortcut to the compile command. It will save and update when you call it.

Those errors about Csound are suspicious. Can you try to manually adhoc sign the Csound framework?

codesign -s - /Applications/Csound/CsoundLib64.framework --timestamp --force --deep

I iust tried that keyboard instrument here, and it’s working fine for me, although I don’t have a midi keyboard to test with. Can you try restarting vscode, disable MIDI input, open the keyboard example and compile.

This is also strange because it’s implying that the frontend can’t access the vscode object - which it needs to do in order to pass data back and forth. Can you try those suggestions and let me know if you anything changes? Also, I’m curious, can you run an exported plugin in a DAW?

[update] I’m able to recreate those free port errors. :+1:

I have pushed a fix for the port issues. At least they should be freed now each time an instrument stops. The console error you see about Csound should only happen on install. When the extension installs it tries to adhoc sign the Csound library - if it can’t sign it it return a benign error. It can be ignored.

Thanks! Ok I can confirm 1.0.24 no longer has the issue with running out of ports.

Unfortunately when I export it as a vst3, Reaper doesn’t seem to see it. I tried exporting as both a synth and an effect just in case, but no luck. Here’s the file if anyone wants to test, in case it’s my reaper setup for some reason: keyboard.vst3.zip (706.0 KB)

I tried to export an AU2 plugin just to see if that would work but I got this error:

A system error occurred (ENOENT: no such file or directory, scandir '/Users/luba/.vscode/extensions/cabbageaudio.vscabbage-1.0.24-alpha/src/CabbageBundle/CabbageAUv2Synth.component')

When I looked in the folder, indeed CabbageAUv2Synth.component was missing, but CabbageAUv2Effect.component was there so I tried exporting it as an AU effect instead, but I got this error:

A system error occurred (ENOENT: no such file or directory, rename '/Users/luba/Audio/Cabbage/AU/keyboard au fx.vst3/Contents/MacOS/CabbageVST3Synth' -> '/Users/luba/Audio/Cabbage/AU/keyboard au fx.vst3/Contents/MacOS/keyboard au fx')

I’m not particularly interested in AU so no big deal, just thought I’d let you know.

On the bright side, I figured out the issue with the keyboard widget. In keyboard.js, in both noteOn() and noteOff(), this.vscode was being passed in as the first parameter of Cabbage.sendMidiMessageFromUI() but should have been the last. I updated the code and it works now:

  noteOn(keyElement) {
    const note = keyElement.dataset.note;
    if (!this.activeNotes.has(note)) {
      this.activeNotes.add(note);
      keyElement.setAttribute('fill', this.props.colour.keydown);
      console.log(`Key down: ${this.noteMap[note]}`);
      Cabbage.sendMidiMessageFromUI(0x90, this.noteMap[note], 127, this.vscode);
    }
  }

  noteOff(keyElement) {
    const note = keyElement.dataset.note;
    if (this.activeNotes.has(note)) {
      this.activeNotes.delete(note);
      keyElement.setAttribute('fill', keyElement.classList.contains('white-key') ? this.props.colour.whiteNote : this.props.colour.blackNote);
      console.log(`Key up: ${this.noteMap[note]}`);
      Cabbage.sendMidiMessageFromUI(0x80, this.noteMap[note], 0, this.vscode);
    }
  }

Oh thanks for that. you’re right, I messed that up with a recent change! I’ve updated it now. Feel free to make PRs via github if you find other issues. So are you able to now mess around with the new version in vscode, or are you still having issues there?

The AU stuff is not really ready for production yet. It’s more of a placeholder for now.

I assume you signed the vst3 before trying it in Reaper? Also, if you wish to share an instrument you will need to also share the .csd file which now gets saved to ~/Library/CabbageAudio.

Yes! I assigned the Compile command to a keyboard shortcut and am able to mess around now in vscode, thanks!

As for the VST3, I tried to codesign the .vst3 but that didn’t help.

No errors in dev tools when I export a plugin:

here’s an export of the vst3 + the resource folder from ~/Library/CabbageAudio
keyboard-test6.zip (824.9 KB)

The info.plist file looks a little screwed up. It looks like some key/value pairs are missing or not formatted correctly. Can you replace it with this text and try again? Apologies again that I can’t simply test this for you, I don’t have a Mac at work…

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CFBundleDevelopmentRegion</key>
	<string>English</string>
	<key>CFBundleExecutable</key>
	<string>keyboard-test6</string>
	<key>CFBundleGetInfoString</key>
	<string>Cabbage v1.0.0 Copyright 2020 Acme Inc</string>
	<key>CFBundleIdentifier</key>
	<string>com.CabbageAudio.vst3.Cabbage</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundleName</key>
	<string>Cabbage</string>
	<key>CFBundlePackageType</key>
	<string>BNDL</string>
	<key>CFBundleShortVersionString</key>
	<string>1.0.0</string>
	<key>CFBundleSignature</key>
	<string>Ipef</string>
	<key>CFBundleVersion</key>
	<string>1.0.0</string>
	<key>CSResourcesFileMapped</key>
	<true/>
	<key>LSMinimumSystemVersion</key>
	<string>10.11.0</string>
</dict>
</plist>

HI @flip I just tested the latest release here on my mac and I was able to export fine. Can you open this folder:
~/.vscode/extensions/cabbageaudio.vscabbage-1.0.27-alpha/src/CabbageBundle
Inside it there are two vst3 file. Can you verify that the info.plist file in your exported plugins match the one in these plugins, albeit with a few name changes. When you export from Cabbage it updates the info.plist file. In your case it looks like it’s actually screwing it up.