RobinSchmidt / RS-MET

Codebase for RS-MET products (Robin Schmidt's Music Engineering Tools)
Other
55 stars 6 forks source link

I need to limit triangle sharpness to 2 samples, what's the equation? #105

Open elanhickler opened 6 years ago

elanhickler commented 6 years ago

a triangle rises for 1/frequency/2 * 44100 samples

with a skew parameter, we can make one side of the triangle rise faster than the other, but we never want the triangle to rise faster than 2 samples per cycle,

at 1/4*samplerate frequency, the triangle has 4 samples per cycle, 2 samples for one slope, multiplied by the slope factor which is 0 to 1, and so at that frequency, our slope must be fully unskewed, so our sharpness is 1. So, between 0hz and 11025hz, sharpness maximum is 0 to 1.

f = 11025 sr = 44100 0 < x < 1

1 = 1/f/2 sr x x == 1

how do we solve for x given any frequency and sample rate? x is our slope maximum sharpness to achieve a minimum of 2 samples per half cycle. 1 is no skew, 0 is full skew (saw)

RobinSchmidt commented 6 years ago

i'm a bit confused. are you talking about the tri-saw waveform and want an equation for the limit of the skew-factor (between -1..+1, where 0 means triangle) as function of frequency, such that at a freq of fs/2, the skew-limit is 0?

elanhickler commented 6 years ago

sure, i was using 0 to 1 instead of-1 to +1 (where 1 is triangle), but yes.

elanhickler commented 5 years ago

no longer relevant, this will be solved in your recent antialiasing work

RobinSchmidt commented 5 years ago

yes - triangle anti-aliasing is the prototypical target case for blamps