RFC: what basic waveform GEN patches for toolbox?

Mar 22, 2013 at 6:08pm

RFC: what basic waveform GEN patches for toolbox?

Hi folks

Since I did the same thing at Native Instruments before and after it introduced Core, I'd like to contribute to the patch library here with some basic waveform patches for GEN. Here is a very simple basis for generating sine, square, and ramp waveforms, based on a Reaktor design from 2003 and an MSP design from 2007. Many additions are possible: adding triangle, pwm, ramp modulation, etc, I don't know what'd be most useful, I've already built many of them experimentally, and I'm open to input. I posted this basis some time ago, and no one's suggested anything better….so I'm ready to do it)


  1. gen.jpg
Mar 22, 2013 at 7:08pm

I don’t seem to be getting anything out of your algorithm…?

– Pasted Max Patch, click to expand. –
Mar 22, 2013 at 10:02pm

Nice start! Here’s another possible future (complete with an exciting square wave production algorithm I’m sure you’ll be impressed by):

– Pasted Max Patch, click to expand. –

As with my example the waveforms you’ve posted aren’t band limited, so UNLESS you’re going to use them for FM (where crunchiness due to aliasing artifacts is a *good* thing) or LFOs, they’re not going to sound all that great. There’s a reason that software designers make a big deal about having antialiasing waveforms, and it has everything to do with how they sound (have a look at the antialiasing tab in the saw~ Max help file for more on this). The gen~ examples contains a very nice band limited sawtooth oscillator (gen~.band_limited_saw) that’s um… a little more complicated than what you and I are making. :-)

I’ve been a little surprised that oscillators aren’t more a subject of inquiry for gen~ folks. Seems like most people have the hots on for ….

Mar 23, 2013 at 4:18am

A “from scratch” non-band limited sine wave I posted a while back. Based on the block diagram on page 3 of this paper: http://www.icst.net/fileadmin/data/pdf/dsg/Digital_Sound_Generation_1.pdf

I’m still trying to find the time to learn how to implement the various band limiting methods.

– Pasted Max Patch, click to expand. –
Mar 25, 2013 at 6:55pm

That’s interesting stringtapper. It worked in my design, which I simplified for the picture, because it derived an initial value for phasor elsewhere. I think, without an initial value, the output never crosses zero, so the phasor doesn’t start. I guess there could be some other pragmatic issues. I’ll check into it.

Mar 25, 2013 at 7:20pm

Also the mathematical values weren't floating point. Yes they are floating point, and what I do is oversample and sinc filter by putting it in a poly~, which at least removes aliasing with Nyqist. For switching between the outputs without a click, the selector for waveshape output would also need to be sampled and changes set at zero crossings, which is why cos is easier than sin; and the dcblock is only helpful if the frequencies change continuously, but as they do in FM, I included it. Here is it so far: Any other feature requests?


  1. Capture.JPG
Mar 25, 2013 at 7:22pm

And yes, I agree this is the right way to do it, because the phase signal can apply phase modulation without clicks, while the frequency input sets the fundamental frequency.

Mar 25, 2013 at 11:52pm

So I got to this, with a patch. Rather than a selector, it gates the amp on zero crossovers to stop clicks on wave selection and amplitude change. In Audio setup, I think overdrive may have to be enabled for click-free operation, and it may depend on audio driver, but I don't know.


  1. wavegen1.maxpat
Mar 26, 2013 at 6:59pm

Did some optimization.With phase modulation for FM, dcblock isn’t necessary.

  1. wavegen1.maxpat
Apr 1, 2013 at 3:29pm

Very well, it is in freeze. Thank you )

Nov 6, 2013 at 8:07pm
Feb 11, 2014 at 9:50pm

very cool. how do i effectively band limit my oscillators?

Feb 11, 2014 at 10:04pm

i did not need band limiting for my application, so these are pure waveforms. I did try out minibleps and so on. I felt the built-in solution which the MSP oscillators provide is still aesthetically better and consumes far less CPU. The MSP osciallators are professionally designed, and I could go into details about why i think they are better, but that is really off topic.


You must be logged in to reply to this topic.