Equations for generating waveforms with variable sample size?

cudnylon's icon

My current patch concept is to combine multislider with peek~ to draw waveforms. The size of the multislider/buffer~ is controlled by a menu so that I can have a 512-sample waveform, 64 samples, 1024 samples, etc.

I also want preset buttons so that when I press the "Sine" message with the size in menu set to 256 samples, for example, then a uzi is triggered to output 256 bangs to a counter which is sent to an expression to generate waveform values for the multislider. (similar to wolek's winmaker but for audio instead of windowing)

My issue is that I don't know where to find the equations to generate the preset waveforms. I can find equations for a set sample size but not variable. My presets will just be the standard waveforms: sine, square/pulse, triangle, and ramp/sawtooth.

cudnylon's icon

I found buffer~ writer and have figured out how to adapt the math for different sample lengths. Consider the question solved, the forum won't let me delete this thread though.