17
wave

modulus, a.k.a. mod, %, modulo

the modulus operator A % B gives the remainder after every whole B has been removed from A.
10 % 3 = 1
   (10 - 3 = 7)
   ( 7 - 3 = 4)
   ( 4 - 3 = 1)
   ( 1 < 3, so stop)
mod is very handy for range control. it allows you to chop up one big range into a repeating series of little ranges. when you use the % operator, say x % y, you are mapping values from the range [0, x] to the range [0, y-1]. for example, if y = 5:
x     : 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17..
x % y : 0  1  2  3  4  0  1  2  3  4  0  1  2  3  4  0  1  2..

periodic functions

ranges of values that repeat are called periodic. functions that generate repeating value ranges are called periodic functions. periodic functions are usually designed to return values in a convenient range, like [-1, 1], or [0, 1].

terminology

a graph of the values generated by a periodic function is called a waveform.

waveforms have several properties described by the following terms:

structure

for a given periodic function f(t), the following general structure outlines how to control aspects of the waveform:
result = amplitude * f( frequency * t + phaseShift );

example waveforms

square

sawtooth

triangle

pulse

sinusoid

noise

engines

the input to a periodic function is a continually increasing value, like time. so we can think of periodic functions as convenient engines—with time values as fuel, they can drive properties like position, opacity, orientation, etc.

examples:

 

noise vs. random

noise is a true waveform, a periodic function with continuity. random is not periodic or continuous.

fun with waves

some examples: