# Digital Orchestra Toolbox

This “toolbox” is a collection of Max/MSP abstraction that we have found useful in the IDMIL for creating gesture processing patches for digital musical instruments. Each abstraction is accompanied by a help patch to demonstrate its use. Authors: Joseph Malloch, Stephen Sinclair, and Marlon Schumacher @ the Input Devices and Music Interaction Lab, McGill University.

Collision Detection | |

dot.alloc |
Using a shared bus, deliberate to allocate a unique identifier. |

dot.alloc2 |
Using a shared bus, deliberate to allocate a unique identifier. Peer with root index suggests identifiers to newcomers. |

Control | |

dot.for |
Outputs a sequence of incremented numbers when banged. |

dot.line |
Wrapper for the line object so it accepts trajectory lists like line~. |

dot.probgate |
A probabilistic gate with remote control. |

dot.repeat |
Repeats a message a specified number of times. |

dot.route~ |
Separates signals from max-messages. |

dot.swap |
Like the swap object, but for symbols and lists too! |

Data | |

dot.atoi |
Convert a symbol that starts with a decimal number to an integer. |

dot.bytetobits |
Converts a single decimal byte into 8 binary bits. |

dot.bitstobyte |
Converts 8 bits into a single decimal byte. |

dot.filein |
Adds dump command to the filein object. |

dot.getindex |
Retrieves indexes of coll data entries that match the query. |

dot.index |
Generates the lowest unused index (for coll storage). Argument sets maximum index. |

dot.playabsolute |
Play files recorded by dot.recordabsolute. |

dot.properties |
regexp wrapper for parsing tagged message properties expressed in the form @<label> <data>. Second outlet outputs number of backreferences. |

dot.recordabsolute |
Record an arbitrary number of datastreams with absolute timestamping. |

dot.reg |
Like “zl reg” but right outlet bangs when empty. |

dot.sparkline |
Draws a sparkline from a list or stream onto an lcd object. |

dot.typecheck |
Route input according to data type. |

dot.urn |
Generate random numbers without duplicates (like “urn”), but you can put numbers back in the pot. |

dot.xmlread |
A native-Max XML parser – no externals! |

dot.xmlwrite |
A native-Max XML parser – no externals! |

Filters | |

dot.asyncdemod~ |
Asynchrouous demodulation of baseband signal from an AM-carrier. |

dot.attackslope |
Given two thresholds, determine the slope between the points at which they are crossed in the positive direction. (i.e., attack speed) |

dot.autoscale |
Rescales signals according to auto-detected maximum and minimum values. |

dot.autoscale~ |
Automatically scale incoming signal to a defined output-range. |

dot.boundary |
Mutes, clamps, wraps, or folds a stream of numbers at a predefined minimum and/or maximum value. |

dot.cartopol3 |
Converts 3D Cartesian coordinates to polar representation. |

dot.centre |
Automatically offsets input to re-centre signal around zero, with user-definable delay, ramp time, and time grain. |

dot.change |
Just like the change object, but works for symbols and lists. |

dot.clip |
Clips a stream of numbers to a minimum, maximum, or both. |

dot.dampedenvelope |
Audio-rate envelope-generator with damping. |

dot.distance |
Finds maximum or minimum distance between a scalar and a list. |

dot.dynamicexpression |
User-definable expr-based scaling with autoscale. |

dot.extrema |
Outputs values of local maxima and minima. |

dot.fraction |
Looks at divisions of a list and outputs the highest value corresponding to nodes at 2 3 4 5 and 6 part divisions. Intended for use with dot.harmonicfilter. |

dot.fromsignal~ |
Samples a signal triggered by change. |

dot.harmonicfilter |
For damping gains in modal synthesis based on a harmonic series. Handles “string division” at 0.5, 0.3, 0.25, 0.2, 0.167 |

dot.history |
Outputs list of delayed samples: x[n], x[n-1], …, x[n-m]. |

dot.hz↔samp~ |
Converts between frequency in hz (cycles/second) and samples/cycle. |

dot.interpolate4~ |
A sort of spectral interpolation of 4 signals via magnitude and phase vector. |

dot.jab |
Detect “jabbing” gestures in acceleration data. |

dot.leakyintegrator |
An accumulator with a hole in it. The leakiness is highly customizable. |

dot.leakyintegrator2 |
Integrator with a leak… handles floating-point numbers, signed values, leak expressions. |

dot.mass-spring |
Implements a simple mass–spring-damper model. |

dot.median |
Outputs median value of a user-definable sample size. |

dot.mix4~ |
mixes four signals via XY-coordinates. |

dot.normalize |
Normalizes a list of ints or floats, or a windowed stream. |

dot.polar |
Converts x/y into amplitude and angle. Change in agle with wrap-around correction is also calculated. |

dot.poltocar3 |
Converts 3D polar coordinates to Cartesian representation. |

dot.rad→norm~ |
Scales 2pi-radians to normalized range (0-1) with optional wraparound. |

dot.region |
Outputs and centre of multiple selected areas of a list (binary). |

dot.scale~ |
MSP version of Max’s scale-object (with ‘proper’ exponent). |

dot.schmitt |
A trigger with hysteresis. |

dot.schmitt~ |
Detect triggers from envelope of a signal. |

dot.signaccum |
Accumulates positive vs. negative same-sign deltas. |

