@mattgomes28 The reason I'm looking to do the math directly on samples is because it is important to me to choose oscillation frequencies whose periods are a multiple of the sample time (so there is no dithering from one period to the next).
For example, if I want to make 499Hz square wave with a duty cycle of 2%, then I cannot achieve this exactly if my sample rate is 48000Hz. (The number of samples in the period, or on samples are both not integers), and the output waveform is not perfectly the same one period to the next.
Instead of backsolving for what are "stable" frequencies and duty cycles, I'd like to just choose sample counts directly.
I am interested in generating some square waves with Pd, with pulse widths that are consistently
msamples long and periods that are
Is there a signal that provides a sample count that increases continuously, or better yet, wraps at some value? Like an inverse
phasor~(instead of counting up to
1.0at different rates, it counts at the same rate up to