@octoseq/mir 0.1.0-main.4ecb074 → 0.1.0-main.5fdb072
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-HF3QHCRK.js +3234 -0
- package/dist/chunk-HF3QHCRK.js.map +1 -0
- package/dist/index.d.ts +2122 -47
- package/dist/index.js +3524 -39
- package/dist/index.js.map +1 -1
- package/dist/runMir-CnJQbBr8.d.ts +187 -0
- package/dist/runner/runMir.d.ts +2 -2
- package/dist/runner/runMir.js +1 -1
- package/dist/runner/workerProtocol.d.ts +8 -1
- package/dist/runner/workerProtocol.js.map +1 -1
- package/dist/types-DqH4umN8.d.ts +761 -0
- package/package.json +2 -2
- package/src/dsp/activity.ts +544 -0
- package/src/dsp/bandCqt.ts +662 -0
- package/src/dsp/bandEvents.ts +351 -0
- package/src/dsp/bandMask.ts +225 -0
- package/src/dsp/bandMir.ts +524 -0
- package/src/dsp/bandProposal.ts +552 -0
- package/src/dsp/beatCandidates.ts +299 -0
- package/src/dsp/cqt.ts +386 -0
- package/src/dsp/cqtSignals.ts +462 -0
- package/src/dsp/customSignalReduction.ts +841 -0
- package/src/dsp/eventToSignal.ts +531 -0
- package/src/dsp/frequencyBand.ts +956 -0
- package/src/dsp/mel.ts +56 -3
- package/src/dsp/musicalTime.ts +240 -0
- package/src/dsp/onset.ts +296 -30
- package/src/dsp/peakPicking.ts +519 -0
- package/src/dsp/phaseAlignment.ts +153 -0
- package/src/dsp/pitch.ts +289 -0
- package/src/dsp/resample.ts +44 -0
- package/src/dsp/signalTransforms.ts +660 -0
- package/src/dsp/silenceGating.ts +511 -0
- package/src/dsp/spectral.ts +124 -4
- package/src/dsp/tempoHypotheses.ts +395 -0
- package/src/gpu/bufferPool.ts +266 -0
- package/src/gpu/context.ts +30 -6
- package/src/gpu/helpers.ts +85 -0
- package/src/gpu/melProject.ts +83 -0
- package/src/index.ts +366 -5
- package/src/runner/runMir.ts +234 -2
- package/src/runner/workerProtocol.ts +9 -1
- package/src/types.ts +768 -3
- package/dist/chunk-DUWYCAVG.js +0 -1525
- package/dist/chunk-DUWYCAVG.js.map +0 -1
- package/dist/runMir-CSIBwNZ3.d.ts +0 -84
- package/dist/types-BE3py4fZ.d.ts +0 -83
package/src/gpu/helpers.ts
CHANGED
|
@@ -18,6 +18,15 @@ export function byteSizeF32(n: number): number {
|
|
|
18
18
|
return n * 4;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Metadata for pooled buffers to track their properties for release.
|
|
23
|
+
*/
|
|
24
|
+
export interface PooledBuffer {
|
|
25
|
+
buffer: GPUBuffer;
|
|
26
|
+
size: number;
|
|
27
|
+
usage: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
21
30
|
export function createAndWriteStorageBuffer(gpu: MirGPU, data: Float32Array): GPUBuffer {
|
|
22
31
|
const buf = gpu.device.createBuffer({
|
|
23
32
|
size: byteSizeF32(data.length),
|
|
@@ -85,3 +94,79 @@ export async function submitAndReadback(
|
|
|
85
94
|
},
|
|
86
95
|
};
|
|
87
96
|
}
|
|
97
|
+
|
|
98
|
+
// ============================================================================
|
|
99
|
+
// Pooled Buffer Creation Functions
|
|
100
|
+
// ============================================================================
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Create or acquire a storage buffer from the pool and write data to it.
|
|
104
|
+
*
|
|
105
|
+
* Returns a PooledBuffer that must be released back to the pool after use.
|
|
106
|
+
*/
|
|
107
|
+
export function createPooledStorageBuffer(gpu: MirGPU, data: Float32Array): PooledBuffer {
|
|
108
|
+
const size = byteSizeF32(data.length);
|
|
109
|
+
const usage = GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST;
|
|
110
|
+
|
|
111
|
+
const buffer = gpu.bufferPool.acquire(size, usage);
|
|
112
|
+
gpu.queue.writeBuffer(buffer, 0, data as unknown as BufferSource);
|
|
113
|
+
|
|
114
|
+
return { buffer, size, usage };
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Create or acquire a uniform buffer from the pool and write u32x4 data to it.
|
|
119
|
+
*
|
|
120
|
+
* Returns a PooledBuffer that must be released back to the pool after use.
|
|
121
|
+
*/
|
|
122
|
+
export function createPooledUniformBufferU32x4(gpu: MirGPU, u32x4: Uint32Array): PooledBuffer {
|
|
123
|
+
if (u32x4.length !== 4) throw new Error("@octoseq/mir: uniform buffer must be 4 u32 values");
|
|
124
|
+
|
|
125
|
+
const size = 16;
|
|
126
|
+
const usage = GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST;
|
|
127
|
+
|
|
128
|
+
const buffer = gpu.bufferPool.acquire(size, usage);
|
|
129
|
+
gpu.queue.writeBuffer(buffer, 0, u32x4 as unknown as BufferSource);
|
|
130
|
+
|
|
131
|
+
return { buffer, size, usage };
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Create or acquire a storage output buffer from the pool.
|
|
136
|
+
*
|
|
137
|
+
* Returns a PooledBuffer that must be released back to the pool after use.
|
|
138
|
+
*/
|
|
139
|
+
export function createPooledStorageOutBuffer(gpu: MirGPU, byteLength: number): PooledBuffer {
|
|
140
|
+
const usage = GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC | GPUBufferUsage.COPY_DST;
|
|
141
|
+
const buffer = gpu.bufferPool.acquire(byteLength, usage);
|
|
142
|
+
|
|
143
|
+
return { buffer, size: byteLength, usage };
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Create or acquire a readback buffer from the pool.
|
|
148
|
+
*
|
|
149
|
+
* Returns a PooledBuffer that must be released back to the pool after use.
|
|
150
|
+
*/
|
|
151
|
+
export function createPooledReadbackBuffer(gpu: MirGPU, byteLength: number): PooledBuffer {
|
|
152
|
+
const usage = GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST;
|
|
153
|
+
const buffer = gpu.bufferPool.acquire(byteLength, usage);
|
|
154
|
+
|
|
155
|
+
return { buffer, size: byteLength, usage };
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Release a pooled buffer back to the pool for reuse.
|
|
160
|
+
*/
|
|
161
|
+
export function releasePooledBuffer(gpu: MirGPU, pooled: PooledBuffer): void {
|
|
162
|
+
gpu.bufferPool.release(pooled.buffer, pooled.size, pooled.usage);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Release multiple pooled buffers back to the pool at once.
|
|
167
|
+
*/
|
|
168
|
+
export function releasePooledBuffers(gpu: MirGPU, buffers: PooledBuffer[]): void {
|
|
169
|
+
for (const pooled of buffers) {
|
|
170
|
+
releasePooledBuffer(gpu, pooled);
|
|
171
|
+
}
|
|
172
|
+
}
|
package/src/gpu/melProject.ts
CHANGED
|
@@ -8,6 +8,12 @@ import {
|
|
|
8
8
|
createUniformBufferU32x4,
|
|
9
9
|
submitAndReadback,
|
|
10
10
|
type GpuDispatchResult,
|
|
11
|
+
createPooledStorageBuffer,
|
|
12
|
+
createPooledStorageOutBuffer,
|
|
13
|
+
createPooledUniformBufferU32x4,
|
|
14
|
+
createPooledReadbackBuffer,
|
|
15
|
+
releasePooledBuffers,
|
|
16
|
+
type PooledBuffer,
|
|
11
17
|
} from "./helpers";
|
|
12
18
|
|
|
13
19
|
import { melProjectWGSL } from "./kernels/melProject.wgsl";
|
|
@@ -96,3 +102,80 @@ export async function gpuMelProjectFlat(
|
|
|
96
102
|
timing,
|
|
97
103
|
};
|
|
98
104
|
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Pooled version: Real WebGPU compute stage with buffer pooling.
|
|
108
|
+
*
|
|
109
|
+
* This version reuses buffers from the pool for better performance on repeated calls.
|
|
110
|
+
* Recommended for production use when calling frequently.
|
|
111
|
+
*/
|
|
112
|
+
export async function gpuMelProjectFlatPooled(
|
|
113
|
+
gpu: MirGPU,
|
|
114
|
+
input: GpuMelProjectInput
|
|
115
|
+
): Promise<GpuDispatchResult<GpuMelProjectOutput>> {
|
|
116
|
+
const { device } = gpu;
|
|
117
|
+
|
|
118
|
+
const { nFrames, nBins, nMels, magsFlat, filterFlat } = input;
|
|
119
|
+
if (magsFlat.length !== nFrames * nBins) {
|
|
120
|
+
throw new Error("@octoseq/mir: magsFlat length mismatch");
|
|
121
|
+
}
|
|
122
|
+
if (filterFlat.length !== nMels * nBins) {
|
|
123
|
+
throw new Error("@octoseq/mir: filterFlat length mismatch");
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Acquire buffers from pool
|
|
127
|
+
const magsBuffer = createPooledStorageBuffer(gpu, magsFlat);
|
|
128
|
+
const filterBuffer = createPooledStorageBuffer(gpu, filterFlat);
|
|
129
|
+
|
|
130
|
+
const outByteLen = byteSizeF32(nFrames * nMels);
|
|
131
|
+
const outBuffer = createPooledStorageOutBuffer(gpu, outByteLen);
|
|
132
|
+
const readback = createPooledReadbackBuffer(gpu, outByteLen);
|
|
133
|
+
|
|
134
|
+
const shader = device.createShaderModule({ code: melProjectWGSL });
|
|
135
|
+
const pipeline = device.createComputePipeline({
|
|
136
|
+
layout: "auto",
|
|
137
|
+
compute: {
|
|
138
|
+
module: shader,
|
|
139
|
+
entryPoint: "main",
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
const params = createPooledUniformBufferU32x4(gpu, new Uint32Array([nBins, nMels, nFrames, 0]));
|
|
144
|
+
|
|
145
|
+
const bindGroup = device.createBindGroup({
|
|
146
|
+
layout: pipeline.getBindGroupLayout(0),
|
|
147
|
+
entries: [
|
|
148
|
+
{ binding: 0, resource: { buffer: magsBuffer.buffer } },
|
|
149
|
+
{ binding: 1, resource: { buffer: filterBuffer.buffer } },
|
|
150
|
+
{ binding: 2, resource: { buffer: outBuffer.buffer } },
|
|
151
|
+
{ binding: 3, resource: { buffer: params.buffer } },
|
|
152
|
+
],
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
const encoder = device.createCommandEncoder();
|
|
156
|
+
const pass = encoder.beginComputePass();
|
|
157
|
+
pass.setPipeline(pipeline);
|
|
158
|
+
pass.setBindGroup(0, bindGroup);
|
|
159
|
+
|
|
160
|
+
const wgX = Math.ceil(nFrames / 16);
|
|
161
|
+
const wgY = Math.ceil(nMels / 16);
|
|
162
|
+
pass.dispatchWorkgroups(wgX, wgY);
|
|
163
|
+
pass.end();
|
|
164
|
+
|
|
165
|
+
const { value: bytes, timing } = await submitAndReadback(
|
|
166
|
+
gpu,
|
|
167
|
+
encoder,
|
|
168
|
+
outBuffer.buffer,
|
|
169
|
+
readback.buffer,
|
|
170
|
+
outByteLen
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
// Release buffers back to pool (no destroy!)
|
|
174
|
+
releasePooledBuffers(gpu, [magsBuffer, filterBuffer, outBuffer, params, readback]);
|
|
175
|
+
|
|
176
|
+
const outFlat = new Float32Array(bytes);
|
|
177
|
+
return {
|
|
178
|
+
value: { outFlat },
|
|
179
|
+
timing,
|
|
180
|
+
};
|
|
181
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -6,10 +6,55 @@ export type {
|
|
|
6
6
|
MirRunMeta,
|
|
7
7
|
Mir1DResult,
|
|
8
8
|
Mir2DResult,
|
|
9
|
+
MirActivityDiagnostics,
|
|
10
|
+
MirActivityResult,
|
|
9
11
|
MirResult,
|
|
10
12
|
MirFunctionId,
|
|
11
13
|
MirRunRequest,
|
|
12
|
-
MirAudioPayload
|
|
14
|
+
MirAudioPayload,
|
|
15
|
+
BeatCandidate,
|
|
16
|
+
BeatCandidateSource,
|
|
17
|
+
BeatCandidatesResult,
|
|
18
|
+
TempoHypothesis,
|
|
19
|
+
TempoHypothesisEvidence,
|
|
20
|
+
TempoHypothesesResult,
|
|
21
|
+
BeatGrid,
|
|
22
|
+
PhaseHypothesis,
|
|
23
|
+
PhaseAlignmentConfig,
|
|
24
|
+
// Musical Time (B4)
|
|
25
|
+
MusicalTimeProvenance,
|
|
26
|
+
MusicalTimeSegment,
|
|
27
|
+
MusicalTimeStructure,
|
|
28
|
+
BeatPosition,
|
|
29
|
+
// Frequency Bands (F1)
|
|
30
|
+
FrequencyBandTimeScope,
|
|
31
|
+
FrequencySegment,
|
|
32
|
+
FrequencyBandProvenance,
|
|
33
|
+
FrequencyBand,
|
|
34
|
+
FrequencyBandStructure,
|
|
35
|
+
FrequencyBoundsAtTime,
|
|
36
|
+
// Frequency Bands (F2)
|
|
37
|
+
FrequencyKeyframe,
|
|
38
|
+
// Band-Scoped MIR (F3)
|
|
39
|
+
BandMirFunctionId,
|
|
40
|
+
BandCqtFunctionId,
|
|
41
|
+
BandEventFunctionId,
|
|
42
|
+
BandMirDiagnostics,
|
|
43
|
+
BandMir1DResult,
|
|
44
|
+
BandCqt1DResult,
|
|
45
|
+
BandMirEvent,
|
|
46
|
+
BandEventDiagnostics,
|
|
47
|
+
BandEventsResult,
|
|
48
|
+
// CQT (F5)
|
|
49
|
+
CqtConfig,
|
|
50
|
+
CqtSpectrogram,
|
|
51
|
+
CqtSignalId,
|
|
52
|
+
CqtSignalResult,
|
|
53
|
+
// Band Proposals (F5)
|
|
54
|
+
BandProposalSource,
|
|
55
|
+
BandProposal,
|
|
56
|
+
BandProposalConfig,
|
|
57
|
+
BandProposalResult,
|
|
13
58
|
} from "./types";
|
|
14
59
|
|
|
15
60
|
export const MIR_VERSION: MirVersion = "0.1.0";
|
|
@@ -47,18 +92,207 @@ export { spectrogram } from "./dsp/spectrogram";
|
|
|
47
92
|
// Derived spectral features (CPU, reuse spectrogram)
|
|
48
93
|
// ----------------------------
|
|
49
94
|
|
|
50
|
-
export {
|
|
95
|
+
export type { AmplitudeEnvelopeConfig, AmplitudeEnvelopeResult } from "./dsp/spectral";
|
|
96
|
+
export { amplitudeEnvelope, spectralCentroid, spectralFlux } from "./dsp/spectral";
|
|
51
97
|
|
|
52
98
|
// ----------------------------
|
|
53
99
|
// Onsets / Peaks
|
|
54
100
|
// ----------------------------
|
|
55
101
|
|
|
56
|
-
export type {
|
|
102
|
+
export type {
|
|
103
|
+
OnsetEnvelope,
|
|
104
|
+
OnsetEnvelopeResult,
|
|
105
|
+
OnsetDiagnostics,
|
|
106
|
+
OnsetEnvelopeOptions,
|
|
107
|
+
OnsetEnvelopeGpuResult,
|
|
108
|
+
SilenceGateConfig,
|
|
109
|
+
BinGateConfig,
|
|
110
|
+
SilenceGateResult,
|
|
111
|
+
} from "./dsp/onset";
|
|
57
112
|
export { onsetEnvelopeFromSpectrogram, onsetEnvelopeFromMel, onsetEnvelopeFromMelGpu } from "./dsp/onset";
|
|
58
113
|
|
|
114
|
+
export {
|
|
115
|
+
computeFrameEnergyFromMel,
|
|
116
|
+
computeFrameEnergyFromSpectrogram,
|
|
117
|
+
computeSilenceGating,
|
|
118
|
+
estimateNoiseFloor,
|
|
119
|
+
buildActivityMask,
|
|
120
|
+
withSilenceGateDefaults,
|
|
121
|
+
withBinGateDefaults,
|
|
122
|
+
} from "./dsp/silenceGating";
|
|
123
|
+
|
|
124
|
+
// ----------------------------
|
|
125
|
+
// Activity Signal
|
|
126
|
+
// ----------------------------
|
|
127
|
+
|
|
128
|
+
export type {
|
|
129
|
+
ActivitySignal,
|
|
130
|
+
ActivityConfig,
|
|
131
|
+
ActivityDiagnostics,
|
|
132
|
+
} from "./dsp/activity";
|
|
133
|
+
export {
|
|
134
|
+
computeActivityFromMel,
|
|
135
|
+
computeActivityFromSpectrogram,
|
|
136
|
+
computeActivityFromAudio,
|
|
137
|
+
applyActivityGating,
|
|
138
|
+
interpolateActivity,
|
|
139
|
+
} from "./dsp/activity";
|
|
140
|
+
|
|
59
141
|
export type { PeakPickEvent, PeakPickOptions } from "./dsp/peakPick";
|
|
60
142
|
export { peakPick } from "./dsp/peakPick";
|
|
61
143
|
|
|
144
|
+
// ----------------------------
|
|
145
|
+
// Beat Candidates
|
|
146
|
+
// ----------------------------
|
|
147
|
+
|
|
148
|
+
export type { BeatCandidatesOptions, BeatCandidatesOutput, BeatSalienceSignal } from "./dsp/beatCandidates";
|
|
149
|
+
export { detectBeatCandidates, beatSalienceFromMel } from "./dsp/beatCandidates";
|
|
150
|
+
|
|
151
|
+
// ----------------------------
|
|
152
|
+
// Tempo Hypotheses
|
|
153
|
+
// ----------------------------
|
|
154
|
+
|
|
155
|
+
export type { TempoHypothesesOptions, TempoHypothesesOutput } from "./dsp/tempoHypotheses";
|
|
156
|
+
export { generateTempoHypotheses } from "./dsp/tempoHypotheses";
|
|
157
|
+
|
|
158
|
+
// ----------------------------
|
|
159
|
+
// Phase Alignment (Beat Grid)
|
|
160
|
+
// ----------------------------
|
|
161
|
+
|
|
162
|
+
export { computePhaseHypotheses, generateBeatTimes } from "./dsp/phaseAlignment";
|
|
163
|
+
|
|
164
|
+
// ----------------------------
|
|
165
|
+
// Peak Picking
|
|
166
|
+
// ----------------------------
|
|
167
|
+
|
|
168
|
+
export {
|
|
169
|
+
pickPeaks,
|
|
170
|
+
pickPeaksAdaptive,
|
|
171
|
+
computeAdaptiveThreshold,
|
|
172
|
+
applyHysteresisGate,
|
|
173
|
+
DEFAULT_PEAK_PICKING_PARAMS,
|
|
174
|
+
type PeakPickingParams,
|
|
175
|
+
type PeakPickingResult,
|
|
176
|
+
type AdaptivePeakPickingResult,
|
|
177
|
+
type HysteresisGateParams,
|
|
178
|
+
} from "./dsp/peakPicking";
|
|
179
|
+
|
|
180
|
+
// ----------------------------
|
|
181
|
+
// Musical Time (B4)
|
|
182
|
+
// ----------------------------
|
|
183
|
+
|
|
184
|
+
export {
|
|
185
|
+
findSegmentAtTime,
|
|
186
|
+
computeBeatPosition,
|
|
187
|
+
computeBeatPositionFromStructure,
|
|
188
|
+
generateSegmentId,
|
|
189
|
+
createSegmentFromGrid,
|
|
190
|
+
createMusicalTimeStructure,
|
|
191
|
+
validateSegments,
|
|
192
|
+
sortSegments,
|
|
193
|
+
splitSegment,
|
|
194
|
+
generateSegmentBeatTimes,
|
|
195
|
+
} from "./dsp/musicalTime";
|
|
196
|
+
|
|
197
|
+
// ----------------------------
|
|
198
|
+
// Frequency Bands (F1)
|
|
199
|
+
// ----------------------------
|
|
200
|
+
|
|
201
|
+
export {
|
|
202
|
+
// ID generation
|
|
203
|
+
generateBandId,
|
|
204
|
+
// Validation
|
|
205
|
+
validateFrequencySegments,
|
|
206
|
+
validateFrequencyBand,
|
|
207
|
+
validateBandStructure,
|
|
208
|
+
// Creation
|
|
209
|
+
createBandStructure,
|
|
210
|
+
createConstantBand,
|
|
211
|
+
createSectionedBand,
|
|
212
|
+
createStandardBands,
|
|
213
|
+
// Queries
|
|
214
|
+
bandsActiveAt,
|
|
215
|
+
frequencyBoundsAt,
|
|
216
|
+
allFrequencyBoundsAt,
|
|
217
|
+
findBandById,
|
|
218
|
+
// Sorting
|
|
219
|
+
sortBands,
|
|
220
|
+
sortFrequencySegments,
|
|
221
|
+
// Modification
|
|
222
|
+
touchStructure,
|
|
223
|
+
addBandToStructure,
|
|
224
|
+
removeBandFromStructure,
|
|
225
|
+
updateBandInStructure,
|
|
226
|
+
// Keyframe Helpers (F2)
|
|
227
|
+
keyframesFromBand,
|
|
228
|
+
segmentsFromKeyframes,
|
|
229
|
+
splitBandSegmentAt,
|
|
230
|
+
mergeAdjacentSegments,
|
|
231
|
+
removeKeyframe,
|
|
232
|
+
updateKeyframe,
|
|
233
|
+
moveKeyframeTime,
|
|
234
|
+
} from "./dsp/frequencyBand";
|
|
235
|
+
|
|
236
|
+
// ----------------------------
|
|
237
|
+
// Band-Scoped MIR (F3)
|
|
238
|
+
// ----------------------------
|
|
239
|
+
|
|
240
|
+
export type { BandMaskOptions, MaskedSpectrogram } from "./dsp/bandMask";
|
|
241
|
+
export {
|
|
242
|
+
binToHz,
|
|
243
|
+
hzToBin,
|
|
244
|
+
computeBandMaskAtTime,
|
|
245
|
+
applyBandMaskToSpectrogram,
|
|
246
|
+
computeFrameEnergy,
|
|
247
|
+
computeFrameAmplitude,
|
|
248
|
+
} from "./dsp/bandMask";
|
|
249
|
+
|
|
250
|
+
export type { BandMirOptions, BandMirBatchRequest, BandMirBatchResult } from "./dsp/bandMir";
|
|
251
|
+
export {
|
|
252
|
+
bandAmplitudeEnvelope,
|
|
253
|
+
bandOnsetStrength,
|
|
254
|
+
bandSpectralFlux,
|
|
255
|
+
bandSpectralCentroid,
|
|
256
|
+
runBandMirBatch,
|
|
257
|
+
getBandMirFunctionLabel,
|
|
258
|
+
} from "./dsp/bandMir";
|
|
259
|
+
|
|
260
|
+
// ----------------------------
|
|
261
|
+
// Band Events (F3)
|
|
262
|
+
// ----------------------------
|
|
263
|
+
|
|
264
|
+
export type {
|
|
265
|
+
BandOnsetPeaksOptions,
|
|
266
|
+
BandBeatCandidatesOptions,
|
|
267
|
+
BandEventsBatchRequest,
|
|
268
|
+
BandEventsBatchResult,
|
|
269
|
+
} from "./dsp/bandEvents";
|
|
270
|
+
export {
|
|
271
|
+
bandOnsetPeaks,
|
|
272
|
+
bandBeatCandidates,
|
|
273
|
+
runBandEventsBatch,
|
|
274
|
+
getBandEventFunctionLabel,
|
|
275
|
+
} from "./dsp/bandEvents";
|
|
276
|
+
|
|
277
|
+
// ----------------------------
|
|
278
|
+
// Band CQT (F3)
|
|
279
|
+
// ----------------------------
|
|
280
|
+
|
|
281
|
+
export type {
|
|
282
|
+
BandCqtOptions,
|
|
283
|
+
MaskedCqtSpectrogram,
|
|
284
|
+
BandCqtBatchRequest,
|
|
285
|
+
BandCqtBatchResult,
|
|
286
|
+
} from "./dsp/bandCqt";
|
|
287
|
+
export {
|
|
288
|
+
applyBandMaskToCqt,
|
|
289
|
+
bandCqtHarmonicEnergy,
|
|
290
|
+
bandCqtBassPitchMotion,
|
|
291
|
+
bandCqtTonalStability,
|
|
292
|
+
runBandCqtBatch,
|
|
293
|
+
getBandCqtFunctionLabel,
|
|
294
|
+
} from "./dsp/bandCqt";
|
|
295
|
+
|
|
62
296
|
// ----------------------------
|
|
63
297
|
// HPSS
|
|
64
298
|
// ----------------------------
|
|
@@ -77,8 +311,129 @@ export { mfcc, delta, deltaDelta } from "./dsp/mfcc";
|
|
|
77
311
|
// Mel spectrogram
|
|
78
312
|
// ----------------------------
|
|
79
313
|
|
|
80
|
-
export type { MelConfig, MelSpectrogram } from "./dsp/mel";
|
|
81
|
-
export { melSpectrogram } from "./dsp/mel";
|
|
314
|
+
export type { MelConfig, MelSpectrogram, MelConversionConfig } from "./dsp/mel";
|
|
315
|
+
export { melSpectrogram, hzToMel, melToHz, hzToFeatureIndex, featureIndexToHz } from "./dsp/mel";
|
|
316
|
+
|
|
317
|
+
// ----------------------------
|
|
318
|
+
// CQT (F5)
|
|
319
|
+
// ----------------------------
|
|
320
|
+
|
|
321
|
+
export type { CqtOptions } from "./dsp/cqt";
|
|
322
|
+
export {
|
|
323
|
+
cqtSpectrogram,
|
|
324
|
+
computeCqt,
|
|
325
|
+
cqtBinToHz,
|
|
326
|
+
hzToCqtBin,
|
|
327
|
+
getNumOctaves,
|
|
328
|
+
getNumBins,
|
|
329
|
+
getCqtBinFrequencies,
|
|
330
|
+
withCqtDefaults,
|
|
331
|
+
CQT_DEFAULTS,
|
|
332
|
+
} from "./dsp/cqt";
|
|
333
|
+
|
|
334
|
+
export {
|
|
335
|
+
harmonicEnergy,
|
|
336
|
+
bassPitchMotion,
|
|
337
|
+
tonalStability,
|
|
338
|
+
computeCqtSignal,
|
|
339
|
+
computeAllCqtSignals,
|
|
340
|
+
} from "./dsp/cqtSignals";
|
|
341
|
+
|
|
342
|
+
// ----------------------------
|
|
343
|
+
// Pitch Detection (P1)
|
|
344
|
+
// ----------------------------
|
|
345
|
+
|
|
346
|
+
export type { PitchConfig, PitchResult, PitchActivityOptions } from "./dsp/pitch";
|
|
347
|
+
export { pitchF0, pitchConfidence } from "./dsp/pitch";
|
|
348
|
+
|
|
349
|
+
// ----------------------------
|
|
350
|
+
// Band Proposals (F5)
|
|
351
|
+
// ----------------------------
|
|
352
|
+
|
|
353
|
+
export type { BandProposalOptions } from "./dsp/bandProposal";
|
|
354
|
+
export { generateBandProposals } from "./dsp/bandProposal";
|
|
355
|
+
|
|
356
|
+
// ----------------------------
|
|
357
|
+
// Custom Signal Reduction
|
|
358
|
+
// ----------------------------
|
|
359
|
+
|
|
360
|
+
export type {
|
|
361
|
+
ReductionInput,
|
|
362
|
+
ReductionAlgorithmId,
|
|
363
|
+
BinRangeOptions,
|
|
364
|
+
OnsetStrengthOptions,
|
|
365
|
+
SpectralFluxOptions,
|
|
366
|
+
ReductionOptions,
|
|
367
|
+
ReductionResult,
|
|
368
|
+
// Polarity
|
|
369
|
+
PolarityMode,
|
|
370
|
+
// Stabilization
|
|
371
|
+
StabilizationMode,
|
|
372
|
+
EnvelopeMode,
|
|
373
|
+
StabilizationOptions,
|
|
374
|
+
} from "./dsp/customSignalReduction";
|
|
375
|
+
export {
|
|
376
|
+
reduce2DToSignal,
|
|
377
|
+
getReductionAlgorithmLabel,
|
|
378
|
+
getReductionAlgorithmDescription,
|
|
379
|
+
// Polarity
|
|
380
|
+
applyPolarity,
|
|
381
|
+
// Stabilization
|
|
382
|
+
stabilizeSignal,
|
|
383
|
+
// Statistics
|
|
384
|
+
computePercentiles,
|
|
385
|
+
computeLocalStats,
|
|
386
|
+
} from "./dsp/customSignalReduction";
|
|
387
|
+
|
|
388
|
+
// ----------------------------
|
|
389
|
+
// Event to Signal Conversion
|
|
390
|
+
// ----------------------------
|
|
391
|
+
|
|
392
|
+
export type {
|
|
393
|
+
DiscreteEvent,
|
|
394
|
+
EventWindowSpec,
|
|
395
|
+
EnvelopeShape,
|
|
396
|
+
EventToSignalOptions,
|
|
397
|
+
EventSignalResult,
|
|
398
|
+
EventReducer,
|
|
399
|
+
EventToSignalParams,
|
|
400
|
+
} from "./dsp/eventToSignal";
|
|
401
|
+
export {
|
|
402
|
+
eventCount,
|
|
403
|
+
eventDensity,
|
|
404
|
+
weightedSum,
|
|
405
|
+
weightedMean,
|
|
406
|
+
eventEnvelope,
|
|
407
|
+
eventsToSignal,
|
|
408
|
+
} from "./dsp/eventToSignal";
|
|
409
|
+
|
|
410
|
+
// ----------------------------
|
|
411
|
+
// Signal Transforms
|
|
412
|
+
// ----------------------------
|
|
413
|
+
|
|
414
|
+
export type {
|
|
415
|
+
TransformSmoothMovingAverage,
|
|
416
|
+
TransformSmoothExponential,
|
|
417
|
+
TransformSmoothGaussian,
|
|
418
|
+
TransformSmooth,
|
|
419
|
+
TransformNormalizeMinMax,
|
|
420
|
+
TransformNormalizeRobust,
|
|
421
|
+
TransformNormalizeZScore,
|
|
422
|
+
TransformNormalize,
|
|
423
|
+
TransformScale,
|
|
424
|
+
TransformPolarity,
|
|
425
|
+
TransformClamp,
|
|
426
|
+
TransformRemap,
|
|
427
|
+
TransformStep,
|
|
428
|
+
TransformChain,
|
|
429
|
+
TransformContext,
|
|
430
|
+
} from "./dsp/signalTransforms";
|
|
431
|
+
export {
|
|
432
|
+
applyTransformStep,
|
|
433
|
+
applyTransformChain,
|
|
434
|
+
getTransformLabel,
|
|
435
|
+
createDefaultTransform,
|
|
436
|
+
} from "./dsp/signalTransforms";
|
|
82
437
|
|
|
83
438
|
// ----------------------------
|
|
84
439
|
// Visualisation utilities
|
|
@@ -88,6 +443,12 @@ export { normaliseForWaveform } from "./util/normalise";
|
|
|
88
443
|
export type { Spectrogram2D, SpectrogramToDbOptions } from "./util/display";
|
|
89
444
|
export { spectrogramToDb, clampDb } from "./util/display";
|
|
90
445
|
|
|
446
|
+
// ----------------------------
|
|
447
|
+
// Audio Preprocessing
|
|
448
|
+
// ----------------------------
|
|
449
|
+
|
|
450
|
+
export { resample } from "./dsp/resample";
|
|
451
|
+
|
|
91
452
|
// ----------------------------
|
|
92
453
|
// Utility helpers
|
|
93
454
|
// ----------------------------
|