Skip to main content

analyze

analyze(
@buffer ? ## llll (required)
@descriptors ? ## llll (required)
@winstartfromzero 0
@framesize 2048
@hopsize 1024
@numframes 'auto'
@overlap 1
@wintype 'hann'
@winnormalized 1
@envattack 10
@envrelease 100
@onsetdetectionmethod 'complex'
@peaksmaxnum 100
@peaksorderby 'complex'
@peaksmagthresh 0
@peaksmaxfreq 5000
@peaksminfreq 0
@summary 3
@summaryweight 1
@summarypositive 0
@ampunit 0
@antimeunit 1
@envtimeunit 0
@frequnit 0
@pitchunit 0
@timeunit 0
@yinmaxfreq 22050
@yinminfreq 20
@yintolerance 1
@frametime 0
@bufinterp 0
) -> llll

Applies a sequence of audio analysis operations to the input buffer, via audio descriptors. These descriptors are generated through functions (e.g., see flux, dissonance, spectrum), which contain the parameters for that specific audio analysis.


Arguments

  • @buffer ? [llll]: buffer to analyze. (required)
  • @descriptors ? [llll]: list of audio descriptors. (required)
  • @winstartfromzero [int]: center first window at @framesize / 2 instead of 0. (default: 0).
    • 0: off
    • 1: on
  • @framesize [int]: analysis frame size or window size. (default: 2048).
  • @hopsize [int]: analysis hop size. (default: 1024).
  • @numframes [int/symbol]: number of analysis frames. (default: 'auto').
    • 'auto': infer from @framesize and @hopsize.
    • >0: ignores @hopsize.
  • @overlap [int]: overlap factor between analysis window size and hop size. (default: 1).
  • @wintype [int]: window type (default: 'hann').
    • 'rectangular'
    • 'triangular'
    • 'sine'
    • 'hann'
    • 'hamming'
    • 'blackman'
    • 'nuttall'
    • 'blackmannuttall'
    • 'blackmanharris'
    • 'gaussian'
    • 'sqrthann'
    • 'sqrthamming'
  • @winnormalized [int]: normalize analysis windows to have an area of 1 and then scaled by a factor of 2. (default: 1).
  • @envattack [int/float]: attack time for computing envelopes. (default: 10).
  • @envrelease [int]: release time for computing envelopes. (default: 100).
  • @onsetdetectionmethod [symbol]: onset detection method. (default: 'complex').
    • 'hfc': high frequency content.
    • 'complex': the complex-domain spectral difference function.
    • 'complex_phase': the simplified complex-domain spectral difference function taking into account phase changes, weighted by magnitude.
    • 'flux': spectral flux.
    • 'melflux': similar to spectral flux, but using half-rectified energy changes in Mel-frequency bands.
    • 'rms': difference function, measuring the half-rectified change of the RMS of the magnitude spectrum.
  • @peaksmaxnum [int]: maximum number of peaks for peaks analysis. (default: 100).
  • @peaksorderby [symbol]: ordering method of the peaks in the peaks analysis. (default: 'complex').
    • 'hfc': high frequency content.
    • 'complex': the complex-domain spectral difference function.
    • 'complex_phase': the simplified complex-domain spectral difference function taking into account phase changes, weighted by magnitude.
    • 'flux': spectral flux.
    • 'melflux': similar to spectral flux, but using half-rectified energy changes in Mel-frequency bands.
    • 'rms': difference function, measuring the half-rectified change of the RMS of the magnitude spectrum.
  • @peaksmagthresh [int/float]: magnitude threshold for the peaks analysis. (default: 0).
  • @peaksmaxfreq [int/float]: maximum frequency for the peaks analysis. (default: 5000).
  • @peaksminfreq [int/float]: minimum frequency for the peaks analysis. (default: 0).
  • @summary [int]: summarization mode, for global analyses that are computed on a frame-by-frame basis. (default: 3).
    • 0: use first frame.
    • 1: use last frame.
    • 2: use middle frame.
    • 3: average through frames.
    • 4: median through frames.
    • 5: mode through frames.
  • @summaryweight [int]: summarization weight, when @summary is 4. (default: 1).
    • 0: none.
    • 1: rms.
    • 2: loudness.
  • @summarypositive [int]: only summarize with positive values. (default: 0).
    • 0: off
    • 1: on
  • @ampunit [int]: amplitude unit. (default: 0).
    • 0: linear
    • 1: decibels
  • @antimeunit [int]: analysis time unit. (default: 1).
    • 0: milliseconds
    • 1: samples
    • 2: duration ratio
  • @envtimeunit [int]: envelope time unit. (default: 0).
    • 0: milliseconds
    • 1: samples
    • 2: duration ratio
    • 3: milliseconds difference
    • 4: samples difference
  • @frequnit [int]: frequency unit. (default: 0).
    • 0: Hertz
    • 1: BPM
    • 2: midicents
    • 3: MIDI
  • @pitchunit [int]: pitch unit. (default: 0).
    • 0: midicents
    • 1: MIDI
    • 2: Hertz
    • 3: ratio
  • @timeunit [int]: time unit. (default: 0).
    • 0: milliseconds
    • 1: samples
    • 2: duration ratio
    • 3: milliseconds difference
    • 4: samples difference
  • @yinmaxfreq [int/float]: maximum frequency for the YIN analysis. (default: 22050).
  • @yinminfreq [int/float]: minimum frequency for the YIN analysis. (default: 20).
  • @yintolerance [int/float]: tolerance for the YIN analysis. (default: 1).
  • @frametime [int]: retrieve analysis window time positions as a separate feature. (default: 0).
    • 0: off
    • 1: on
  • @bufinterp [int]: interpolation mode. (default: 0).
    • 0: no interpolation
    • 1: lower neighbor
    • 2: linear

Output

analyzed buffer [llll]


Usage

## generate one or more audio descriptors
$descriptors = (
larm()
pitchmelodia()
spectralcentroid()
);
$buffer.inspect('before analysis');
## apply analysis to buffer
$buffer = $buffer.analyze($descriptors);
$buffer.inspect('after analysis')