dot.slope |
Output the slope between each successive point. |

dot.smooth |
Simple sample-averaging filter. |

dot.split |
Right outlet if greater then threshold, left outlet otherwise. |

dot.thresh |
A little hack to allow thresh to work with symbols. |

dot.threshtrig |
Output a value only once after passing the threshold in the positive or negative directions. |

dot.timedextrema |
Outputs the minimum and maximum value received with the last n milliseconds. |

dot.timedsmooth |
Downsampled audio-rate averaging filter. |

dot.timedsmooth2 |
Time-windowed averaging filter in which each input sample has the same weight. |

dot.transfer |
Table-based waveshaping with customizable transfer function. |

dot.unwrap |
Assumes input is polar and lies between arg1 and arg2. Output is the shortest polar distance from the last sample. |

dot.vscale |
Just like the scale object, but for vectors. Includes clipping-feature. |

dot.windowedextrema |
Outputs the minimum and maximum value received with the last n samples. Also outputs the order of the extrema in the window. |

dot.wrap |
Simple offset with wrap-around. |

List Processing | |

dot.listinterpolate |
Interpolates/extrapolates between two lists of equal length. |

dot.listinterpolate4 |
The same for four lists. |

dot.listpipe |
Delays a stream of input like pipe, but also works for lists. |

dot.matchNth |
Outputs message if the nth item matches the argument. |

dot.matcNth |
Outputs message if the nth item address pattern matches the argument. |

dot.nth |
Works like zl nth, but can match multiple indexes. |

MIDI | |

dot.combinote |
Combines 8 input signals into a single value such that any given combination will be a unique number. |

dot.MIDIout |
Helper for quickly configuring MIDI output. |

dot.MIDIpedal~ |
Detect triggers from a MIDI-pedal through an audio-input. |

OSC | |

dot.appendaddr |
Append text to the end of the first item of a list. |

dot.OSCalias |
Shortens long OSC addresses by giving them aliases. |

dot.OSCcompress |
Simply removes spaces in OSC address strings. |

dot.OSCexpand |
Simply expands OSC address strings so that the route object can parse them. |

dot.OSCroute |
Native-max OSC parser allowing multiple OSC addresses to be dynamically added and removed. Arguments or right inlet set addresses to route. Left outlet outputs matches with index corresponding to argument order. |

dot.OSCunalias |
Restores OSC addresses that have been aliased using dot.OSCalias. |

dot.prependaddr |
Prepend text to the beginning of the first item of a list. |

Quaternions | |

dot.jit.quaternion.conjugate |
Calculate the conjugate of a quaternion stored in the planes of a jitter matrix. |

dot.jit.quaternion.inverse |
Calculate the inverse of a quaternion stored in the planes of a jitter matrix. |

dot.jit.quaternion.multiply |
Multiply two quaternions stored in the planes of a jitter matrix. |

dot.quaternion.conjugate |
Calculate the conjugate of a quaternion. |

dot.quaternion.inverse |
Calculate the inverse of a quaternion. |

dot.quaternion.multiply |
Multiply two quaternions. |

dot.quaternion.normalize |
Normalize a quaternions. |

dot.quaternion.SLERP |
Performs Spherical Linear Interpolation between two quaternions. |

dot.quaternion2axis |
Convert quaternion to axis/angle representation. |

Sensors | |

dot.fqa |
Factored Quaternion Algorithm for calculating orientation from magnetometer and accelerometer data. |

dot.orient |
Calculates absolute orientation from gravity and magnetic field vectors. |

dot.wmp |
Process the data from a Wii Motion Plus and remove gyro bias. |

Serial | |

dot.doubleSLIPdecode |
Parses double-ended SLIP-encoded data with user-defined start, end, and escape characters. |

dot.doubleSLIPencode |
Encodes data using double-ended slip-coding with user-defined start, end, and escape characters. |

dot.serial |
An abstraction containing the serial object, with menu generation and built-in polling and repeated-reading functionality. |

dot.SLIPdecode |
Parses slip-encoded data with user-defined delimiter and escape character. |

dot.SLIPencode |
Encodes data using slip-coding with user-defined delimiter and escape character. |

Statistics | |

dot.aggregate |
Calculates aggregate of a list or a windowed stream. |

dot.covariance |
Calculates covariance of two windowed streams of numbers. |

dot.ema |
Calculates the Exponential Moving Average of a stream of numbers. |

dot.emd |
Calculates the Exponential Moving Deviation of a stream of numbers. |

dot.exemplarcovariance |
Calculates covariance of a windowed stream of numbers and an example. |

dot.phase→freq~ |
Instantaneous frequency estimation from phase deltas. |

dot.sintrack~ |
Track magnitude, instantaneous phase, and instantaneous freq. of a sinusoid. |

dot.std |
Calculates the Standard Deviation of a windowed stream of numbers. |

Timing | |

dot.channelthresh |
Combines ID-tagged channels into lists using a delay threshold. Like “thresh,” but keeps channel information. |

dot.debounce |
Filters multiple messages. |

dot.randometro |
Like the “metro” object but outputs randomly within a range. |

dot.squeuedlim |
Limits the speed of messages passing through like speedlim, but queued like zl queue. |

dot.wait |
bangs when values are over-threshold for wait time. |

Log in to reply