round
This block extends the integer calculations of Pure Data by allowing to use a rounding value of a float.
version
v1.0: built 10/05/2007 with Pd v0.40-2
[pd][pdf] interface
Input 1: a float control signal input
Output 1: an integer control signal output signal
implementation
A floor operation is performed on the value. This floored value is subtracted from the original version, which gives a value between 0 and 1. If this value is greater than or equal to 0.5, then the
int block which holds the floored value + 1 is banged, otherwise the
int block with the floored value is banged. The last
int block is just to collect signals, it's not necessary for the correct functioning of this algorithm.
1 comment:
Or, you can just add 0.5 to the incoming value, and then run that through an [int] box.
Post a Comment