Ad van Ties

Just browsed over the source, in stead of hard-coding “48000”, shouldn’t it be based to the actual sample-rate choosen by the user?

float _sampleTime = 1.f/48000.f;

If you have a constant frequency sine wave and want a stable very low cpu approach the stable recurrence here https://vicanek.de/articles/QuadOsc.pdf is great

It’s easy to implement but here’s ours sst-basic-blocks/include/sst/basic-blocks/dsp/QuadratureOscillators.h at f3634226b0bc8232da59a3427cd36098c8ab2dc4 · surge-synthesizer/sst-basic-blocks · GitHub

2 Likes

It’s just the initialization. I understood it is better to initialize variables with a value. (Do correct me when I’m talking nonsense.) You can find the onSampleRateChange method, where it says osc[c].setSampleTime(APP->engine->getSampleTime()); .

Oh, interesting, thanks, @baconpaul !

You say “constant frequency”, so does that mean that you cannot do audio rate FM?

What I did, is that some computations are done less often, as @codyge suggested: the parameters concerning the amplitudes of the partials (the parameters ‘partials’, ‘tilt’ and ‘sieve’, as the CV buffer section (everything with red labels)) of the partials are processed a 1/64th of the sample rate, with a minimum of 750Hz. The pitch and the stretch parameter are processed at sample rate, so you can do audio rate FM.

If you do audio rate fm the computation advantage drops away since you need to calculate sin and tan every frequency reset

As I’ve said over and over, re sine:

  1. It’s very OS dependent. It might be ok-ish on mac, but super slow in windows.
  2. I always used simple linear interpolating lookup tables for sines and exp. It’s much faster.
  3. the SSE approximation in the VCV SDK is ok, and pretty fast. Esp if you use SSE, which you really should for something like this.

My “Basic VCO” uses that. I made a patch with 1000 sines once - it’s quite fast.

Also, as you mention, there is no need to run the seive every sample. That’s crazy. Perhaps the envelopes don’t have to run at audio rate, but, again, they shouldn’t take a ton of time, if properly implemented. Just look at how little CPU the VCV ADSR uses. Esp for 4 channels at once.

There’s lots of (I think) useful stuff about this, including code examples here

4 Likes

Hi all!

I added 3 new modules to the plugin:

  • Adje: This one was made on request from a user. Its design is based on my additive oscillator Ad, but it’s not an oscillator. Instead it generates polyphonic V/octave and amplitude CV.
  • Bufke: an expander for Adje
  • Funs: a wave shaping oscillator based on rational functions.
8 Likes