PeakMonitor 


A simple utility to monitor the peak output of a given audio bus (or range of consecutive buses). 


PeakMonitor uses a synth node on the server to get the peak value over the desired time frame and place that information onto control buses, which can be read by the client and displayed graphically. Your synths must occur earlier in the chain than this synth. PeakMonitor will place its synth at the tail of the root node, so everything should work, particularly if you have already created groups and are placing your synths into those groups. If you place a new synth at the tail of the root node after invoking PeakMonitor, it won't be able to hear the new synth and you won't see the results.


Usage: 


PeakMonitor.new(target, freq) 


target: the bus that should be monitored. You can specify the bus as a MixerChannel, a bus object, an integer (in which case it will assume you want a stereo bus on the default server), or a shorthand, array notation: [Index, numChannels, server, rate]. If you omit one of these, the index will be assumed to be 0 (the main audio out), numChannels will be assumed to be 2, server will be localhost, and rate will be audio (rate should always be audio).

freq: number of times per second the audio buses will be polled. The default is 2, or every half-second. 


To end monitoring, simply close the monitor window.


PeakMonitor(0); // monitor the main output, left and right channels

PeakMonitor.new; // same thing

PeakMonitor([0, 4], 4); // monitor four channels of main output, polling every quarter-second