-
gusgus
Thanks for all the helpful replies and code examples. I ended up going with
[count~]
, which is already available in Purr Data. -
gusgus
@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.
-
gusgus
I am interested in generating some square waves with Pd, with pulse widths that are consistently
m
samples long and periods that aren
samples long.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 to1.0
at different rates, it counts at the same rate up ton
)