Skip to content

API reference by category

The complete public API, grouped by task. Click any function for its full signature, parameters, returns, and a link to the exact source line.

FunctionDescription
applyHannWindowApply a Hann window to an audio sample array.
blackman_windowBlackman window
buf_to_floatConvert an integer buffer to floating point values
computePeakFind the peak absolute sample value across all channels of an audio buffer.
cqtConstant-Q Transform of an audio signal.
createSpectrogramCreates a spectrogram visualization of audio over time
debugLogLog to the console only when debug logging is enabled.
f0_harmonicsCompute the energy at selected harmonics of a time-varying fundamental frequency
fftFast Fourier Transform using Cooley-Tukey algorithm (radix-2).
fft_frequenciesFFT frequencies
findDownbeatPhaseFind the true downbeat phase by analyzing onset patterns.
findKickSnareHitFind kick+snare hit (strong transient with wide frequency content)
fix_framesFix a list of frames to lie within [x_min, x_max]
frameSlice a data array into (overlapping) frames
get_windowGet window function
hamming_windowHamming window
hann_windowHann window
ifftInverse Fast Fourier Transform (complex input preserved, no component discarded).
isDebugEnabledReport whether debug logging is currently enabled.
istftInverse Short-Time Fourier Transform
magnitudeMagnitude of complex spectrum
mel_to_stftApproximate STFT magnitude from a Mel power spectrogram.
peakPickPeak picking algorithm with advanced filtering
phasePhase of complex spectrum
polar_to_complexConvert magnitude and phase to complex spectrum
powerPower spectrum
rqaRecurrence quantification analysis (RQA).
salienceCompute the harmonic salience function
setDebugEnable or disable the library’s debug logging.
spectrogramSimple spectrogram computation
stftShort-Time Fourier Transform
syncAggregate a multi-dimensional array between boundaries, synchronizing features to a set of frames.
warnIfNoMp3SupportCheck MP3 playback support and optionally show a warning banner.
yinFundamental frequency (F0) estimation using the YIN algorithm
FunctionDescription
computeRMSCompute the Root Mean Square (RMS) energy of an audio buffer.
computeZeroCrossingRateCompute the average zero-crossing rate across all channels of an audio buffer.
createRmsMeterCreate an incremental RMS meter.
delta_featuresCompute delta (first-order derivative) features
feature.chroma_stftChromagram from a waveform or power spectrogram.
feature.dctBasisRows 0..n_out-1 of the DCT-II matrix over n_in points.
feature.estimate_tuningEstimate tuning from a signal or spectrogram.
feature.foldLogSpectrumToChromaFold a time-major log-frequency spectrum into pitch classes by summing energy across octaves.
feature.logFrequencySpectrumLog-frequency spectrum by nearest-FFT-bin sampling.
feature.melspectrogramMel spectrogram from a waveform with a (y, options) API.
feature.mfccMel-frequency cepstral coefficients.
feature.mfccFromLogMelMFCC cepstral core: DCT-II along the mel axis of a log-power mel spectrogram, keeping the first coefficients.
feature.piptrackPeaksPitch tracking on a thresholded, parabolically-interpolated STFT (piptrack); returns the sparse list of detected pitch/magnitude peaks.
feature.pitch_tuningTuning offset of a set of detected frequencies relative to A440, in fractions of a chroma bin.
feature.rmsRoot-mean-square energy per frame (centered, constant-padded framing).
feature.spectral_bandwidthp’th-order spectral bandwidth per frame.
feature.spectral_centroidSpectral centroid (energy-weighted mean frequency) per frame.
feature.spectral_contrastSpectral contrast: octave-band peak-to-valley energy difference per frame.
feature.spectral_flatnessSpectral flatness (geometric mean over arithmetic mean of the power spectrum) per frame.
feature.spectral_rolloffRoll-off frequency: the lowest frequency bin whose cumulative energy reaches a given percentage of the total.
feature.zero_crossing_rateFrame-wise zero-crossing rate with edge-padded centering.
findAllZeroCrossingsCollect the indices of every zero crossing in a signal.
findZeroCrossingFind the next zero crossing at or after a given sample index.
mfcc_to_melInvert Mel-frequency cepstral coefficients to approximate a Mel power spectrogram
FunctionDescription
analyze_grooveEstimate groove and timing feel
beat_syncBeat-synchronous feature aggregation
beat_trackDynamic programming beat tracker.
beatTrackBeat tracker with tempo estimation and dynamic-programming beat selection.
calculateBeatAlignmentCalculate how well a loop length aligns with musical timing
compute_tempogramCompute tempogram using autocorrelation
detect_tempo_multiplesDetect tempo multiples and submultiples
detectBPMDetect BPM from audio.
estimate_tempoEstimate the global tempo (BPM) from a lag tempogram using tempo scoring.
extractTempoExtract tempo from beat times Useful for validation and multiple tempo detection
fastBPMDetectFast BPM detection using onset detection plus tempo estimation.
find_tempo_candidatesFind tempo candidates from tempogram
findFirstDownbeatFind the first strong downbeat in the track to help align loops to the musical phrasing.
fourier_tempogramFourier tempogram: the STFT of the onset strength envelope.
plpPredominant Local Pulse (PLP) estimation
quickTempoQUICK TIER — windowed live tempo estimate.
tempoEstimate the global tempo (BPM) with aggregate=‘mean’.
tempoBasedCompressTempo-based audio compression — PITCH-PRESERVING time stretch via the phase vocoder.
tempogramLocal autocorrelation tempogram of the onset strength envelope.
tempogram_ratioTempogram ratio features (a.k.a. spectral rhythm patterns).
FunctionDescription
bpm.analyzeTempogramAnalyze a tempogram to find its peak tempos.
bpm.analyzeWithProgressMain analysis orchestrator that yields progress as it runs.
bpm.computeFourierTempogramCompute a Fourier tempogram.
bpm.computeOnsetStrengthCompute onset strength using spectral flux.
bpm.computeSimpleFFTCompute a simple FFT.
bpm.computeSimpleSpectrumCompute a simple spectrum using a decimated FFT.
bpm.computeTempoFrequenciesConvert FFT bins to tempo frequencies.
bpm.estimateConstrainedTempoEstimate tempo within a constrained range.
bpm.estimateGlobalTempoEstimate global tempo using autocorrelation.
FunctionDescription
createFluxAnalyzerCreate an incremental spectral-flux analyzer.
onset_strengthonset_strength() — log-power-mel onset strength envelope.
onsetDetectFast spectral-flux onset detection — returns picked onset times directly.
FunctionDescription
pitchBasedCompressPitch-based audio compression — a plain linear-interpolation resample kept at the original sample rate.
pyinProbabilistic YIN (pYIN).
FunctionDescription
addLoopRegionsAdds loop region overlays to existing waveform
compareLoopsQuick loop comparison utility
createLoopBufferCreate a loopable AudioBuffer with a custom waveform, multichannel support, and export options.
defineMultipleLoopPointsDefine multiple loop points for playback.
detectLoopDetect loop points and return a real sample-range descriptor.
fastLoopAnalysisFast loop analysis — the default strategy of loop.detect().
findMusicalLoopSimple loop finder that respects musical boundaries
fullBufferLoopReturn a loop spanning the entire buffer, performing no detection (the explicit whole-buffer descriptor used by resetLoop).
loop.analyzeLoopPoints:::caution[Deprecated] Use loop.detect() instead. :::
loop.clamp01Clamp a number into [0, 1]. NaN clamps to 0.
loop.detectDetect loop points in an audio buffer.
loop.fastOnsetLoopAnalysis:::caution[Deprecated] Use loop.detect(buffer, { strategy: ‘recurrence’ }) instead. :::
loop.findPreciseLoopFind precise loop boundaries by testing actual audio repetition.
loop.loopAnalysis:::caution[Deprecated] Use loop.detect() instead. :::
loop.measureLoopConfidenceMeasure how well audio loops over [startSec, endSec), returning a confidence in [0, 1].
loop.musicalLoopAnalysisMusical boundary-aware analysis.
loop.normalizedCrossCorrelationNormalized cross-correlation (mean-subtracted, std-normalized) in [-1, 1].
loop.recurrenceLoopDetect a loop via recurrence-matrix analysis.
loop.snapToZeroCrossingsSnap loop boundaries to nearby zero crossings to avoid clicks.
loop.xaLoopAnalysis:::caution[Deprecated] Use loop.detect() instead. :::
FunctionDescription
segment.agglomerativeBottom-up temporal segmentation: partition frames into k contiguous segments; returns the left-boundary frame indices.
segment.crossSimilarityCross-similarity between a comparison sequence and a reference sequence.
segment.lagToRecurrenceConvert a lag matrix back into a recurrence matrix.
segment.laplacianSegmentationStructural segmentation of a beat/frame-synchronous feature matrix by Laplacian spectral clustering.
segment.recurrenceMatrixCompute a recurrence (self-similarity) matrix from a feature matrix.
segment.recurrenceToLagConvert a recurrence matrix into a lag matrix.
FunctionDescription
recurrence.computeChromaCompute chroma features from audio buffer
recurrence.findLoopCandidatesFind peaks in lag matrix to identify loop-lag candidates.
recurrence.framesToTimeConvert frames to time (xa-style)
recurrence.recurrenceLoopDetectionRecurrence loop detection using matrix analysis.
recurrence.recurrenceMatrixProper recurrence matrix (xa-style)
recurrence.recurrenceToLagConvert a recurrence matrix to its lag representation (xa-style).
recurrence.stackMemoryTime-delay embedding to stack chroma features.

