an open-source digital signal processing and sound synthesis language
about · links · contact
wrap - mod-like command


Synopsis

val = wrap(value, range)


Description

wrap returns the modulus of value, using range as the modulo; i.e. it will keep value within range by "wrapping" it around.

See also mod which apparently does the same thing.


Arguments

value, range
The parameters used to perform the "wrapping" (i.e. a mod b; in this case, value mod range) operation. Essentially wrap gives the remainder of dividing value into range. Modular (or "clock") arithmetic is very useful in western, 12-note/octave music.


Examples

   wrappedval = wrap(7, 12)

See Also

abs, log, pow, max, mod, min, round, trunc