abs(x)
number → numberMagnitude, dropping the sign.
Arithmetic and conversion, over numbers and over signals alike.
Magnitude, dropping the sign.
Linear amplitude to decibels, the inverse of db: 1.amp is 0. The amplitude must be above zero.
Beats per minute to bars per second. The beat is the quarter note; how many of them make a bar is the project's time signature, so 120.bpm is 0.5 in 4/4 — the default tempo — and 0.667 in 3/4, where the bar is shorter.
Smallest whole number at or above x.
Detune a frequency by cents, 1/100 of a semitone: 440.cents(-14) flattens A4 slightly.
Constrain a number to lo..=hi.
Decibels to a linear amplitude: 0.db is 1, -6.db is about 0.5. Use it to write gains the way you hear them.
Largest whole number at or below x.
Frequency in hertz to MIDI note number, the inverse of m2h: 440.h2m is 69. The result may be fractional.
Base-2 logarithm. x must be above zero.
MIDI note number to frequency in hertz: 69.m2h is 440. Equal temperament, A4 = 440 Hz.
Map 0..1 onto lo..hi. Values outside 0..1 extrapolate; clamp first if you do not want that.
Transpose a MIDI note by whole octaves: 60.oct(-1) is 48.
x raised to a power: 2.pow(10) is 1024. Good for exponential curve shaping.
Nearest whole number, halves away from zero.
Snap a MIDI note to the nearest tone of a scale, given as semitone offsets within an octave: 61.scale([0, 2, 4, 5, 7, 9, 11]) is 60. Ties snap down.
Transpose a MIDI note by semitones: 60.semi(7) is 67.
Square root. x must not be negative.
Fold a number back into lo..hi, wrapping around rather than clamping. Useful for modular pitch.
19names in Math. All categories.