Cabbage Logo
Back to Cabbage Site

Terrible performance

Well the good news is that I dont have to provide you with step by step, just go to example “Pad Synth” you provide with Cabbage, I just sweep fast through the octaves with the mouse mouse a couple of times and boom , audio dropouts, CPU goes to 40%.

Its not CPU Apocalypse because it does not consume the entire CPU, my OS is not slowing down or anything like that, 40% afterall is peanuts compared to when I play AAA games :smiley: but the audio dropouts are annoying obviously.

However there is another strange thing, If I select ASIO driver for my audio card , I get noise coming out of my monitors which I never experienced with any DAW. If I select MME MOTU , no noise. ASIO4ALL fails to find the card.

I also tried with my pro MOTU and standard iMac audio card, same issue

What processor do you have? My laptop is not that old, but I assume most desktops would kick its ass in terms of performance. As you can see, the PadSynth examples doesn’t present any issues for me.

you move your mouse too slow try much faster, like 10 times faster, at the speed you moving I get same peformance as well.

My computer is later 2013 27’’ iMac. So yeah its very old.Actually thanks for reminding me I will try when I get the chance to test this on my brother’s computer which is a modern one with powerful specs.

As much I would like to blame Cabbage, I don’t see why it would be a Cabbage issue in this case. I assume it does not interfere when the VST plays. Maybe a JUCE GUI problem but still I cannot see how that may be the case when I have the gui hidden and still experience the same issue.

I’ll try when I get a chance. Right now my battery is about to die and I’m travelling for the next few days so I’ll only be online with a phone. But keep me updated with anything you discover :+1:

1 Like

sure mate, If you are still on vacation have fun. If you are not, still have fun :smiley:

I will definitely investigate this.

I am also very curious to start testing with porting this directly to CSOUND API as well, I think it will be a big boost to speed. I read this morning a CSOUND journal on using wxWidgets with CSOUND via the CSOUND C API and ignited my interest again about combining QT with CSOUND.

lol just realised you wrote the article, wow you are a CSOUND veteran

hmm it seems as suspected this is a CSOUND problem , judging from this

if this dude has an issue with just a typical supersaw its no wonder I have such problems myself with even more voices (32 is basically the minimum for me after that I get audio dropouts) and he is dead wrong , 32 voices is nothing even for my 10 year old Yamaha Motif ES6 which can easily output 128 , it seems he experiences the exact same issue as I have.

Nonetheless I will keep investigating but from the looks of it CSOUND C API is my only ideal option right now.

Try writing a native Csound version outside of Cabbage to see if it also spikes with so many voices. If it does, then using the API directly won’t make any difference…

Did you get any further with this? I still can’t create the issue you are seeing, even if I play as fast as I can with the virtual MIDI keyboard.

I also went ahead and exported a simple vco2 based instrument into Reaper and stacked as many notes on top of each other as I could fit into the piano roll. I see no real issues in CPU in this way either.

I’m pretty sure my iMac at work is similarly spec-ed to yours. I will try this again there and let you know how I get on with it.

On my iMac (2013, 3.4GHz) this test drives me CPU up to 17 and if I leave it long enough I start to get dropouts…

not yet, I redesigned the synth with a more performance friendly concept but the fact you dont get any performance issues that is a big plus. Currently my synth does not work because of the redesign , as soon as I get to make sounds again I will test performance again and see what is going.

There certainly are a few performance issues on my old mac, but yeah, let’s see how it goes in your redesign. :+1:

Sorry to open an old topic but I’m interested about the results ! @kilon Any news ? As you linked above, I’m running through the same issue with ToneZ (that was the big project I talked about in my thread).

I got many many complains about how ToneZ is CPU hungry… I can see this myself too when I layer many instances and play 4 notes chords

I’ll try to play a csound only version of the example I gave, to see if this is a csound issue or cabbage issue (pretty sure it’s csound, but still, let’s try & see)

EDIT : Tested in Cabbage, LMMS (VST), Csound (native from CMD)
=> Same result : roughly 14% CPU used when I play 20 notes in my example

So it seems to be a on Csound side

I wonder if there might not be an less CPU hungry way to generate those band-limited waveforms. In his book on Computer Music Instruments Victor outlines several ways of generating band-limited waveforms using various summation formulae. He shows a generalized formula as follows:


I think this might be faster than the FFT mechanisms employed by vco2, but I’m not DSP expert. He also gives a example in python of this might be implemented.

Perhaps it’s worth investigating?

1 Like

You might also want to take a look at some code Jeannette C posted to the Csound list a while back. It generates band limited waves by limiting the number of upper harmonics depending on the current note. You can grab the code here.

Hi @Retornz. I did some more reading and I don’t think these formulae will work for sawtooth waveforms. But I did come across an article where Victor outlines how waveshaping can be used for cheap generation of sawtooth waveforms.

Try the following .csd
saw.csd (1.2 KB)
This is basically Victor’s code. It’s not quite the same as vco2 sonically, but I expect it wins hands down when it comes to performance. And if you’re super-sawing things, it might just be Ok? Please let us know if it works.

1 Like

Thanks for all the research Rory !

  • The 2 first solution (Formula + band limited waves) : it’s really interesting, not quite useful for sawtooth waveforms, but still, it’s great stuff, thanks for sharing !
  • For the Waveshaping : I tried it and I ended up with this kind of saw-ish shape, doesn’t sound that much of a saw IMO (more like a distorded sine), at least not the kind of saw I expect & like
  • Finaly, the last one is very interesting :

It’s definetly a saw (reversed saw compared to the VCO2 one)

here is VCO2 saw :

We can already notice the saw is quite rounded on the ends (doesn’t have the small peaks at the ends) so we can expect it to sound softer, like if it was low pass filtered

The Spectrum Analyser confirms, we can definetly see a rolloff at the high end of the spectrum (like a filtered saw)

Here is VCO2 saw :

So now the CPU test, playing 100 notes at the same time :

  • Test Saw : 6% CPU
  • VCO2 : 7.5% CPU
    So yeah, the Test saw is more CPU friendly !

So, even if this saw is quite interesting & cleverly made, I think it can’t replace the VCO2 saw. Even if we save like 1.5% CPU during the test, the same test with Sylenth or Spire shows like 1% CPU usage so we are still way too high !

What is quite interesting to notice is that using OSCIL, so the most simple SINE opcode, we are still around 6-8% CPU usage for 100 notes played… So that means there is something inside Csound that takes up lots of CPU.

An interesting test would be to try to make a really simple SINE synth like the example synth in JUCE, and do the same 100 notes test, to see if we are closer to Csound or to the comercial synth.

Interesting results. I just tried here and I see more or less the same thing. The more instances you have of an instrument, the more CPU seems to be used. On the other hand, if you could generate each of the source in a single instrument, the CPU usage is halved…

I should check what what happens when one uses a recursive UDO…

Here is some code Steven Yi shared with me a while back. I added a vco2 to it and changed the number of partials to 100. It runs with only about 1% CPU when it is playing full harmonics.

K-Recursion.csd (1.2 KB)

1 Like

Check out this one. It’s a supersaw type of recursive UDO I wrote for @ThesePenguins in response to a question on the forum. I can run this to 100 voices and I see very little CPU usage at all.

SuperSaw2.csd (1010 Bytes)

1 Like