Skip to content

Commit 59b4c9b

Browse files
committed
chore(core): trim redundant audio analysis comments
1 parent 90741e4 commit 59b4c9b

2 files changed

Lines changed: 1 addition & 10 deletions

File tree

‎packages/core/src/audioRhythm.ts‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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. */
4443
export 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. */
125123
function 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. */
151148
function 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. */
404401
const TRIPLE_METER_HANDICAP = 0.7;
405402

406-
/** The meter and bar phase whose beats carry the most bar-start evidence against the others. */
407403
function 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. */
421416
function downbeatsOf(
422417
beatList: number[],
423418
times: number[],
@@ -455,7 +450,6 @@ export const STEADY_BEAT_CONFIDENCE = 0.15;
455450
const 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. */
459453
function rhythmOf(frames: BandFrames): Rhythm {
460454
const curves = onsetCurves(frames);
461455
const { period, clarity } = beatPeriod(curves.broad, curves.fps);

‎packages/core/src/audioSections.ts‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,7 @@ function blockParts({ fps, bands, chroma, chromaFps }: BandFrames): number[][] {
5959
return blocks;
6060
}
6161

62-
/**
63-
* Timbre and harmony, weighted equally: each feature standardized over time, then the band part and the chroma part
64-
* each scaled to half the block's squared length.
65-
*/
62+
/** Timbre and harmony each contribute half the block's squared length. */
6663
function blockFeatures(frames: BandFrames): number[][] {
6764
const blocks = blockParts(frames);
6865
standardizeBands(blocks);

0 commit comments

Comments
 (0)