Cabbage Logo
Back to Cabbage Site

Large performance difference between standalone player and VST

I’ve written a fairly large, complex synthesizer with Cabbage. Currently, I’m in Windows 10. When using the Cabbage standalone, I can play six-note chords with this synth with the all the resource-hungry settings on and only use about 5% of the available CPU capacity. However, when I create a VST from this instrument and load it into FL Studio 12, the performance is over an order of magnitude worse; playing it monophonically uses 80–90% of the available CPU capacity and playing two notes simultaneously pegs the CPU. In Ableton Live 9, performance is somewhat better though still worse than the standalone; playing a six-note chord uses around 35% of my available CPU capacity. For reference, I have an Intel i7-7700k.

Oh, here’s the instrument: the_river.csd (55.2 KB). There’s a bit of messiness in the UI and code (it’s not quite ready for release) but it’s quite usable. There’s some other files that go with it like the snaps file and the logo image but I figure they’re not really relevant to this.

On the Linux side, for comparison, I get comparable performance between the standalone and Renoise (but worse than in Windows, excepting FL Studio). The standalone, playing a 6-note chord with expensive settings on, uses about 55% CPU; Renoise is actually a little lighter, at 45%. This is with JACK at a sample rate of 44100hz and a buffer size of 2048 samples. As a side note, I get dropped samples when using the standalone with JACK, but it doesn’t seem directly related to performance issues, as top shows around 55% CPU utilization and Csound doesn’t complain about buffer underruns or anything like that.

I’ve seen this before. In the past I’ve improved things by taking all effects out of synths and putting them into their own instrument. I think that was recommended to me by some VST developers, but I can’t recall now for sure. All I know is it did help performance. I don’t have a Windows machine, or a Mac machine to test with now. Thanks you you guys I’m Arch Linux all the way now! But I will be able to test on Windows in a few weeks time when I get back to Ireland.

For what it’s worth, the actual low-level processing code is 100% the exact same for both version. So the problem has to lie on the side of the hosts? Or?

Thanks, that’s all good to know. I do have all the effects in their own always-on instruments that can be, just so new instances of them aren’t being spun up for each note. Interesting to know that the low-level processing code is the same—I wonder what produces the differences in performance between DAWs and OSes. Makes me wish I knew more about low-level audio development. :stuck_out_tongue: I’m studying it right now but I’m still pretty green—the programming I’ve done is mostly at a higher level so there’s a lot of new concepts for me. I really wish I could get performance as good as in the Windows standalone everywhere else. :sweat_smile:

I’ll play around with the settings in FL Studio and see if I can get it to behave a little better—it does seem strange to me that performance is so particularly bad in that environment. Maybe it has more to do with FL Studio than Cabbage.

Darn—I tried everything on this page and this page but it didn’t make any difference. The other strange thing is that performance in FL Studio is still very bad even if I turn off everything in the synth—the oscillators, the filter, all the effects, etc., which bypasses all that code. Not much is left at that point except reading the channel data from the controls, but there’s a lot of controls, which makes me wonder if there’s performance issues with that in the FL Studio ↔ Cabbage interaction.

I have to say I don’t often hear good thing about FL Studio in audio developers circles. On the other hand, lots of people love it as a platform. I had to add a few strange hacks to Cabbage to get it to work Ok in FL Studio. It seems they might play fast and loose with the VST standard. I usually find Reaper to be a good test of performance for VSTs. Live is also a little odd at times.

Note that more controls generally equals worse performance. On each k-boundary Cabbage runs through the entire list of channels to update things. So the more you have, the more time spent on updating. You could try changing the k-rate. If you can live with a larger ksmps that might help performance. Stick with power of 2 sizes.

There was some discussion here about “muting” certain channels when they are not used, but it needs some thought. I guess if a widget is invisible there is no reason why it should be constantly polled by Csound for new values?

That’s interesting—I guess it doesn’t surprise me, exactly, since FL Studio also seems kind of unstable to me. It is too bad, though, just because its piano roll and automation system are really nice and have some features I haven’t seen in other sequencers. It leaves a lot to be desired in other ways but those two aspects of it make it really nice to work with for me.

I tried out Reaper in Windows and Cabbage performance there is better than in any other DAW I’ve tried so far, comparable to the standalone. I do wonder why that is. Renoise in Windows performs similarly to Live. I’ll take a closer look at Reaper and see if it would work well enough for the project I’m taking on right now. [edit: At first I wrote “Reason” instead of “Reaper” in a fit of absentmindedness but of course that’s a totally different DAW :stuck_out_tongue_closed_eyes:]

I have ksmps set to 32; much larger than that and I start running into trouble with input lag, and sound quality suffers a bit in a few places. I have a setup in the synth where unused modules can be turned on and off to save resources, but I haven’t worked the channel reading into that yet. Right now I’m testing it with everything on though, since I want to make sure it will be functional even with all its most expensive settings enabled. I’d ultimately like to release it to the public, so I want to make sure it will just transparently work for people, unless they’re trying to do something impractical like play 20 notes at once or something.

I’d recommend setting default values for each channel, and then commenting out most of the GUI. I expect you’ll see quite a boost in performance? At least we can identify the bottleneck this way.

I’m noticing the same thing here… FL seems really bad at loading Cabbage plugins :confused:

I know, but I’m not sure what I can do. I can run Cabbage plugins in Reaper and other hosts without so much as a blip in my CPU or audio, but FL seems to do things the hard way. I’ll download the latest demo and take another look.

1 Like

I’d like to update this topic. @spinnylights, few months ago, @rorywalsh and I found that Cabbage had a special “rule” that overwrote the ksmps value to “1” when the VST detected FL studio to avoid some audio artifacts problems (which are now fixed too !)
In the latest buils, we fixed this, now you can set a bigger ksmps (for my plugin ToneZ, I set ksmps = 256) and it will no longer be overwritten.

Still, it seems that ToneZ has some CPU usage issues in FL, some users blame it for that… In my opinion it’s more related to Csound when loads of oscillators play at the same time (but it could be something else, investigations are still in progress)