Sequence alignment (DTW · Viterbi · RQA)

Section titled “Sequence alignment (DTW · Viterbi · RQA)”
FunctionDescription
sequence.dtwDynamic time warping between two feature sequences (or a precomputed cost matrix).
sequence.dtwBacktrackingBacktrack a warping path from a recorded step matrix.
sequence.matchEventsMatch one set of events to another (nearest neighbor with optional left/right constraints).
sequence.matchIntervalsMatch one set of time intervals to another, maximizing Jaccard similarity.
sequence.transition_cycleConstruct a cyclic transition matrix.
sequence.transition_localConstruct a localized transition matrix where each state transitions only to nearby states.
sequence.transition_loopConstruct a self-loop transition matrix.
sequence.transition_uniformConstruct a uniform transition matrix over nStates.
sequence.viterbiViterbi decoding from observation likelihoods.
sequence.viterbi_discriminativeViterbi decoding from discriminative (mutually exclusive) state posteriors.
FunctionDescription
decompose.hpssMedian-filtering harmonic/percussive source separation on a spectrogram.
decompose.nn_filterNearest-neighbor filtering (nn_filter).
decompose.optimizeEqCurvesOptimize EQ curves matching mixture fingerprints to reference vocal fingerprints — stem-guided spectral matching (supervised: requires the isolated vocal stem as target)
decompose.processAudioToFingerprintsMulti-scale spectral fingerprints — entry point of the stem-guided (supervised) matching pipeline
decompose.reconstructVocalReconstruct a vocal estimate from EQ curves learned against a reference stem (supervised — not blind separation; for that use hpss/softmask/nn_filter)
decompose.softmaskRobust soft mask M = X^power / (X^power + X_ref^power), computed with a rescale-by-max stabilization.
griffinlimGriffin-Lim algorithm for phase reconstruction
pcenPer-Channel Energy Normalization (PCEN)
FunctionDescription
effects.deemphasisDe-emphasis filter — the exact inverse of preemphasis().
effects.harmonicExtract only the harmonic component of a waveform.
effects.hpssDecompose an audio time series into harmonic and percussive components.
effects.percussiveExtract only the percussive component of a waveform.
effects.phase_vocoderPhase vocoder: time-stretch an STFT matrix by a given rate.
effects.pitch_shiftShift the pitch of a waveform by n_steps steps while preserving duration.
effects.preemphasisPre-emphasis filter that boosts high frequencies (the inverse of deemphasis()).
effects.remixRemix an audio signal by re-ordering time intervals.
effects.splitSplit an audio signal into non-silent intervals.
effects.time_stretchTime-stretch an audio series by a fixed rate while preserving pitch.
effects.trimTrim leading and trailing silence from an audio signal.
FunctionDescription
filters.chromaChroma filter bank. Projects FFT bins onto n_chroma pitch classes via Gaussian bumps.
filters.mel_filterbankCreate Mel filterbank matrix
FunctionDescription
convert.A4_to_tuningConvert reference pitch A4 frequency to tuning deviation
convert.a_weightingA-weighting of frequency
convert.amplitude_to_dbConvert amplitude to decibels
convert.b_weightingB-weighting of frequency
convert.blocks_to_framesConvert block indices to frame indices
convert.blocks_to_samplesConvert block indices to sample indices
convert.blocks_to_timeConvert block indices to time (in seconds)
convert.c_weightingC-weighting of frequency
convert.cqt_frequenciesCompute CQT (Constant-Q Transform) frequencies
convert.d_weightingD-weighting of frequency
convert.db_to_amplitudeConvert decibels to amplitude
convert.db_to_powerConvert decibels to power
convert.fft_frequenciesCompute FFT frequencies
convert.fourier_tempo_frequenciesCompute Fourier tempogram frequencies
convert.frames_to_samplesConvert frame indices to sample indices
convert.frames_to_timeConvert frame indices to time (seconds)
convert.frequency_weightingGeneral frequency weighting function (wrapper for A/B/C/D/Z weightings)
convert.hz_to_melConvert Hz to Mel scale
convert.hz_to_midiConvert Hz to MIDI note number
convert.hz_to_noteConvert Hz to note name
convert.hz_to_octsConvert Hz to octaves (relative to C0)
convert.lag_to_tempoConvert lag (in frames) to BPM
convert.mel_frequenciesCompute the mel-scale frequencies
convert.mel_to_hzConvert Mel scale to Hz
convert.midi_to_hzConvert MIDI note number to Hz
convert.midi_to_noteConvert MIDI note number to note name
convert.multi_frequency_weightingCompute multiple frequency weightings at once
convert.note_to_hzConvert note name to Hz
convert.note_to_midiConvert note name to MIDI note number
convert.octs_to_hzConvert octaves to Hz
convert.perceptual_weightingPerceptual weighting curve (approximate)
convert.power_to_dbConvert power to decibels
convert.samples_likeReturn an array of sample indices to match the time axis from a feature matrix
convert.samples_to_framesConvert audio samples to frame indices
convert.samples_to_timeConvert sample indices to time (seconds)
convert.tempo_frequenciesCompute the tempo frequencies (in BPM) corresponding to lag-tempogram bins.
convert.tempo_to_lagConvert BPM to lag (in frames)
convert.time_to_framesConvert time (seconds) to frame indices
convert.time_to_samplesConvert time (seconds) to sample indices
convert.times_likeReturn an array of time values to match the time axis from a feature matrix
convert.tuning_to_A4Convert tuning deviation to A4 reference frequency
convert.z_weightingZ-weighting (flat/no weighting) for frequency analysis
FunctionDescription
notation.fifths_to_noteCalculate the note name for a given number of perfect fifths
notation.hz_to_fjsConvert one or more frequencies (in Hz) to Functional Just System (FJS) notation
notation.hz_to_svara_cConvert frequencies (in Hz) to Carnatic svara notation within a melakarta raga
notation.hz_to_svara_hConvert frequencies (in Hz) to Hindustani svara notation
notation.interval_to_fjsConvert an interval to Functional Just System (FJS) notation
notation.key_to_degreesConstruct the diatonic scale degrees for a given key
notation.key_to_notesList all 12 chromatic note names as spelled according to a given key.
notation.list_melaList melakarta ragas by name and index
notation.list_thaatList supported thaats by name
notation.mela_to_degreesConstruct the svara indices (degrees) for a given melakarta raga
notation.mela_to_svaraSpell the Carnatic svara names for a given melakarta raga
notation.midi_to_svara_cConvert MIDI numbers to Carnatic svara within a melakarta raga
notation.midi_to_svara_hConvert MIDI numbers to Hindustani svara
notation.note_to_svara_cConvert western note names to Carnatic svara within a melakarta raga
notation.note_to_svara_hConvert western note names to Hindustani svara
notation.thaat_to_degreesConstruct the svara indices (degrees) for a given thaat
FunctionDescription
intervals.compareTuningSystemsCompare different tuning systems
intervals.generateFrequenciesQuick frequency generation utility
intervals.interval_frequenciesConstruct interval frequencies (convenience wrapper)
intervals.plimit_intervalsConstruct p-limit intervals (convenience wrapper)
intervals.pythagorean_intervalsConstruct Pythagorean intervals (convenience wrapper)
FunctionDescription
linalg.eighSymmetric eigendecomposition via cyclic Jacobi rotations.
linalg.laplacianNormalized graph Laplacian of a dense weight matrix.
FunctionDescription
cluster.kmeansK-means clustering — Lloyd’s algorithm with greedy k-means++ seeding.
FunctionDescription
analyzeWaveformCalculates waveform statistics for analysis
cmapGet a default colormap from the given data
createInteractiveRendererCreates an interactive waveform renderer with events
drawWaveformDraw waveform visualization
getStereoWaveformPeaksExtracts stereo waveform data for left and right channels
getTimebasedWaveformGenerates time-based waveform data with precise time stamps
getWaveformPeaksExtracts waveform peaks suitable for visualization
getWaveformRangeGenerates waveform data for a specific time range
harmonic_product_spectrumCompute harmonic product spectrum (HPS) for pitch detection
renderStaticSpectrumRenders static spectrum analysis of audio buffer
renderStereoWaveformRenders stereo waveform with separate channels
renderWaveformRenders waveform data to a canvas element
specshowDisplay a spectrogram/chromagram/CQT/etc on a Canvas element
waveshowVisualize a waveform in the time domain on a Canvas element
FunctionDescription
audioio.autocorrelateAutocorrelation of a signal up to a maximum lag.
audioio.chirpSynthesize a linear or exponential frequency sweep (chirp).
audioio.clicksSynthesize a click track at the given times or frames.
audioio.getDurationCompute a signal’s duration in seconds from its length and sample rate.
audioio.getSamplerateRead the sample rate of an AudioBuffer.
audioio.loadFetch and decode an audio file, with optional mono downmix, resampling, offset, and duration.
audioio.lpcBurg LPC (real‑valued) — returns LPC denominator polynomial a[0..p], a[0] == 1
audioio.muCompressmu-law compress a signal, optionally quantizing to integer codewords.
audioio.muExpandmu-law expand (decode) a companded signal back to linear amplitude.
audioio.playPlay the currently loaded audio through the Web Audio API, optionally looping.
audioio.resampleLinearly resample a signal from one sample rate to another.
audioio.stopStop the current Web Audio playback and release the source node.
audioio.toMonoDownmix multi-channel audio to a single mono channel by averaging.
audioio.toneSynthesize a pure sinusoidal tone at a given frequency.
audioio.zeroCrossingsMark the sample positions where the signal changes sign.
FunctionDescription
file.cacheGet cache management interface
file.createAudioContextCreate a new Web Audio API context with proper configuration
file.createVisualizationCreate audio visualization data
file.exampleLoad example audio file from remote source
file.exampleAudioGet audio data as Float32Array from AudioBuffer
file.exampleBufferLoad and decode audio example to AudioBuffer
file.exampleInfoGet metadata for a specific example
file.isWebAudioSupportedUtility function to check if Web Audio API is available
file.listExamplesList all available audio examples
file.saveAudioSave audio data as downloadable file
FunctionDescription
fileio.citeGet citation information for the pleco-xa library
fileio.createMediaStreamProcessorCreate a real-time audio stream processor for live input
fileio.find_filesGet a sorted list of audio files using File System Access API
fileio.streamChunked audio reader (not true streaming).
FunctionDescription
applyLiveDoubleSpeedRaise live playback to double speed in real time (crossfaded playback rate, or pitch-preserving resample).
applyLiveHalfSpeedDrop live playback to half speed in real time (crossfaded playback rate, or pitch-preserving resample).
createAudioBlobEncode an AudioBuffer’s first channel as a WAV Blob.
decodeWavDecode a WAV file into planar Float32Array channels (PCM 16/24/32-bit integer and 32-bit float).
encodeWavEncode planar channel data as an interleaved 16-bit PCM WAV file.
exportBufferAsWavExport an AudioBuffer as a .wav file.
findAudioStartFind where audible audio begins (first sample above a threshold, snapped to the nearest zero crossing).
initAudioProcessorInitialize the audio processor
loadAudioFileLoad audio file (from URL or File object)
loadFileLoad local audio file from user input
mel_to_audioInvert a mel power spectrogram to audio using Griffin-Lim
mfcc_to_audioConvert Mel-frequency cepstral coefficients to a time-domain audio signal
resetLiveSpeedReset live playback back to normal (1x) speed.
valid_audioDetermine whether a variable contains valid audio data
FunctionDescription
playback.closeGapLeftClose a detected gap by shifting the audio after it left. The normalized loop end is preserved.
playback.closeGapRightClose a detected gap by removing it and rescaling the loop end to the shorter buffer.
playback.createBufferLikeDefault pure buffer factory: an AudioBuffer-shaped object backed by Float32Array channels.
playback.detectGapDetect a gap (silence across all channels) after the loop end.
playback.doubleSpeedQuantzLoopDouble speed quantz — gapless: compress the loop content at 2x speed into half the space and re-fill.
playback.doubleSpeedUnquantzLoopDouble speed unquantz: compress the loop content at 2x speed in place (track length unchanged).
playback.halfSpeedLoopHalf speed (time stretch) a loop section. The loop region is stretched to 2x its length.
playback.halfSpeedQuantzLoopHalf speed quantz: time-stretch the loop content at half speed but mask it to the original length.
playback.revealFirstHalfReveal the first half of a half-speed-quantz’d loop (counterpart of revealHiddenHalf; toggles back).
playback.revealHiddenHalfReveal the “hidden” second half of a half-speed-quantz’d loop by replacing the loop window with it.
playback.reverseSectionReverse a sample range of a buffer without mutating the input (copy-then-reverse).

