detect
detect(
buffer,options?):Promise<any>
Defined in: packages/pleco-xa/src/loop/detect.js:65
Detect loop points in an audio buffer.
Parameters
Section titled “Parameters”buffer
Section titled “buffer”any
AudioBuffer or shim exposing { getChannelData(i), sampleRate, length, duration }
options?
Section titled “options?”number
tempo hint for ‘precise’/‘musical’ (detected via beat tracking when omitted)
hopLength?
Section titled “hopLength?”number
‘recurrence’: chroma hop length
maxFrames?
Section titled “maxFrames?”number
‘recurrence’: frame cap (matrix cost is frames²)
maxLoopDuration?
Section titled “maxLoopDuration?”number
‘precise’: maximum loop length in seconds
minConfidence?
Section titled “minConfidence?”number
‘recurrence’: quality gate (audio-validated NCC)
minLoopDuration?
Section titled “minLoopDuration?”number
‘precise’: minimum loop length in seconds
boolean
‘recurrence’: add an RQA-path-derived candidate
searchEnd?
Section titled “searchEnd?”number
‘precise’: fraction (0..1) of the material to search
searchStart?
Section titled “searchStart?”number
‘precise’: seconds to skip at the head of the material before searching
snapToZero?
Section titled “snapToZero?”boolean
‘recurrence’: trim boundaries to zero crossings
strategy?
Section titled “strategy?”"fast" | "precise" | "musical" | "recurrence"
Returns
Section titled “Returns”Promise<any>
{ strategy, loopStart, loopEnd, loopStartSample, loopEndSample, confidence (0..1), bpm?, details }
Throws
Section titled “Throws”on invalid input, unknown strategy, or a failed quality gate (diagnostic message names the gate and suggests alternatives)