@@ -40,7 +40,6 @@ export interface Rhythm {
4040 downbeats : Downbeats ;
4141}
4242
43- /** Log energy per frame in log-spaced bands, `fps` frames per second, and a slower pitch-class profile. */
4443export interface BandFrames {
4544 fps : number ;
4645 bands : Float64Array [ ] ;
@@ -121,7 +120,6 @@ const PITCH_CLASS = Array.from({ length: CHROMA_SIZE / 2 }, (_, bin) => {
121120 return ( ( ( Math . round ( 12 * Math . log2 ( hz / 440 ) ) + 9 ) % 12 ) + 12 ) % 12 ;
122121} ) ;
123122
124- /** Pitch-class magnitude of every chroma frame, summed over channels. */
125123function chromaFrames ( channels : Float32Array [ ] ) : Float64Array [ ] {
126124 const window = hann ( CHROMA_SIZE ) ;
127125 const hop = ANALYSIS_RATE / CHROMA_FPS ;
@@ -147,7 +145,6 @@ function chromaFrames(channels: Float32Array[]): Float64Array[] {
147145 return frames ;
148146}
149147
150- /** Band energies and chroma of `signal`, resampled to the analysis rate first. */
151148function bandFrames ( signal : AudioSignal ) : BandFrames {
152149 const channels = signal . channels . map ( ( c ) => resample ( c , signal . sampleRate , ANALYSIS_RATE ) ) ;
153150 return {
@@ -403,7 +400,6 @@ function barStartEvidence(beats: number[], curves: OnsetCurves, frames: BandFram
403400/** Most music is in four, so three must win by a clear margin. */
404401const TRIPLE_METER_HANDICAP = 0.7 ;
405402
406- /** The meter and bar phase whose beats carry the most bar-start evidence against the others. */
407403function barPhase ( beats : number [ ] , curves : OnsetCurves , frames : BandFrames ) {
408404 const evidence = barStartEvidence ( beats , curves , frames ) ;
409405 let best = { meter : 4 , phase : 0 , contrast : - Infinity } ;
@@ -417,7 +413,6 @@ function barPhase(beats: number[], curves: OnsetCurves, frames: BandFrames) {
417413 return best ;
418414}
419415
420- /** Every `meter`th beat from the bar phase, once there are enough beats to tell one. */
421416function downbeatsOf (
422417 beatList : number [ ] ,
423418 times : number [ ] ,
@@ -455,7 +450,6 @@ export const STEADY_BEAT_CONFIDENCE = 0.15;
455450const beatConfidence = ( clarity : number , lift : number ) =>
456451 round ( Math . max ( 0 , Math . min ( 1 , clarity ) ) * Math . max ( 0 , Math . min ( 1 , lift / 3 ) ) ) ;
457452
458- /** Beats and downbeats of `frames`, a signal's band energies and chroma. */
459453function rhythmOf ( frames : BandFrames ) : Rhythm {
460454 const curves = onsetCurves ( frames ) ;
461455 const { period, clarity } = beatPeriod ( curves . broad , curves . fps ) ;
0 commit comments