Cabbage Logo
Back to Cabbage Site

Cabbage macros not working in Csound orchestra

Hi everyone,

I’m having trouble with the macros in Cabbage. I’m probably just using them incorrectly. I’m on macOS Mojave. Two questions:

  1. According to the Docs, the macros defined in the Cabbage section should be able to be accessed in the Csound orchestra. However, when I test this out with the prints opcode in the orchestra I get this error:

Undefined macro: ‘$TEST_STRING’.
error: syntax error, unexpected ERROR_TOKEN, expecting NEWLINE or ‘,’ (token “$”) from file /Users/jhallen/Desktop/Csound/drums_v2_cabbage.csd (1)

Here’s an example csd. (718 Bytes)

  1. Can I define a macro in the Cabbage section that is only an integer? (e.g. #define TEST_NUMBER 123, in my example csd). Later in the Csound orchestra I try to convert this macro into a number with strtod/strtol, but I get the same “Undefined macro” error.

My goal is to set some numeric values as macros in the Cabbage section, use those macros to generate widgets in the Cabbage section, and then access those macros later in the Csound orchestra in order to set the position of those widgets. However, I can’t figure out how to make the macros do this.

Thank you,
Jason

Thanks, this looks like a bug. Leave it with me. I’ll try to get it sorted asap.

This is an issue with Csound and how it handle strings as macros. The Csound devs have pushed a fix through to their develop branch, I’m just waiting for a package to test with.

Just to update you on this issue, it is fixed in git and in the Csound sources too, but you will need to wait till the next release of Csound to test it out. Alternatively you can use one of the Csound beta releases to test, or build Csound yourself for whatever platform you are using. I know it/s not ideal, but it is always tricky when the problem is on the Csound side.

Thanks for the update, Rory! I’m glad a fix was found, and I’m happy to wait until the next release.

On the topic of updating Csound, here’s a related question. When I initially installed Cabbage it wouldn’t open because it couldn’t find the Csound library. I’m on Mac and had already installed Csound with Homebrew, so that’s probably why Cabbage didn’t know what directory to find Csound in. I tried to update the path to the Csound library in Cabbage with install_name_tool -change, but I couldn’t get it to work for reasons I don’t understand (this had worked just fine for correcting CsoundQt’s path). In the end, I resorted to installing a second instance of Csound with the Cabbage installer, and Cabbage works fine.

However, I’d rather have a single installation of Csound on my computer and have Cabbage work with that. Do you have any suggestions for how I can do this?

Thanks,
Jason

Does your homebrew build install Csound the /Library/Frameworks/Csound64Lib.framework? This is where Cabbage looks. If you put your homebrew install there it should just work fine?

Homebrew installed Csound to /usr/local/Frameworks/CsoundLib64.framework/Versions/6.0/CsoundLib64. So I tried to use install_name_tool to point Cabbage’s path there, but for some reason it doesn’t work. CsoundQt had the same problem, but install_name_tool was able to change the path to /usr/local/Frameworks/CsoundLib64.framework/Versions/6.0/CsoundLib64 just fine.

Thanks,
Jason

That should work. I’m not sure why it doesn’t. And if you just copy the framework to /Library/Frameworks does it work Ok?

Btw, does your homebrew build include all the packages in the public installer? Were you able to build all the dependencies?

When I copy the Homebrew-installed framework into /Library/Frameworks then Cabbage doesn’t work.

I had assumed the Homebrew build included the dependencies I needed, and Csound has been working just fine. However, when I compare the contents of the Homebrew-installed framework with the contents of the framework supplied in your Cabbage package (which I’m guessing is the public installer), the contents are different. There are more folders/files in the Cabbage-supplied framework.

I’m guessing that might be the source of my problem? Admittedly, I installed Csound straight from the Homebrew. I just found these instructions for installing Csound with Homebrew, so maybe I should go back and follow these instructions.

If you couldn’t tell, I’m a little out of my depth here! Learning about packages, dependencies, frameworks, libraries, etc. is a big learning curve for me. Thanks for your patience and help.

Jason

I’m not sure the homebrew build instructions for Csound still work. I did just create an automated build of Csound for OSX. You can find the installer here. Note, this is pretty minimal, but it should at least contain the latest macro fixes. It’s not very well tested, but might be handier than building yourself.