pitch-transcription 4.2.0 → 4.3.1
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/NOTICE +2 -1
- package/README.md +18 -19
- package/dist/index.d.ts +41 -0
- package/dist/index.js +89 -0
- package/dist/notes-D-jYEjBA.js +317 -0
- package/dist/notes.d.ts +80 -0
- package/dist/notes.js +1 -0
- package/model/nmp.onnx +0 -0
- package/package.json +11 -15
- package/model/group1-shard1of1.bin +0 -0
- package/model/model.json +0 -5570
package/NOTICE
CHANGED
|
@@ -4,4 +4,5 @@ Copyright Jimmy Chen
|
|
|
4
4
|
This package is derived from basic-pitch-ts (https://github.com/spotify/basic-pitch-ts),
|
|
5
5
|
Copyright 2022 Spotify AB, licensed under the Apache License, Version 2.0. Its note
|
|
6
6
|
creation, audio preparation and model call are rewritten from that source, and the
|
|
7
|
-
trained model under `model/` is Spotify's Basic Pitch model,
|
|
7
|
+
trained model under `model/` is Spotify's Basic Pitch model, its ONNX export `nmp.onnx` from
|
|
8
|
+
`basic_pitch/saved_models/icassp_2022` in basic-pitch's repository, distributed unmodified.
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[![NPM downloads][badge-npm-downloads]][url-npm]
|
|
6
6
|
[![NPM Unpacked Size (with version)][badge-npm-unpacked-size]][url-npm]
|
|
7
7
|
|
|
8
|
-
The notes played in a recording: each note's pitch, start, length, loudness and pitch bend, heard by Spotify's Basic Pitch model on
|
|
8
|
+
The notes played in a recording: each note's pitch, start, length, loudness and pitch bend, heard by Spotify's Basic Pitch model on ONNX Runtime and written as MIDI if you want a file. It hears several notes at once, on any instrument. The trained model ships with the package, and the step that turns the model's readings into notes imports without ONNX Runtime.
|
|
9
9
|
|
|
10
10
|
## Table of Contents
|
|
11
11
|
|
|
@@ -18,50 +18,49 @@ The notes played in a recording: each note's pitch, start, length, loudness and
|
|
|
18
18
|
## <a name="getting-started">🚀 Getting Started</a>
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
|
-
pnpm i pitch-transcription
|
|
21
|
+
pnpm i pitch-transcription onnxruntime-common onnxruntime-node
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
```ts
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
25
|
+
import { InferenceSession } from "onnxruntime-node";
|
|
26
|
+
import { fileURLToPath } from "node:url";
|
|
27
27
|
import {
|
|
28
28
|
addPitchBends,
|
|
29
29
|
convertNotesToSeconds,
|
|
30
30
|
createNotes,
|
|
31
31
|
MODEL_URL,
|
|
32
|
-
MODEL_WEIGHTS_URL,
|
|
33
32
|
readModel,
|
|
34
33
|
writeMidi,
|
|
35
34
|
} from "pitch-transcription";
|
|
36
35
|
|
|
37
|
-
// Under Node, the
|
|
38
|
-
const
|
|
39
|
-
const model = loadGraphModelSync([JSON.parse(modelJson), new Uint8Array(weights).buffer]);
|
|
36
|
+
// Under Node, the session reads the shipped model file; in a browser, `InferenceSession.create(servedModelUrl)` from `onnxruntime-web` instead
|
|
37
|
+
const session = await InferenceSession.create(fileURLToPath(MODEL_URL));
|
|
40
38
|
// One channel at 22050 Hz as a Float32Array, or an AudioBuffer at 22050 Hz with any number of channels
|
|
41
|
-
const readings = await readModel(
|
|
39
|
+
const readings = await readModel(session, samples, (_windowReadings, progress) => console.log(progress));
|
|
42
40
|
const notes = createNotes(readings, { minNoteLength: 11 });
|
|
43
41
|
const bentNotes = addPitchBends(readings.contours, notes);
|
|
44
42
|
const timedNotes = convertNotesToSeconds(bentNotes);
|
|
45
43
|
// Each note's startTimeSeconds, durationSeconds, pitchMidi, amplitude and pitchBends
|
|
46
44
|
const midiBytes = writeMidi(timedNotes);
|
|
45
|
+
await session.release();
|
|
47
46
|
```
|
|
48
47
|
|
|
49
|
-
A worker or a server that already holds the readings imports note creation from `pitch-transcription/notes`, which never loads
|
|
48
|
+
A worker or a server that already holds the readings imports note creation from `pitch-transcription/notes`, which never loads ONNX Runtime. `pitch-transcription` takes `onnxruntime-common` as a peer, and the runtime the session runs on is yours to choose: `onnxruntime-node` under Node, `onnxruntime-web` in a browser.
|
|
50
49
|
|
|
51
50
|
## <a name="documentation">📖 Documentation</a>
|
|
52
51
|
|
|
53
|
-
We highly recommend you take a look at the [documentation](https://
|
|
52
|
+
We highly recommend you take a look at the [documentation](https://github.com/Esposter/Esposter/tree/main/openspec/specs/pitch-transcription) to level up. It explains how the package works and how it absorbed `@spotify/basic-pitch`.
|
|
54
53
|
|
|
55
54
|
### Key exports
|
|
56
55
|
|
|
57
|
-
| Export
|
|
58
|
-
|
|
|
59
|
-
| `readModel`
|
|
60
|
-
| `createNotes`
|
|
61
|
-
| `addPitchBends`
|
|
62
|
-
| `convertNotesToSeconds`
|
|
63
|
-
| `writeMidi`
|
|
64
|
-
| `MODEL_URL
|
|
56
|
+
| Export | Role |
|
|
57
|
+
| ----------------------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
58
|
+
| `readModel` | The model's frame, onset and contour readings over a recording, a window at a time, each output disposed once read |
|
|
59
|
+
| `createNotes` | The readings turned into notes, with Basic Pitch's thresholds, inferred onsets, frequency range and melodia trick |
|
|
60
|
+
| `addPitchBends` | Each note's bend at every frame, in contour bins of a third of a semitone |
|
|
61
|
+
| `convertNotesToSeconds` | Notes timed in seconds rather than the model's frames |
|
|
62
|
+
| `writeMidi` | Notes as a MIDI file's bytes, each bend written as its share of the bend's range |
|
|
63
|
+
| `MODEL_URL` | The shipped model file, Basic Pitch's ONNX export |
|
|
65
64
|
|
|
66
65
|
### Commands
|
|
67
66
|
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ANNOTATIONS_FPS, ANNOTATIONS_FRAMES_PER_WINDOW, ANNOTATIONS_SEMITONES, AUDIO_SAMPLE_RATE, AUDIO_WINDOW_SAMPLES, CONTOURS_TENSOR, CONTOUR_BINS, CONTOUR_BINS_PER_SEMITONE, ENERGY_TOLERANCE, FFT_HOP, FRAMES_TENSOR, FRAME_THRESHOLD, INPUT_TENSOR, MIDI_MAX_VELOCITY, MIDI_MIN_VELOCITY, MIDI_OFFSET, MIDI_PITCH_BEND_SEMITONES, MIDI_PITCH_BEND_STEPS, MIN_NOTE_LENGTH, MODEL_URL, ModelReadings, NoteCreationOptions, NoteEvent, NoteEventTime, ONSETS_TENSOR, ONSET_THRESHOLD, OVERLAPPING_FRAMES, OVERLAP_SAMPLES, PITCH_BEND_STANDARD_DEVIATION, PITCH_BEND_TOLERANCE, WINDOW_HOP_SAMPLES, WINDOW_OFFSET_SECONDS, addPitchBends, convertNotesToSeconds, createNotes, writeMidi } from "./notes.js";
|
|
2
|
+
import { InferenceSession, Tensor } from "onnxruntime-common";
|
|
3
|
+
//#region src/models/AudioChannels.d.ts
|
|
4
|
+
export interface AudioChannels {
|
|
5
|
+
getChannelData: (channel: number) => Float32Array;
|
|
6
|
+
numberOfChannels: number;
|
|
7
|
+
sampleRate: number;
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/services/clearPitch.d.ts
|
|
11
|
+
export declare const clearPitch: (energy: number[][], frame: number, pitch: number) => void;
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/services/constrainFrequency.d.ts
|
|
14
|
+
export declare const constrainFrequency: (readings: number[][], maxFrequency?: number, minFrequency?: number) => number[][];
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/services/findLargestReading.d.ts
|
|
17
|
+
export declare const findLargestReading: (readings: number[][]) => number;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/services/findOnsetPeaks.d.ts
|
|
20
|
+
export declare const findOnsetPeaks: (onsets: number[][], threshold: number) => [number, number][];
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/services/inferOnsets.d.ts
|
|
23
|
+
export declare const inferOnsets: (onsets: number[][], frames: number[][]) => number[][];
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/services/mixDownChannels.d.ts
|
|
26
|
+
export declare const mixDownChannels: (audio: AudioChannels | Float32Array) => Float32Array;
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/services/prepareAudioWindows.d.ts
|
|
29
|
+
export interface AudioWindows {
|
|
30
|
+
count: number;
|
|
31
|
+
getWindow: (index: number) => Tensor;
|
|
32
|
+
}
|
|
33
|
+
export declare const prepareAudioWindows: (samples: Float32Array) => AudioWindows;
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/services/readModel.d.ts
|
|
36
|
+
export declare const readModel: (session: Pick<InferenceSession, "run">, audio: AudioChannels | Float32Array, onWindow?: (readings: ModelReadings, progress: number) => void) => Promise<ModelReadings>;
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/services/unwrapWindowReadings.d.ts
|
|
39
|
+
export declare const unwrapWindowReadings: (readings: Float32Array, binCount: number) => number[][];
|
|
40
|
+
//#endregion
|
|
41
|
+
export { ANNOTATIONS_FPS, ANNOTATIONS_FRAMES_PER_WINDOW, ANNOTATIONS_SEMITONES, AUDIO_SAMPLE_RATE, AUDIO_WINDOW_SAMPLES, CONTOURS_TENSOR, CONTOUR_BINS, CONTOUR_BINS_PER_SEMITONE, ENERGY_TOLERANCE, FFT_HOP, FRAMES_TENSOR, FRAME_THRESHOLD, INPUT_TENSOR, MIDI_MAX_VELOCITY, MIDI_MIN_VELOCITY, MIDI_OFFSET, MIDI_PITCH_BEND_SEMITONES, MIDI_PITCH_BEND_STEPS, MIN_NOTE_LENGTH, MODEL_URL, ModelReadings, NoteCreationOptions, NoteEvent, NoteEventTime, ONSETS_TENSOR, ONSET_THRESHOLD, OVERLAPPING_FRAMES, OVERLAP_SAMPLES, PITCH_BEND_STANDARD_DEVIATION, PITCH_BEND_TOLERANCE, WINDOW_HOP_SAMPLES, WINDOW_OFFSET_SECONDS, addPitchBends, convertNotesToSeconds, createNotes, writeMidi };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { A as ONSETS_TENSOR, C as MIDI_MAX_VELOCITY, D as MIDI_PITCH_BEND_STEPS, E as MIDI_PITCH_BEND_SEMITONES, F as PITCH_BEND_TOLERANCE, I as WINDOW_HOP_SAMPLES, L as WINDOW_OFFSET_SECONDS, M as OVERLAPPING_FRAMES, N as OVERLAP_SAMPLES, O as MIN_NOTE_LENGTH, P as PITCH_BEND_STANDARD_DEVIATION, S as INPUT_TENSOR, T as MIDI_OFFSET, _ as CONTOUR_BINS_PER_SEMITONE, a as findOnsetPeaks, b as FRAMES_TENSOR, c as convertNotesToSeconds, d as ANNOTATIONS_FRAMES_PER_WINDOW, f as ANNOTATIONS_SEMITONES, g as CONTOUR_BINS, h as CONTOURS_TENSOR, i as findLargestReading, j as ONSET_THRESHOLD, k as MODEL_URL, l as addPitchBends, m as AUDIO_WINDOW_SAMPLES, n as createNotes, o as constrainFrequency, p as AUDIO_SAMPLE_RATE, r as inferOnsets, s as clearPitch, t as writeMidi, u as ANNOTATIONS_FPS, v as ENERGY_TOLERANCE, w as MIDI_MIN_VELOCITY, x as FRAME_THRESHOLD, y as FFT_HOP } from "./notes-D-jYEjBA.js";
|
|
2
|
+
import { InvalidOperationError, Operation, takeOne } from "@esposter/shared";
|
|
3
|
+
import { Tensor } from "onnxruntime-common";
|
|
4
|
+
//#region src/services/mixDownChannels.ts
|
|
5
|
+
const mixDownChannels = (audio) => {
|
|
6
|
+
if (audio instanceof Float32Array) return audio;
|
|
7
|
+
if (audio.sampleRate !== 22050) throw new InvalidOperationError(Operation.Read, mixDownChannels.name, `audio at ${audio.sampleRate} Hz, the model reads ${AUDIO_SAMPLE_RATE} Hz`);
|
|
8
|
+
if (audio.numberOfChannels === 1) return audio.getChannelData(0);
|
|
9
|
+
const mixed = new Float32Array(audio.getChannelData(0).length);
|
|
10
|
+
for (let channel = 0; channel < audio.numberOfChannels; channel++) {
|
|
11
|
+
const channelData = audio.getChannelData(channel);
|
|
12
|
+
for (let index = 0; index < channelData.length; index++) mixed[index] = (mixed[index] ?? 0) + (channelData[index] ?? 0) / audio.numberOfChannels;
|
|
13
|
+
}
|
|
14
|
+
return mixed;
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/services/prepareAudioWindows.ts
|
|
18
|
+
const prepareAudioWindows = (samples) => {
|
|
19
|
+
const paddedLength = OVERLAP_SAMPLES / 2 + samples.length;
|
|
20
|
+
const count = Math.ceil(paddedLength / WINDOW_HOP_SAMPLES);
|
|
21
|
+
const padded = new Float32Array((count - 1) * WINDOW_HOP_SAMPLES + AUDIO_WINDOW_SAMPLES);
|
|
22
|
+
padded.set(samples, OVERLAP_SAMPLES / 2);
|
|
23
|
+
return {
|
|
24
|
+
count,
|
|
25
|
+
getWindow: (index) => {
|
|
26
|
+
const start = index * WINDOW_HOP_SAMPLES;
|
|
27
|
+
return new Tensor("float32", padded.subarray(start, start + AUDIO_WINDOW_SAMPLES), [
|
|
28
|
+
1,
|
|
29
|
+
AUDIO_WINDOW_SAMPLES,
|
|
30
|
+
1
|
|
31
|
+
]);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/services/unwrapWindowReadings.ts
|
|
37
|
+
const unwrapWindowReadings = (readings, binCount) => {
|
|
38
|
+
const frameCount = readings.length / binCount;
|
|
39
|
+
const rows = [];
|
|
40
|
+
for (let frame = 15; frame < frameCount - 15; frame++) rows.push([...readings.subarray(frame * binCount, (frame + 1) * binCount)]);
|
|
41
|
+
return rows;
|
|
42
|
+
};
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/services/readModel.ts
|
|
45
|
+
const readOutput = async (outputs, name, binCount) => {
|
|
46
|
+
const output = takeOne(outputs, name);
|
|
47
|
+
const data = await output.getData();
|
|
48
|
+
output.dispose();
|
|
49
|
+
if (!(data instanceof Float32Array)) throw new InvalidOperationError(Operation.Read, readOutput.name, `${name} as ${output.type}, the model writes float32`);
|
|
50
|
+
return unwrapWindowReadings(data, binCount);
|
|
51
|
+
};
|
|
52
|
+
const readWindow = async (session, window, remainingFrames) => {
|
|
53
|
+
const outputs = await session.run({ [INPUT_TENSOR]: window }, [
|
|
54
|
+
FRAMES_TENSOR,
|
|
55
|
+
ONSETS_TENSOR,
|
|
56
|
+
CONTOURS_TENSOR
|
|
57
|
+
]);
|
|
58
|
+
const [frames, onsets, contours] = await Promise.all([
|
|
59
|
+
readOutput(outputs, FRAMES_TENSOR, 88),
|
|
60
|
+
readOutput(outputs, ONSETS_TENSOR, 88),
|
|
61
|
+
readOutput(outputs, CONTOURS_TENSOR, 264)
|
|
62
|
+
]);
|
|
63
|
+
return {
|
|
64
|
+
contours: contours.slice(0, remainingFrames),
|
|
65
|
+
frames: frames.slice(0, remainingFrames),
|
|
66
|
+
onsets: onsets.slice(0, remainingFrames)
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
const readModel = async (session, audio, onWindow) => {
|
|
70
|
+
const samples = mixDownChannels(audio);
|
|
71
|
+
const frameCount = Math.floor(samples.length * 86 / AUDIO_SAMPLE_RATE);
|
|
72
|
+
const windows = prepareAudioWindows(samples);
|
|
73
|
+
const readings = {
|
|
74
|
+
contours: [],
|
|
75
|
+
frames: [],
|
|
76
|
+
onsets: []
|
|
77
|
+
};
|
|
78
|
+
for (let index = 0; index < windows.count && readings.frames.length < frameCount; index++) {
|
|
79
|
+
const remainingFrames = frameCount - readings.frames.length;
|
|
80
|
+
const windowReadings = await readWindow(session, windows.getWindow(index), remainingFrames);
|
|
81
|
+
readings.frames.push(...windowReadings.frames);
|
|
82
|
+
readings.onsets.push(...windowReadings.onsets);
|
|
83
|
+
readings.contours.push(...windowReadings.contours);
|
|
84
|
+
onWindow?.(windowReadings, readings.frames.length / frameCount);
|
|
85
|
+
}
|
|
86
|
+
return readings;
|
|
87
|
+
};
|
|
88
|
+
//#endregion
|
|
89
|
+
export { ANNOTATIONS_FPS, ANNOTATIONS_FRAMES_PER_WINDOW, ANNOTATIONS_SEMITONES, AUDIO_SAMPLE_RATE, AUDIO_WINDOW_SAMPLES, CONTOURS_TENSOR, CONTOUR_BINS, CONTOUR_BINS_PER_SEMITONE, ENERGY_TOLERANCE, FFT_HOP, FRAMES_TENSOR, FRAME_THRESHOLD, INPUT_TENSOR, MIDI_MAX_VELOCITY, MIDI_MIN_VELOCITY, MIDI_OFFSET, MIDI_PITCH_BEND_SEMITONES, MIDI_PITCH_BEND_STEPS, MIN_NOTE_LENGTH, MODEL_URL, ONSETS_TENSOR, ONSET_THRESHOLD, OVERLAPPING_FRAMES, OVERLAP_SAMPLES, PITCH_BEND_STANDARD_DEVIATION, PITCH_BEND_TOLERANCE, WINDOW_HOP_SAMPLES, WINDOW_OFFSET_SECONDS, addPitchBends, clearPitch, constrainFrequency, convertNotesToSeconds, createNotes, findLargestReading, findOnsetPeaks, inferOnsets, mixDownChannels, prepareAudioWindows, readModel, unwrapWindowReadings, writeMidi };
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import { takeOne } from "@esposter/shared";
|
|
2
|
+
//#region src/constants.ts
|
|
3
|
+
const AUDIO_SAMPLE_RATE = 22050;
|
|
4
|
+
const FFT_HOP = 256;
|
|
5
|
+
const AUDIO_WINDOW_SAMPLES = AUDIO_SAMPLE_RATE * 2 - 256;
|
|
6
|
+
const ANNOTATIONS_FPS = Math.floor(AUDIO_SAMPLE_RATE / 256);
|
|
7
|
+
const ANNOTATIONS_FRAMES_PER_WINDOW = 172;
|
|
8
|
+
const OVERLAPPING_FRAMES = 30;
|
|
9
|
+
const OVERLAP_SAMPLES = 7680;
|
|
10
|
+
const WINDOW_HOP_SAMPLES = 36164;
|
|
11
|
+
const WINDOW_OFFSET_SECONDS = .010326077097505668;
|
|
12
|
+
const MIDI_OFFSET = 21;
|
|
13
|
+
const ANNOTATIONS_SEMITONES = 88;
|
|
14
|
+
const CONTOUR_BINS_PER_SEMITONE = 3;
|
|
15
|
+
const CONTOUR_BINS = 264;
|
|
16
|
+
const INPUT_TENSOR = "serving_default_input_2:0";
|
|
17
|
+
const FRAMES_TENSOR = "StatefulPartitionedCall:1";
|
|
18
|
+
const ONSETS_TENSOR = "StatefulPartitionedCall:2";
|
|
19
|
+
const CONTOURS_TENSOR = "StatefulPartitionedCall:0";
|
|
20
|
+
const MODEL_URL = new URL("../model/nmp.onnx", import.meta.url);
|
|
21
|
+
const ONSET_THRESHOLD = .5;
|
|
22
|
+
const FRAME_THRESHOLD = .3;
|
|
23
|
+
const MIN_NOTE_LENGTH = 11;
|
|
24
|
+
const ENERGY_TOLERANCE = 11;
|
|
25
|
+
const PITCH_BEND_TOLERANCE = 25;
|
|
26
|
+
const PITCH_BEND_STANDARD_DEVIATION = 5;
|
|
27
|
+
const MIDI_PITCH_BEND_SEMITONES = 2;
|
|
28
|
+
const MIDI_PITCH_BEND_STEPS = 8192;
|
|
29
|
+
const MIDI_MIN_VELOCITY = 1;
|
|
30
|
+
const MIDI_MAX_VELOCITY = 127;
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/services/addPitchBends.ts
|
|
33
|
+
const PITCH_BEND_WEIGHTS = Array.from({ length: 51 }, (_value, offset) => Math.exp(-((offset - 25) ** 2) / 50));
|
|
34
|
+
const addPitchBends = (contours, notes) => notes.map((note) => {
|
|
35
|
+
const bin = (note.pitchMidi - 21) * 3;
|
|
36
|
+
const start = Math.max(bin - 25, 0);
|
|
37
|
+
const end = Math.min(bin + 25 + 1, 264);
|
|
38
|
+
const pitchBends = contours.slice(note.startFrame, note.startFrame + note.durationFrames).map((row) => {
|
|
39
|
+
let bestBin = start;
|
|
40
|
+
let bestReading = -Infinity;
|
|
41
|
+
for (let contourBin = start; contourBin < end; contourBin++) {
|
|
42
|
+
const reading = takeOne(row, contourBin) * takeOne(PITCH_BEND_WEIGHTS, contourBin - bin + 25);
|
|
43
|
+
if (reading <= bestReading) continue;
|
|
44
|
+
bestBin = contourBin;
|
|
45
|
+
bestReading = reading;
|
|
46
|
+
}
|
|
47
|
+
return bestBin - bin;
|
|
48
|
+
});
|
|
49
|
+
return {
|
|
50
|
+
...note,
|
|
51
|
+
pitchBends
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/services/convertNotesToSeconds.ts
|
|
56
|
+
const toSeconds = (frame) => frame * 256 / AUDIO_SAMPLE_RATE - WINDOW_OFFSET_SECONDS * Math.floor(frame / 172);
|
|
57
|
+
const convertNotesToSeconds = (notes) => notes.map(({ amplitude, durationFrames, pitchBends, pitchMidi, startFrame }) => {
|
|
58
|
+
const startTimeSeconds = toSeconds(startFrame);
|
|
59
|
+
return {
|
|
60
|
+
amplitude,
|
|
61
|
+
durationSeconds: toSeconds(startFrame + durationFrames) - startTimeSeconds,
|
|
62
|
+
pitchBends,
|
|
63
|
+
pitchMidi,
|
|
64
|
+
startTimeSeconds
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/services/clearPitch.ts
|
|
69
|
+
const clearPitch = (energy, frame, pitch) => {
|
|
70
|
+
const row = takeOne(energy, frame);
|
|
71
|
+
row[pitch] = 0;
|
|
72
|
+
if (pitch + 1 < row.length) row[pitch + 1] = 0;
|
|
73
|
+
if (pitch > 0) row[pitch - 1] = 0;
|
|
74
|
+
};
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/services/constrainFrequency.ts
|
|
77
|
+
const toPitchIndex = (frequency) => Math.round(12 * Math.log2(frequency / 440) + 69 - 21);
|
|
78
|
+
const constrainFrequency = (readings, maxFrequency, minFrequency) => {
|
|
79
|
+
if (maxFrequency === void 0 && minFrequency === void 0) return readings;
|
|
80
|
+
const end = maxFrequency === void 0 ? Infinity : toPitchIndex(maxFrequency);
|
|
81
|
+
const start = minFrequency === void 0 ? 0 : toPitchIndex(minFrequency);
|
|
82
|
+
return readings.map((row) => row.map((reading, pitch) => pitch >= start && pitch < end ? reading : 0));
|
|
83
|
+
};
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region src/services/findOnsetPeaks.ts
|
|
86
|
+
const findOnsetPeaks = (onsets, threshold) => {
|
|
87
|
+
const peaks = [];
|
|
88
|
+
for (let frame = 1; frame < onsets.length - 1; frame++) {
|
|
89
|
+
const previous = takeOne(onsets, frame - 1);
|
|
90
|
+
const row = takeOne(onsets, frame);
|
|
91
|
+
const next = takeOne(onsets, frame + 1);
|
|
92
|
+
for (let pitch = 0; pitch < row.length; pitch++) {
|
|
93
|
+
const reading = takeOne(row, pitch);
|
|
94
|
+
if (reading > threshold && reading > takeOne(previous, pitch) && reading > takeOne(next, pitch)) peaks.push([frame, pitch]);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return peaks;
|
|
98
|
+
};
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/services/findLargestReading.ts
|
|
101
|
+
const findLargestReading = (readings) => {
|
|
102
|
+
let largest = 0;
|
|
103
|
+
for (const row of readings) for (const reading of row) largest = Math.max(largest, reading);
|
|
104
|
+
return largest;
|
|
105
|
+
};
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region src/services/inferOnsets.ts
|
|
108
|
+
const getJump = (row, previous, beforePrevious, pitch) => {
|
|
109
|
+
const reading = takeOne(row, pitch);
|
|
110
|
+
return Math.max(0, Math.min(reading - takeOne(previous, pitch), reading - takeOne(beforePrevious, pitch)));
|
|
111
|
+
};
|
|
112
|
+
const inferOnsets = (onsets, frames) => {
|
|
113
|
+
let largestJump = 0;
|
|
114
|
+
for (let frame = 2; frame < frames.length; frame++) {
|
|
115
|
+
const row = takeOne(frames, frame);
|
|
116
|
+
const previous = takeOne(frames, frame - 1);
|
|
117
|
+
const beforePrevious = takeOne(frames, frame - 2);
|
|
118
|
+
for (let pitch = 0; pitch < row.length; pitch++) largestJump = Math.max(largestJump, getJump(row, previous, beforePrevious, pitch));
|
|
119
|
+
}
|
|
120
|
+
if (largestJump === 0) return onsets;
|
|
121
|
+
const scale = findLargestReading(onsets) / largestJump;
|
|
122
|
+
return onsets.map((onsetRow, frame) => {
|
|
123
|
+
const row = takeOne(frames, frame);
|
|
124
|
+
const previous = frame < 2 ? row : takeOne(frames, frame - 1);
|
|
125
|
+
const beforePrevious = frame < 2 ? row : takeOne(frames, frame - 2);
|
|
126
|
+
return onsetRow.map((reading, pitch) => Math.max(reading, scale * getJump(row, previous, beforePrevious, pitch)));
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region src/services/createNotes.ts
|
|
131
|
+
const getMeanReading = (frames, start, end, pitch) => {
|
|
132
|
+
let sum = 0;
|
|
133
|
+
for (let frame = start; frame < end; frame++) sum += takeOne(takeOne(frames, frame), pitch);
|
|
134
|
+
return sum / (end - start);
|
|
135
|
+
};
|
|
136
|
+
const createNotes = ({ frames, onsets }, { energyTolerance = 11, frameThreshold = FRAME_THRESHOLD, isInferringOnsets = true, isMelodiaTrick = true, maxFrequency, minFrequency, minNoteLength = 11, onsetThreshold = ONSET_THRESHOLD } = {}) => {
|
|
137
|
+
const frameCount = frames.length;
|
|
138
|
+
const constrainedFrames = constrainFrequency(frames, maxFrequency, minFrequency);
|
|
139
|
+
const constrainedOnsets = constrainFrequency(onsets, maxFrequency, minFrequency);
|
|
140
|
+
const peakOnsets = isInferringOnsets ? inferOnsets(constrainedOnsets, constrainedFrames) : constrainedOnsets;
|
|
141
|
+
const energy = constrainedFrames.map((row) => [...row]);
|
|
142
|
+
const notes = [];
|
|
143
|
+
for (const [startFrame, pitch] of findOnsetPeaks(peakOnsets, onsetThreshold).toReversed()) {
|
|
144
|
+
if (startFrame >= frameCount - 1) continue;
|
|
145
|
+
let end = startFrame + 1;
|
|
146
|
+
let quietFrames = 0;
|
|
147
|
+
for (; end < frameCount - 1 && quietFrames < energyTolerance; end++) quietFrames = takeOne(takeOne(energy, end), pitch) < frameThreshold ? quietFrames + 1 : 0;
|
|
148
|
+
end -= quietFrames;
|
|
149
|
+
if (end - startFrame <= minNoteLength) continue;
|
|
150
|
+
for (let frame = startFrame; frame < end; frame++) clearPitch(energy, frame, pitch);
|
|
151
|
+
notes.push({
|
|
152
|
+
amplitude: getMeanReading(constrainedFrames, startFrame, end, pitch),
|
|
153
|
+
durationFrames: end - startFrame,
|
|
154
|
+
pitchMidi: pitch + 21,
|
|
155
|
+
startFrame
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
if (!isMelodiaTrick) return notes;
|
|
159
|
+
const candidates = [];
|
|
160
|
+
for (const [frame, row] of energy.entries()) for (let pitch = 0; pitch < row.length; pitch++) {
|
|
161
|
+
const reading = takeOne(row, pitch);
|
|
162
|
+
if (reading > frameThreshold) candidates.push([
|
|
163
|
+
reading,
|
|
164
|
+
frame,
|
|
165
|
+
pitch
|
|
166
|
+
]);
|
|
167
|
+
}
|
|
168
|
+
const sortedCandidates = candidates.toSorted(([firstReading, firstFrame, firstPitch], [secondReading, secondFrame, secondPitch]) => secondReading - firstReading || firstFrame - secondFrame || firstPitch - secondPitch);
|
|
169
|
+
for (const [reading, middle, pitch] of sortedCandidates) {
|
|
170
|
+
const middleRow = takeOne(energy, middle);
|
|
171
|
+
if (takeOne(middleRow, pitch) !== reading) continue;
|
|
172
|
+
middleRow[pitch] = 0;
|
|
173
|
+
let frame = middle + 1;
|
|
174
|
+
let quietFrames = 0;
|
|
175
|
+
for (; frame < frameCount - 1 && quietFrames < energyTolerance; frame++) {
|
|
176
|
+
quietFrames = takeOne(takeOne(energy, frame), pitch) < frameThreshold ? quietFrames + 1 : 0;
|
|
177
|
+
clearPitch(energy, frame, pitch);
|
|
178
|
+
}
|
|
179
|
+
const end = frame - 1 - quietFrames;
|
|
180
|
+
frame = middle - 1;
|
|
181
|
+
quietFrames = 0;
|
|
182
|
+
for (; frame > 0 && quietFrames < energyTolerance; frame--) {
|
|
183
|
+
quietFrames = takeOne(takeOne(energy, frame), pitch) < frameThreshold ? quietFrames + 1 : 0;
|
|
184
|
+
clearPitch(energy, frame, pitch);
|
|
185
|
+
}
|
|
186
|
+
const start = frame + 1 + quietFrames;
|
|
187
|
+
if (end - start <= minNoteLength) continue;
|
|
188
|
+
notes.push({
|
|
189
|
+
amplitude: getMeanReading(constrainedFrames, start, end, pitch),
|
|
190
|
+
durationFrames: end - start,
|
|
191
|
+
pitchMidi: pitch + 21,
|
|
192
|
+
startFrame: start
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
return notes;
|
|
196
|
+
};
|
|
197
|
+
//#endregion
|
|
198
|
+
//#region src/services/writeMidi.ts
|
|
199
|
+
const MIDI_TICKS_PER_BEAT = 480;
|
|
200
|
+
const MIDI_TICKS_PER_SECOND = MIDI_TICKS_PER_BEAT * 2;
|
|
201
|
+
const writeVariableLength = (value) => {
|
|
202
|
+
const bytes = [value & 127];
|
|
203
|
+
for (let rest = value >> 7; rest > 0; rest >>= 7) bytes.unshift(rest & 127 | 128);
|
|
204
|
+
return bytes;
|
|
205
|
+
};
|
|
206
|
+
const toTicks = (seconds) => Math.round(seconds * MIDI_TICKS_PER_SECOND);
|
|
207
|
+
const toVelocity = (amplitude) => {
|
|
208
|
+
const velocity = Math.floor(amplitude * 127);
|
|
209
|
+
return Math.min(127, Math.max(1, velocity));
|
|
210
|
+
};
|
|
211
|
+
const toUint16 = (value) => [value >> 8 & 255, value & 255];
|
|
212
|
+
const toUint32 = (value) => [
|
|
213
|
+
value >>> 24 & 255,
|
|
214
|
+
value >> 16 & 255,
|
|
215
|
+
value >> 8 & 255,
|
|
216
|
+
value & 255
|
|
217
|
+
];
|
|
218
|
+
const writeChunk = (type, data) => [
|
|
219
|
+
...type,
|
|
220
|
+
...toUint32(data.length),
|
|
221
|
+
...data
|
|
222
|
+
];
|
|
223
|
+
const HEADER_CHUNK_TYPE = [
|
|
224
|
+
77,
|
|
225
|
+
84,
|
|
226
|
+
104,
|
|
227
|
+
100
|
|
228
|
+
];
|
|
229
|
+
const TRACK_CHUNK_TYPE = [
|
|
230
|
+
77,
|
|
231
|
+
84,
|
|
232
|
+
114,
|
|
233
|
+
107
|
|
234
|
+
];
|
|
235
|
+
const EMPTY_TRACK_NAME = [
|
|
236
|
+
255,
|
|
237
|
+
3,
|
|
238
|
+
0
|
|
239
|
+
];
|
|
240
|
+
const END_OF_TRACK = [
|
|
241
|
+
255,
|
|
242
|
+
47,
|
|
243
|
+
0
|
|
244
|
+
];
|
|
245
|
+
const PIANO_PROGRAM_CHANGE = [192, 0];
|
|
246
|
+
const writeTrack = (events) => {
|
|
247
|
+
const data = [];
|
|
248
|
+
let lastTick = 0;
|
|
249
|
+
for (const { bytes, tick } of events.toSorted((firstEvent, secondEvent) => firstEvent.tick - secondEvent.tick)) {
|
|
250
|
+
data.push(...writeVariableLength(tick - lastTick), ...bytes);
|
|
251
|
+
lastTick = tick;
|
|
252
|
+
}
|
|
253
|
+
data.push(0, ...END_OF_TRACK);
|
|
254
|
+
return writeChunk(TRACK_CHUNK_TYPE, data);
|
|
255
|
+
};
|
|
256
|
+
const writeNoteEvents = (notes) => notes.map(({ amplitude, durationSeconds, pitchMidi, startTimeSeconds }) => ({
|
|
257
|
+
amplitude,
|
|
258
|
+
offTick: toTicks(startTimeSeconds) + toTicks(durationSeconds),
|
|
259
|
+
onTick: toTicks(startTimeSeconds),
|
|
260
|
+
pitchMidi
|
|
261
|
+
})).toSorted((firstNote, secondNote) => firstNote.onTick - secondNote.onTick).flatMap(({ amplitude, offTick, onTick, pitchMidi }) => [{
|
|
262
|
+
bytes: [
|
|
263
|
+
144,
|
|
264
|
+
pitchMidi,
|
|
265
|
+
toVelocity(amplitude)
|
|
266
|
+
],
|
|
267
|
+
tick: onTick
|
|
268
|
+
}, {
|
|
269
|
+
bytes: [
|
|
270
|
+
128,
|
|
271
|
+
pitchMidi,
|
|
272
|
+
0
|
|
273
|
+
],
|
|
274
|
+
tick: offTick
|
|
275
|
+
}]);
|
|
276
|
+
const writePitchBendEvents = (notes) => notes.flatMap(({ durationSeconds, pitchBends = [], startTimeSeconds }) => pitchBends.map((bend, index) => {
|
|
277
|
+
const share = bend / 3 / 2;
|
|
278
|
+
const value = MIDI_PITCH_BEND_STEPS + Math.max(-8192, Math.min(8191, Math.round(share * MIDI_PITCH_BEND_STEPS)));
|
|
279
|
+
return {
|
|
280
|
+
bytes: [
|
|
281
|
+
224,
|
|
282
|
+
value & 127,
|
|
283
|
+
value >> 7 & 127
|
|
284
|
+
],
|
|
285
|
+
tick: toTicks(startTimeSeconds + index * durationSeconds / pitchBends.length)
|
|
286
|
+
};
|
|
287
|
+
}));
|
|
288
|
+
const writeMidi = (notes) => {
|
|
289
|
+
const header = writeChunk(HEADER_CHUNK_TYPE, [
|
|
290
|
+
...toUint16(1),
|
|
291
|
+
...toUint16(2),
|
|
292
|
+
...toUint16(MIDI_TICKS_PER_BEAT)
|
|
293
|
+
]);
|
|
294
|
+
const tempoTrack = writeTrack([{
|
|
295
|
+
bytes: EMPTY_TRACK_NAME,
|
|
296
|
+
tick: 0
|
|
297
|
+
}]);
|
|
298
|
+
const noteTrack = writeTrack([
|
|
299
|
+
{
|
|
300
|
+
bytes: EMPTY_TRACK_NAME,
|
|
301
|
+
tick: 0
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
bytes: PIANO_PROGRAM_CHANGE,
|
|
305
|
+
tick: 0
|
|
306
|
+
},
|
|
307
|
+
...writeNoteEvents(notes),
|
|
308
|
+
...writePitchBendEvents(notes)
|
|
309
|
+
]);
|
|
310
|
+
return new Uint8Array([
|
|
311
|
+
...header,
|
|
312
|
+
...tempoTrack,
|
|
313
|
+
...noteTrack
|
|
314
|
+
]);
|
|
315
|
+
};
|
|
316
|
+
//#endregion
|
|
317
|
+
export { ONSETS_TENSOR as A, MIDI_MAX_VELOCITY as C, MIDI_PITCH_BEND_STEPS as D, MIDI_PITCH_BEND_SEMITONES as E, PITCH_BEND_TOLERANCE as F, WINDOW_HOP_SAMPLES as I, WINDOW_OFFSET_SECONDS as L, OVERLAPPING_FRAMES as M, OVERLAP_SAMPLES as N, MIN_NOTE_LENGTH as O, PITCH_BEND_STANDARD_DEVIATION as P, INPUT_TENSOR as S, MIDI_OFFSET as T, CONTOUR_BINS_PER_SEMITONE as _, findOnsetPeaks as a, FRAMES_TENSOR as b, convertNotesToSeconds as c, ANNOTATIONS_FRAMES_PER_WINDOW as d, ANNOTATIONS_SEMITONES as f, CONTOUR_BINS as g, CONTOURS_TENSOR as h, findLargestReading as i, ONSET_THRESHOLD as j, MODEL_URL as k, addPitchBends as l, AUDIO_WINDOW_SAMPLES as m, createNotes as n, constrainFrequency as o, AUDIO_SAMPLE_RATE as p, inferOnsets as r, clearPitch as s, writeMidi as t, ANNOTATIONS_FPS as u, ENERGY_TOLERANCE as v, MIDI_MIN_VELOCITY as w, FRAME_THRESHOLD as x, FFT_HOP as y };
|
package/dist/notes.d.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
//#region src/constants.d.ts
|
|
2
|
+
export declare const AUDIO_SAMPLE_RATE = 22050;
|
|
3
|
+
export declare const FFT_HOP = 256;
|
|
4
|
+
export declare const AUDIO_WINDOW_SAMPLES: number;
|
|
5
|
+
export declare const ANNOTATIONS_FPS: number;
|
|
6
|
+
export declare const ANNOTATIONS_FRAMES_PER_WINDOW: number;
|
|
7
|
+
export declare const OVERLAPPING_FRAMES = 30;
|
|
8
|
+
export declare const OVERLAP_SAMPLES: number;
|
|
9
|
+
export declare const WINDOW_HOP_SAMPLES: number;
|
|
10
|
+
export declare const WINDOW_OFFSET_SECONDS: number;
|
|
11
|
+
export declare const MIDI_OFFSET = 21;
|
|
12
|
+
export declare const ANNOTATIONS_SEMITONES = 88;
|
|
13
|
+
export declare const CONTOUR_BINS_PER_SEMITONE = 3;
|
|
14
|
+
export declare const CONTOUR_BINS: number;
|
|
15
|
+
export declare const INPUT_TENSOR = "serving_default_input_2:0";
|
|
16
|
+
export declare const FRAMES_TENSOR = "StatefulPartitionedCall:1";
|
|
17
|
+
export declare const ONSETS_TENSOR = "StatefulPartitionedCall:2";
|
|
18
|
+
export declare const CONTOURS_TENSOR = "StatefulPartitionedCall:0";
|
|
19
|
+
export declare const MODEL_URL: URL;
|
|
20
|
+
export declare const ONSET_THRESHOLD = .5;
|
|
21
|
+
export declare const FRAME_THRESHOLD = .3;
|
|
22
|
+
export declare const MIN_NOTE_LENGTH = 11;
|
|
23
|
+
export declare const ENERGY_TOLERANCE = 11;
|
|
24
|
+
export declare const PITCH_BEND_TOLERANCE = 25;
|
|
25
|
+
export declare const PITCH_BEND_STANDARD_DEVIATION = 5;
|
|
26
|
+
export declare const MIDI_PITCH_BEND_SEMITONES = 2;
|
|
27
|
+
export declare const MIDI_PITCH_BEND_STEPS: number;
|
|
28
|
+
export declare const MIDI_MIN_VELOCITY = 1;
|
|
29
|
+
export declare const MIDI_MAX_VELOCITY = 127;
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/models/ModelReadings.d.ts
|
|
32
|
+
interface ModelReadings {
|
|
33
|
+
contours: number[][];
|
|
34
|
+
frames: number[][];
|
|
35
|
+
onsets: number[][];
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/models/NoteCreationOptions.d.ts
|
|
39
|
+
interface NoteCreationOptions {
|
|
40
|
+
energyTolerance?: number;
|
|
41
|
+
frameThreshold?: number;
|
|
42
|
+
isInferringOnsets?: boolean;
|
|
43
|
+
isMelodiaTrick?: boolean;
|
|
44
|
+
maxFrequency?: number;
|
|
45
|
+
minFrequency?: number;
|
|
46
|
+
minNoteLength?: number;
|
|
47
|
+
onsetThreshold?: number;
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/models/NoteEvent.d.ts
|
|
51
|
+
interface NoteEvent {
|
|
52
|
+
amplitude: number;
|
|
53
|
+
durationFrames: number;
|
|
54
|
+
pitchBends?: number[];
|
|
55
|
+
pitchMidi: number;
|
|
56
|
+
startFrame: number;
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/models/NoteEventTime.d.ts
|
|
60
|
+
interface NoteEventTime {
|
|
61
|
+
amplitude: number;
|
|
62
|
+
durationSeconds: number;
|
|
63
|
+
pitchBends?: number[];
|
|
64
|
+
pitchMidi: number;
|
|
65
|
+
startTimeSeconds: number;
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/services/addPitchBends.d.ts
|
|
69
|
+
export declare const addPitchBends: (contours: number[][], notes: NoteEvent[]) => NoteEvent[];
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/services/convertNotesToSeconds.d.ts
|
|
72
|
+
export declare const convertNotesToSeconds: (notes: NoteEvent[]) => NoteEventTime[];
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/services/createNotes.d.ts
|
|
75
|
+
export declare const createNotes: ({ frames, onsets }: Pick<ModelReadings, "frames" | "onsets">, { energyTolerance, frameThreshold, isInferringOnsets, isMelodiaTrick, maxFrequency, minFrequency, minNoteLength, onsetThreshold }?: NoteCreationOptions) => NoteEvent[];
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/services/writeMidi.d.ts
|
|
78
|
+
export declare const writeMidi: (notes: NoteEventTime[]) => Uint8Array;
|
|
79
|
+
//#endregion
|
|
80
|
+
export type { ModelReadings, NoteCreationOptions, NoteEvent, NoteEventTime };
|
package/dist/notes.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { u as ANNOTATIONS_FPS, d as ANNOTATIONS_FRAMES_PER_WINDOW, f as ANNOTATIONS_SEMITONES, p as AUDIO_SAMPLE_RATE, m as AUDIO_WINDOW_SAMPLES, h as CONTOURS_TENSOR, g as CONTOUR_BINS, _ as CONTOUR_BINS_PER_SEMITONE, v as ENERGY_TOLERANCE, y as FFT_HOP, b as FRAMES_TENSOR, x as FRAME_THRESHOLD, S as INPUT_TENSOR, C as MIDI_MAX_VELOCITY, w as MIDI_MIN_VELOCITY, T as MIDI_OFFSET, E as MIDI_PITCH_BEND_SEMITONES, D as MIDI_PITCH_BEND_STEPS, O as MIN_NOTE_LENGTH, k as MODEL_URL, A as ONSETS_TENSOR, j as ONSET_THRESHOLD, M as OVERLAPPING_FRAMES, N as OVERLAP_SAMPLES, P as PITCH_BEND_STANDARD_DEVIATION, F as PITCH_BEND_TOLERANCE, I as WINDOW_HOP_SAMPLES, L as WINDOW_OFFSET_SECONDS, l as addPitchBends, c as convertNotesToSeconds, n as createNotes, t as writeMidi } from "./notes-D-jYEjBA.js";
|
package/model/nmp.onnx
ADDED
|
Binary file
|