The Echoplex-inspired live-performance and glitch layer — the creative-play tier, not part of the stable analysis API. These helpers mutate loops and buffers in place for real-time performance and algorithmic sequencing; treat their signatures and behavior as experimental.

FunctionDescription
applyOperationEnhancedApply a loop operation with live responsiveness — large reverse operations run in chunks with progress callbacks.
applyQuantumOpApply a single named operation (half, double, move, reverse, reset, stutter, phase, fractal) to a buffer and loop.
buildQuantumOpListBuild an operation list by warping a random seed through vector space and injecting preset accent bars.
buildQuantumSequenceTurn an operation list into a list of executable playback steps, each applying one operation to the buffer and loop.
checkBufferSafetyValidate a buffer and loop range, reporting whether the operation is safe along with any issues and loop metrics.
doubleLoopDouble a loop descriptor’s length by extending its end, clamped to the buffer length.
executeOperationApply a single named loop operation (half, double, move, reverse, reset, stutter, fractal, phase) to a buffer and loop.
generateChaoticGenerate a chaotic sequence of loop operations driven by a logistic-map iterator.
generateFibonacciGenerate a Fibonacci-patterned sequence of loop operations.
generatePrimeRhythmGenerate a prime-number-driven rhythmic sequence of loop operations.
generateWaveformGenerate a sine-wave-modulated sequence of loop operations.
glitchBurstRun a time-boxed burst of randomized loop glitches on an internal clock; returns a stop function.
halfLoopHalve a loop descriptor, keeping the start and moving the end to the midpoint.
isLargeOperationDecide whether a loop operation counts as large (long loop, high buffer share, or long file) and warrants chunked processing.
moveForwardAdvance a loop descriptor forward by a number of samples, clamped so it never runs past the buffer end.
playQuantumOpsPlay a quantum operation sequence with adaptive, oscillating per-operation timing.
randomLocalApply a short random burst of loop operations to the current loop and return the result.
randomPresetReturn a randomly chosen preset beat pattern (an eight-step operation bar) for injection into a sequence.
randomSequenceBuild a randomized sequence of loop-manipulation steps (move, half, double, reverse, reset) for live playback.
resetLoopReset a loop descriptor to span the entire buffer.
reverseBufferSectionReverse a sample range of a buffer in place (mutates the buffer).
signatureDemoBuild the library’s fixed signature demo — narrow, move, reverse, grow, and finish — as a list of playable steps.
startBeatGlitchStart a beat-synchronized glitch that fires random loop operations once per detected bar; returns a stop function.