an open-source digital signal processing and sound synthesis language
about · links · contact
PEAK/RIGHT_PEAK/LEFT_PEAK - return amplitude peak information


Synopsis

val = PEAK()
val = LEFT_PEAK()
val = RIGHT_PEAK()
val = PEAK(start, end)
val = LEFT_PEAK(start, end)
val = RIGHT_PEAK(start, end)


Description

These commands operate upon the most recently opened input soundfile by the rtinput command. PEAK returns the overall peak for both channels, RIGHT_PEAK and LEFT_PEAK return the peak amplitudes for the left (channel 0) and right (channel 1) channels, respectively. The optional start and end parameters are starting and ending times to scan the soundfile (in seconds).

These routines will attempt to read the peak amplitude(s) stored in the soundfile header. If this is not possible, then the soundfile itself will be scanned. They do not work on a real-time audio input device.


Arguments

start
The number of seconds to skip before starting the peak amplitude scan

end
The endpoint (in seconds) to stop the peak amplitude scan


Examples

   rtinput("somesoundfile")
   peakval = PEAK()

   rtinput("someothersoundfile")
   lpeakval = LEFT_PEAK(3.4, 7.8)

See Also

CHANS, DUR, SR, filechans, filedur, filepeak, filesr, rtinput