Cabbage Logo
Back to Cabbage Site

Confused about kBPM chnget "HOST_BPM"

I don’t understand how I can test my code in the Cabbage editor if it relies on chnget “HOST_BPM” that needs a DAW. Is there a standard way to do this?

I could see hardcoding a value and then switching to the chnget version if a DAW is running … but I’m not sure how to do that.


Edited to add: cabbage crashes if I try to use that line of code.

I think you could hard code it like:
kBPM init 120

Or set the channel manually, like:
chnset 120, “HOST_BPM”
kBPM chnget “HOST_BPM”

but I didn’t test it.

That should do the trick. You can also check if the csd is being run in a host using the reserved channel IS_A_PLUGIN

This makes Logic crash:

kBPM init 120
kPlug chnget "IS_A_PLUGIN"
if kPlug == 1 then
    kBPM chnget "HOST_BPM"
    ;kBPM = 180

When I swap out the “chnget” for the hardcoded kBPM of 180 it is ok. What am I missing?

Can you try changing kPlug for iPlug?

Same issue. Logic just hangs on launch.

Here is the code I was using:

 ; kBPM chnget "HOST_BPM"
iBPM init 120
iPlug chnget "IS_A_PLUGIN"
if iPlug == 1 then
    iBPM chnget "HOST_BPM"
    ;iBPM = 60

iBPM should be kBPM, but that’s not the reason for the crash. Can you check which line causes the crash?

iBPM chnget "HOST_BPM"

causes the hang. If I swap it out to a fixed value, no issue.

Are you exporting as an instrument or an affect?


I’ll try this out when I get a chance and see if I can find the cause of the crash :+1: Leave it with me.

1 Like

Btw @Bryan_T, are you using a fairly recent version?

I have the current version of Logic and the public version of Cabbage. Let me know if you need more details, a .csd file, a screenshot, …

I’ll build a plug-in tonight that does nothing other than get the bpm to see if I can fully isolate the issue.

Can you check the build version from the help about menu?

I built the version that just does the chnget “HOST_BPM” step. That works with no issue. I guess it is something else that I’m doing in my program.

I’m working towards my audio looper that will take in the host bpm and the time signature information. In the current version it would be fine if those values were static. But I still need to get them from the DAW.

I’ll see if I can get the iBPM version to work.

Thanks for your help!

For completeness, I’m on Cabbage 2.9.0 and Logic 11.0.1.

When I try to actually use the iBPM value for anything in my looper program, the plugin loader locks up. This is what I see in the log:

validating Audio Unit Loobt by CabbageAudio:

AU Validation Tool
Version: 1.10.0 
Copyright 2003-2019, Apple Inc. All Rights Reserved.
Specify -h (-help) for command options

Manufacturer String: CabbageAudio
AudioUnit Name: Loobt
Component Version: 2.9.0 (0x20900)

* * PASS
Resetting csound ...
csound = 0x0x0

It just hangs there.

that’s quite an old version. can you try this one:

it’s one of the more recent dev snapshots

I installed the new version of Cabbage. I’m now at 2.9.228. Rebuilt the plugin and it still causes Logic to hang when loading it.

I’m sure I’m doing something wrong from Logic’s perspective. I’m using the iBPM value in a calculation that happens at k rates. Maybe I need to initialize iBPM to something known for a short while before assuming that the HOST_BPM can be determined? Is that something I do in the CsScore section?


Can you try exporting the HostInfo.csd that is in the Misc examples folder? you can access it from the examples menu.I just exported it now and I was able to load the AU into MainStage without any problems. I don’t have access to Logic pro to test, but afaik, the plugin manager across Logic, GarageBand and MainStage are basically the same. Apropos, what happens when you try running auval -a from the command line?