@libraz/libsonare 1.7.2 → 1.8.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 +178 -0
- package/README.md +26 -203
- package/dist/_chain_config.d.ts +14 -0
- package/dist/_chain_config.d.ts.map +1 -0
- package/dist/_effects_common.d.ts +7 -0
- package/dist/_effects_common.d.ts.map +1 -0
- package/dist/_feature_validation.d.ts +8 -0
- package/dist/_feature_validation.d.ts.map +1 -0
- package/dist/_fft_options.d.ts +24 -0
- package/dist/_fft_options.d.ts.map +1 -0
- package/dist/align_take.d.ts +50 -0
- package/dist/align_take.d.ts.map +1 -0
- package/dist/analysis.d.ts +29 -5840
- package/dist/analysis.d.ts.map +1 -0
- package/dist/analysis.js +874 -722
- package/dist/analysis.js.map +1 -1
- package/dist/analysis_helpers.d.ts +9 -0
- package/dist/analysis_helpers.d.ts.map +1 -0
- package/dist/audio.d.ts +163 -0
- package/dist/audio.d.ts.map +1 -0
- package/dist/clip_page_streamer.d.ts +133 -0
- package/dist/clip_page_streamer.d.ts.map +1 -0
- package/dist/codes.d.ts +44 -0
- package/dist/codes.d.ts.map +1 -0
- package/dist/effects_mastering.d.ts +23 -0
- package/dist/effects_mastering.d.ts.map +1 -0
- package/dist/effects_note_ops.d.ts +502 -0
- package/dist/effects_note_ops.d.ts.map +1 -0
- package/dist/effects_percussive.d.ts +185 -0
- package/dist/effects_percussive.d.ts.map +1 -0
- package/dist/effects_separation.d.ts +65 -0
- package/dist/effects_separation.d.ts.map +1 -0
- package/dist/effects_spectral.d.ts +28 -0
- package/dist/effects_spectral.d.ts.map +1 -0
- package/dist/effects_timepitch.d.ts +134 -0
- package/dist/effects_timepitch.d.ts.map +1 -0
- package/dist/effects_voice_change.d.ts +53 -0
- package/dist/effects_voice_change.d.ts.map +1 -0
- package/dist/errors.d.ts +51 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/feature_core.d.ts +341 -0
- package/dist/feature_core.d.ts.map +1 -0
- package/dist/feature_decompose.d.ts +278 -0
- package/dist/feature_decompose.d.ts.map +1 -0
- package/dist/feature_inverse.d.ts +128 -0
- package/dist/feature_inverse.d.ts.map +1 -0
- package/dist/feature_loudness.d.ts +66 -0
- package/dist/feature_loudness.d.ts.map +1 -0
- package/dist/feature_music.d.ts +307 -0
- package/dist/feature_music.d.ts.map +1 -0
- package/dist/feature_pitch.d.ts +108 -0
- package/dist/feature_pitch.d.ts.map +1 -0
- package/dist/feature_resample.d.ts +16 -0
- package/dist/feature_resample.d.ts.map +1 -0
- package/dist/feature_spectral.d.ts +137 -0
- package/dist/feature_spectral.d.ts.map +1 -0
- package/dist/feature_spectrogram.d.ts +198 -0
- package/dist/feature_spectrogram.d.ts.map +1 -0
- package/dist/features.d.ts +10 -0
- package/dist/features.d.ts.map +1 -0
- package/dist/hrtf/default.shrf +0 -0
- package/dist/index.d.ts +74 -7431
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4173 -1621
- package/dist/index.js.map +1 -1
- package/dist/instrument_types.d.ts +517 -0
- package/dist/instrument_types.d.ts.map +1 -0
- package/dist/live_audio.d.ts +35 -0
- package/dist/live_audio.d.ts.map +1 -0
- package/dist/mastering_chain.d.ts +213 -0
- package/dist/mastering_chain.d.ts.map +1 -0
- package/dist/mastering_core.d.ts +483 -0
- package/dist/mastering_core.d.ts.map +1 -0
- package/dist/mastering_dynamics.d.ts +80 -0
- package/dist/mastering_dynamics.d.ts.map +1 -0
- package/dist/metering.d.ts +287 -0
- package/dist/metering.d.ts.map +1 -0
- package/dist/mixer.d.ts +464 -0
- package/dist/mixer.d.ts.map +1 -0
- package/dist/mixing_assistant.d.ts +62 -0
- package/dist/mixing_assistant.d.ts.map +1 -0
- package/dist/mixing_oneshot.d.ts +40 -0
- package/dist/mixing_oneshot.d.ts.map +1 -0
- package/dist/module_state.d.ts +15 -0
- package/dist/module_state.d.ts.map +1 -0
- package/dist/opfs_clip_pages.d.ts +28 -0
- package/dist/opfs_clip_pages.d.ts.map +1 -0
- package/dist/playback_renderer.d.ts +128 -0
- package/dist/playback_renderer.d.ts.map +1 -0
- package/dist/polyphony.d.ts +202 -0
- package/dist/polyphony.d.ts.map +1 -0
- package/dist/project.d.ts +8 -0
- package/dist/project.d.ts.map +1 -0
- package/dist/project_class.d.ts +562 -0
- package/dist/project_class.d.ts.map +1 -0
- package/dist/project_internal.d.ts +194 -0
- package/dist/project_internal.d.ts.map +1 -0
- package/dist/project_synth.d.ts +74 -0
- package/dist/project_synth.d.ts.map +1 -0
- package/dist/project_types.d.ts +654 -0
- package/dist/project_types.d.ts.map +1 -0
- package/dist/public_types.d.ts +185 -0
- package/dist/public_types.d.ts.map +1 -0
- package/dist/public_types_acoustic.d.ts +215 -0
- package/dist/public_types_acoustic.d.ts.map +1 -0
- package/dist/public_types_mastering.d.ts +528 -0
- package/dist/public_types_mastering.d.ts.map +1 -0
- package/dist/public_types_mixing.d.ts +436 -0
- package/dist/public_types_mixing.d.ts.map +1 -0
- package/dist/public_types_music.d.ts +619 -0
- package/dist/public_types_music.d.ts.map +1 -0
- package/dist/public_types_playback.d.ts +165 -0
- package/dist/public_types_playback.d.ts.map +1 -0
- package/dist/public_types_realtime.d.ts +174 -0
- package/dist/public_types_realtime.d.ts.map +1 -0
- package/dist/public_types_repair.d.ts +424 -0
- package/dist/public_types_repair.d.ts.map +1 -0
- package/dist/public_types_spectral.d.ts +697 -0
- package/dist/public_types_spectral.d.ts.map +1 -0
- package/dist/quick_analysis.d.ts +445 -0
- package/dist/quick_analysis.d.ts.map +1 -0
- package/dist/realtime_engine.d.ts +893 -0
- package/dist/realtime_engine.d.ts.map +1 -0
- package/dist/realtime_voice_changer.d.ts +158 -0
- package/dist/realtime_voice_changer.d.ts.map +1 -0
- package/dist/repair_dereverb.d.ts +187 -0
- package/dist/repair_dereverb.d.ts.map +1 -0
- package/dist/repair_impulsive.d.ts +186 -0
- package/dist/repair_impulsive.d.ts.map +1 -0
- package/dist/repair_noise.d.ts +239 -0
- package/dist/repair_noise.d.ts.map +1 -0
- package/dist/repair_trim.d.ts +123 -0
- package/dist/repair_trim.d.ts.map +1 -0
- package/dist/sample_bank.d.ts +84 -0
- package/dist/sample_bank.d.ts.map +1 -0
- package/dist/scale.d.ts +10 -0
- package/dist/scale.d.ts.map +1 -0
- package/dist/schemas/mixer-scene.schema.json +393 -0
- package/dist/schemas/playback-renderer-config.schema.json +392 -0
- package/dist/sonare-analysis.d.ts +8 -0
- package/dist/sonare-analysis.js +2 -2
- package/dist/sonare-analysis.wasm +0 -0
- package/dist/sonare.d.ts +3945 -0
- package/dist/sonare.js +2 -2
- package/dist/sonare.wasm +0 -0
- package/dist/stream_analyzer.d.ts +163 -0
- package/dist/stream_analyzer.d.ts.map +1 -0
- package/dist/stream_types.d.ts +214 -0
- package/dist/stream_types.d.ts.map +1 -0
- package/dist/streaming_mixing.d.ts +6 -0
- package/dist/streaming_mixing.d.ts.map +1 -0
- package/dist/streaming_processors.d.ts +340 -0
- package/dist/streaming_processors.d.ts.map +1 -0
- package/dist/transcribe.d.ts +77 -0
- package/dist/transcribe.d.ts.map +1 -0
- package/dist/validation.d.ts +140 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/web_midi.d.ts +77 -0
- package/dist/web_midi.d.ts.map +1 -0
- package/dist/worker.d.ts +5 -48
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +94 -41
- package/dist/worker.js.map +1 -1
- package/dist/worker_client.d.ts +96 -0
- package/dist/worker_client.d.ts.map +1 -0
- package/dist/worker_protocol.d.ts +43 -0
- package/dist/worker_protocol.d.ts.map +1 -0
- package/dist/worklet/audio_types.d.ts +21 -0
- package/dist/worklet/audio_types.d.ts.map +1 -0
- package/dist/worklet/engine-automation.d.ts +29 -0
- package/dist/worklet/engine-automation.d.ts.map +1 -0
- package/dist/worklet/engine-capture-facade.d.ts +35 -0
- package/dist/worklet/engine-capture-facade.d.ts.map +1 -0
- package/dist/worklet/engine-clips.d.ts +23 -0
- package/dist/worklet/engine-clips.d.ts.map +1 -0
- package/dist/worklet/engine-markers.d.ts +40 -0
- package/dist/worklet/engine-markers.d.ts.map +1 -0
- package/dist/worklet/engine-mixer-facade.d.ts +164 -0
- package/dist/worklet/engine-mixer-facade.d.ts.map +1 -0
- package/dist/worklet/engine-node.d.ts +83 -0
- package/dist/worklet/engine-node.d.ts.map +1 -0
- package/dist/worklet/engine-offline.d.ts +81 -0
- package/dist/worklet/engine-offline.d.ts.map +1 -0
- package/dist/worklet/engine-options.d.ts +12 -0
- package/dist/worklet/engine-options.d.ts.map +1 -0
- package/dist/worklet/engine-parameter-facade.d.ts +106 -0
- package/dist/worklet/engine-parameter-facade.d.ts.map +1 -0
- package/dist/worklet/engine-processor.d.ts +72 -0
- package/dist/worklet/engine-processor.d.ts.map +1 -0
- package/dist/worklet/engine-register.d.ts +2 -0
- package/dist/worklet/engine-register.d.ts.map +1 -0
- package/dist/worklet/engine-strips.d.ts +75 -0
- package/dist/worklet/engine-strips.d.ts.map +1 -0
- package/dist/worklet/engine-sync.d.ts +39 -0
- package/dist/worklet/engine-sync.d.ts.map +1 -0
- package/dist/worklet/engine-tempo-facade.d.ts +48 -0
- package/dist/worklet/engine-tempo-facade.d.ts.map +1 -0
- package/dist/worklet/engine.d.ts +418 -0
- package/dist/worklet/engine.d.ts.map +1 -0
- package/dist/worklet/guards.d.ts +53 -0
- package/dist/worklet/guards.d.ts.map +1 -0
- package/dist/worklet/messages.d.ts +710 -0
- package/dist/worklet/messages.d.ts.map +1 -0
- package/dist/worklet/mixer-processor.d.ts +46 -0
- package/dist/worklet/mixer-processor.d.ts.map +1 -0
- package/dist/worklet/playback-processor.d.ts +62 -0
- package/dist/worklet/playback-processor.d.ts.map +1 -0
- package/dist/worklet/protocol.d.ts +331 -0
- package/dist/worklet/protocol.d.ts.map +1 -0
- package/dist/worklet/voice-changer-processor.d.ts +41 -0
- package/dist/worklet/voice-changer-processor.d.ts.map +1 -0
- package/dist/worklet.d.ts +16 -2515
- package/dist/worklet.d.ts.map +1 -0
- package/dist/worklet.js +3200 -541
- package/dist/worklet.js.map +1 -1
- package/package.json +23 -12
- package/src/_effects_common.ts +47 -0
- package/src/_feature_validation.ts +34 -0
- package/src/_fft_options.ts +39 -0
- package/src/align_take.ts +64 -0
- package/src/analysis.ts +56 -3
- package/src/analysis_helpers.ts +7 -0
- package/src/audio.ts +106 -3
- package/src/codes.ts +39 -2
- package/src/effects_mastering.ts +101 -22
- package/src/effects_note_ops.ts +683 -0
- package/src/effects_percussive.ts +217 -0
- package/src/effects_separation.ts +150 -0
- package/src/effects_spectral.ts +60 -0
- package/src/effects_timepitch.ts +388 -0
- package/src/errors.ts +23 -1
- package/src/feature_core.ts +127 -2
- package/src/feature_decompose.ts +633 -0
- package/src/feature_inverse.ts +454 -0
- package/src/feature_loudness.ts +125 -0
- package/src/feature_music.ts +107 -14
- package/src/feature_pitch.ts +96 -1
- package/src/feature_spectral.ts +16 -611
- package/src/feature_spectrogram.ts +63 -450
- package/src/features.ts +36 -22
- package/src/index.ts +288 -30
- package/src/instrument_types.ts +645 -0
- package/src/live_audio.ts +27 -1
- package/src/mastering_chain.ts +184 -0
- package/src/mastering_core.ts +441 -32
- package/src/mastering_dynamics.ts +22 -11
- package/src/metering.ts +67 -24
- package/src/mixer.ts +251 -22
- package/src/mixing_assistant.ts +138 -0
- package/src/mixing_oneshot.ts +10 -5
- package/src/module_state.ts +24 -2
- package/src/playback_renderer.ts +252 -0
- package/src/polyphony.ts +279 -0
- package/src/project.ts +61 -24
- package/src/project_class.ts +450 -27
- package/src/project_internal.ts +149 -42
- package/src/project_synth.ts +67 -1
- package/src/project_types.ts +271 -271
- package/src/public_types.ts +122 -3
- package/src/public_types_acoustic.ts +112 -3
- package/src/public_types_mastering.ts +275 -73
- package/src/public_types_mixing.ts +363 -1
- package/src/public_types_music.ts +312 -2
- package/src/public_types_playback.ts +196 -0
- package/src/public_types_realtime.ts +39 -7
- package/src/public_types_repair.ts +446 -0
- package/src/public_types_spectral.ts +491 -5
- package/src/quick_analysis.ts +203 -26
- package/src/realtime_engine.ts +773 -34
- package/src/realtime_voice_changer.ts +55 -1
- package/src/repair_dereverb.ts +299 -0
- package/src/repair_impulsive.ts +395 -0
- package/src/repair_noise.ts +425 -0
- package/src/repair_trim.ts +226 -0
- package/src/sample_bank.ts +113 -0
- package/src/sonare.js.d.ts +1158 -30
- package/src/stream_analyzer.ts +36 -4
- package/src/stream_types.ts +37 -0
- package/src/streaming_mixing.ts +1 -1
- package/src/streaming_processors.ts +202 -10
- package/src/transcribe.ts +89 -0
- package/src/validation.ts +285 -11
- package/src/web_midi.ts +1 -6
- package/src/worker.ts +18 -2
- package/src/worklet/audio_types.ts +37 -0
- package/src/worklet/engine-mixer-facade.ts +800 -32
- package/src/worklet/engine-node.ts +99 -29
- package/src/worklet/engine-offline.ts +14 -8
- package/src/worklet/engine-parameter-facade.ts +21 -0
- package/src/worklet/engine-processor.ts +332 -93
- package/src/worklet/engine-register.ts +32 -18
- package/src/worklet/engine-strips.ts +275 -9
- package/src/worklet/engine-sync.ts +20 -7
- package/src/worklet/engine.ts +394 -48
- package/src/worklet/guards.ts +195 -44
- package/src/worklet/messages.ts +229 -2
- package/src/worklet/mixer-processor.ts +117 -48
- package/src/worklet/playback-processor.ts +300 -0
- package/src/worklet/protocol.ts +82 -11
- package/src/worklet/voice-changer-processor.ts +17 -11
- package/src/worklet.ts +17 -0
- package/src/effects_transform.ts +0 -718
- package/src/mastering_repair.ts +0 -273
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Note-level editing: segmenting audio and a pitch track into editable notes,
|
|
3
|
+
* rendering an edited set back, and the split/merge operations over it.
|
|
4
|
+
*/
|
|
5
|
+
import type { NoteExtractorOptions, NoteMoveOptions, NoteObject, NoteObjectInput, NoteSetEntry, NoteStretchOptions, NoteTarget, NoteTargetAssignResult, NoteTargetUnmatchedPolicy, PitchDecompositionResult, VoicedFlags } from './public_types';
|
|
6
|
+
import type { ValidateOptions } from './validation';
|
|
7
|
+
export interface NoteStretchRequest extends NoteStretchOptions, ValidateOptions {
|
|
8
|
+
samples: Float32Array;
|
|
9
|
+
sampleRate?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface NoteMoveRequest extends NoteMoveOptions, ValidateOptions {
|
|
12
|
+
samples: Float32Array;
|
|
13
|
+
sampleRate?: number;
|
|
14
|
+
}
|
|
15
|
+
/** Canonical request form for {@link extractNotes}. */
|
|
16
|
+
export interface ExtractNotesRequest extends NoteExtractorOptions, ValidateOptions {
|
|
17
|
+
samples: Float32Array;
|
|
18
|
+
/**
|
|
19
|
+
* Sample rate in Hz. Required: `minNoteMs` and the per-frame RMS windows are
|
|
20
|
+
* converted to samples with this rate, so a wrong/omitted value silently
|
|
21
|
+
* segments differently.
|
|
22
|
+
*/
|
|
23
|
+
sampleRate: number;
|
|
24
|
+
/**
|
|
25
|
+
* Per-frame F0 in Hz. A frame carrying no pitch is spelled as zero, a
|
|
26
|
+
* negative value or a non-finite one, and all three read the same: that
|
|
27
|
+
* frame contributes no measurement. A {@link pitchPyin} track can be passed
|
|
28
|
+
* straight through — its `fillNa` is a choice about the contour you want,
|
|
29
|
+
* not a requirement of this call.
|
|
30
|
+
*/
|
|
31
|
+
f0Hz: Float32Array;
|
|
32
|
+
/** F0 frames per second. */
|
|
33
|
+
frameRate: number;
|
|
34
|
+
/** Per-frame voiced flags (truthy = voiced); takes precedence over `voicedProb` when supplied. Omit or pass `null` to use the probability array. */
|
|
35
|
+
voiced?: VoicedFlags | null;
|
|
36
|
+
/** Per-frame voicing probability in `[0, 1]`; read only when `voiced` is omitted or `null`. */
|
|
37
|
+
voicedProb?: Float32Array | null;
|
|
38
|
+
}
|
|
39
|
+
/** Canonical request form for {@link renderNotes}. */
|
|
40
|
+
export interface RenderNotesRequest extends ValidateOptions {
|
|
41
|
+
samples: Float32Array;
|
|
42
|
+
/**
|
|
43
|
+
* Sample rate in Hz. Required: `fadeMs` is converted to samples with this
|
|
44
|
+
* rate, so a wrong/omitted value changes the cross-fade length.
|
|
45
|
+
*/
|
|
46
|
+
sampleRate: number;
|
|
47
|
+
/** The notes to render, with their edits. Source spans must not overlap. */
|
|
48
|
+
notes: readonly NoteObjectInput[];
|
|
49
|
+
/**
|
|
50
|
+
* Equal-power cross-fade at each edited note's edges. Default 5 ms; a hard cut
|
|
51
|
+
* is deliberately not selectable, because the seam it leaves is a click.
|
|
52
|
+
*/
|
|
53
|
+
fadeMs?: number;
|
|
54
|
+
/**
|
|
55
|
+
* The F0 track the notes were extracted from. Required only by
|
|
56
|
+
* `vibratoDepthChange` and `driftChange`, which act on the note's own pitch
|
|
57
|
+
* curve, or when `voiced` is supplied; every other edit ignores it. The curve is not carried on a
|
|
58
|
+
* {@link NoteObject} for the same reason it is not returned by
|
|
59
|
+
* {@link extractNotes} — it is this array sliced by
|
|
60
|
+
* `[frameStart, frameEnd)`, which the caller already holds.
|
|
61
|
+
* Positive finite values are candidates for pitch. Zero, negative and
|
|
62
|
+
* non-finite values carry no measurement.
|
|
63
|
+
*/
|
|
64
|
+
f0Hz?: Float32Array;
|
|
65
|
+
/** Per-frame voiced flags for `f0Hz`; false suppresses a candidate and true cannot make an unusable F0 valid. */
|
|
66
|
+
voiced?: VoicedFlags | null;
|
|
67
|
+
/** F0 frames per second. Required when `f0Hz` is given. */
|
|
68
|
+
frameRate?: number;
|
|
69
|
+
/**
|
|
70
|
+
* Boundary between the drift and the vibrato that `vibratoDepthChange` and
|
|
71
|
+
* `driftChange` act on, in Hz. Default 3 Hz.
|
|
72
|
+
*
|
|
73
|
+
* Pass whatever {@link decomposeNotePitch} was called with. A host that draws
|
|
74
|
+
* the vibrato at one cutoff and edits it at another edits a curve it never
|
|
75
|
+
* showed anyone.
|
|
76
|
+
*/
|
|
77
|
+
vibratoCutoffHz?: number;
|
|
78
|
+
}
|
|
79
|
+
/** Canonical request form for {@link decomposeNotePitch}. */
|
|
80
|
+
export interface DecomposeNotePitchRequest {
|
|
81
|
+
/**
|
|
82
|
+
* The note's slice of the F0 track — `f0Hz.subarray(frameStart, frameEnd)`.
|
|
83
|
+
* Positive finite values carry pitch; other values carry no measurement.
|
|
84
|
+
*/
|
|
85
|
+
f0Hz: Float32Array;
|
|
86
|
+
/** Per-frame voiced flags matching `f0Hz`; false suppresses a candidate and true cannot make an unusable F0 valid. */
|
|
87
|
+
voiced?: VoicedFlags | null;
|
|
88
|
+
/** F0 frames per second. */
|
|
89
|
+
frameRate: number;
|
|
90
|
+
/**
|
|
91
|
+
* The note's `medianHz`. A note with no pitch is spelled 0, so a negative
|
|
92
|
+
* value is rejected rather than read as a second way of saying that.
|
|
93
|
+
*/
|
|
94
|
+
medianHz: number;
|
|
95
|
+
/** Where drift ends and vibrato begins, in Hz. Default 3 Hz. */
|
|
96
|
+
vibratoCutoffHz?: number;
|
|
97
|
+
}
|
|
98
|
+
/** The audio, track and note set the two note-set reshaping calls share. */
|
|
99
|
+
export interface NoteSetRequest extends NoteExtractorOptions, ValidateOptions {
|
|
100
|
+
/**
|
|
101
|
+
* The audio the set was extracted from. Every note is re-measured against it,
|
|
102
|
+
* so a different buffer re-derives the whole set against something else.
|
|
103
|
+
*/
|
|
104
|
+
samples: Float32Array;
|
|
105
|
+
sampleRate: number;
|
|
106
|
+
/**
|
|
107
|
+
* Per-frame F0 in Hz. A frame carrying no pitch is spelled as zero, a
|
|
108
|
+
* negative value or a non-finite one, and all three read the same: that
|
|
109
|
+
* frame contributes no measurement. A {@link pitchPyin} track can be passed
|
|
110
|
+
* straight through — its `fillNa` is a choice about the contour you want,
|
|
111
|
+
* not a requirement of this call.
|
|
112
|
+
*/
|
|
113
|
+
f0Hz: Float32Array;
|
|
114
|
+
/** F0 frames per second. */
|
|
115
|
+
frameRate: number;
|
|
116
|
+
/** Per-frame voiced flags (truthy = voiced); takes precedence over `voicedProb` when supplied. Omit or pass `null` to use the probability array. */
|
|
117
|
+
voiced?: VoicedFlags | null;
|
|
118
|
+
/** Per-frame voicing probability in `[0, 1]`; read only when `voiced` is omitted or `null`. */
|
|
119
|
+
voicedProb?: Float32Array | null;
|
|
120
|
+
/** The current note set. Each note's `[frameStart, frameEnd)` must be non-empty and inside the track. */
|
|
121
|
+
notes: readonly NoteSetEntry[];
|
|
122
|
+
}
|
|
123
|
+
/** Canonical request form for {@link splitNote}. */
|
|
124
|
+
export interface SplitNoteRequest extends NoteSetRequest {
|
|
125
|
+
/** Index of the note to split. */
|
|
126
|
+
index: number;
|
|
127
|
+
/** Track frame to cut at, strictly inside that note's own span. */
|
|
128
|
+
frame: number;
|
|
129
|
+
}
|
|
130
|
+
/** Canonical request form for {@link mergeNotes}. */
|
|
131
|
+
export interface MergeNotesRequest extends NoteSetRequest {
|
|
132
|
+
/** Index of the first note to join; must be `< last`. */
|
|
133
|
+
first: number;
|
|
134
|
+
/** Index of the last note to join, inclusive. */
|
|
135
|
+
last: number;
|
|
136
|
+
}
|
|
137
|
+
/** Canonical request form for {@link noteTargetsFromSmf}. */
|
|
138
|
+
export interface NoteTargetsFromSmfRequest {
|
|
139
|
+
/** The Standard MIDI File, in memory. */
|
|
140
|
+
data: Uint8Array;
|
|
141
|
+
/**
|
|
142
|
+
* Which MIDI-bearing track to read, NOT an index into the file's own tracks: a
|
|
143
|
+
* track holding only meta events — a conductor track carrying the tempo map is
|
|
144
|
+
* the usual one — is not counted. A file whose first track is a conductor track
|
|
145
|
+
* therefore has its melody at 0, which is also the default.
|
|
146
|
+
*/
|
|
147
|
+
trackIndex?: number;
|
|
148
|
+
}
|
|
149
|
+
/** Canonical request form for {@link assignNoteTargets}. */
|
|
150
|
+
export interface AssignNoteTargetsRequest {
|
|
151
|
+
/**
|
|
152
|
+
* The notes to assign targets to. Not modified; the result carries a new array.
|
|
153
|
+
* Only `onsetSample`, `offsetSample` and `medianHz` are read.
|
|
154
|
+
*/
|
|
155
|
+
notes: readonly NoteObject[];
|
|
156
|
+
/** Converts each note's sample span to seconds, so the targets line up. Must be > 0. */
|
|
157
|
+
sampleRate: number;
|
|
158
|
+
/** The reference melody. An empty array assigns nothing and applies the policy. */
|
|
159
|
+
targets: readonly NoteTarget[];
|
|
160
|
+
/** What to do with a note that has a pitch and no target. Default `'leave'`. */
|
|
161
|
+
unmatchedPolicy?: NoteTargetUnmatchedPolicy;
|
|
162
|
+
/**
|
|
163
|
+
* Fraction of the note that must overlap a target for it to count, in `[0, 1]`.
|
|
164
|
+
* Default 0.5. `0` is its own meaning — any overlap at all counts — not a
|
|
165
|
+
* request for the default.
|
|
166
|
+
*/
|
|
167
|
+
minOverlapRatio?: number;
|
|
168
|
+
/**
|
|
169
|
+
* Where the assigned shift saturates, in semitones. Default 12. `0` is its own
|
|
170
|
+
* meaning, as above: every correction saturates to nothing and the take is left
|
|
171
|
+
* as recorded. Must not be negative.
|
|
172
|
+
*/
|
|
173
|
+
maxCorrectionSemitones?: number;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Time-stretch a note region between two sample offsets without changing pitch.
|
|
177
|
+
*
|
|
178
|
+
* @param samples - Audio samples (mono, float32)
|
|
179
|
+
* @param sampleRate - Sample rate in Hz
|
|
180
|
+
* @param onsetSample - Note onset position in samples
|
|
181
|
+
* @param offsetSample - Note offset position in samples
|
|
182
|
+
* @param stretchRatio - Stretch ratio (0.5 = half duration, 2.0 = double duration)
|
|
183
|
+
* @returns Audio with the note region stretched
|
|
184
|
+
*/
|
|
185
|
+
export declare function noteStretch(request: NoteStretchRequest): Float32Array;
|
|
186
|
+
export declare function noteStretch(samples: Float32Array, sampleRate?: number, options?: NoteStretchOptions & ValidateOptions): Float32Array;
|
|
187
|
+
/** Move a note region to a new onset without changing its duration. */
|
|
188
|
+
export declare function noteMove(request: NoteMoveRequest): Float32Array;
|
|
189
|
+
export declare function noteMove(samples: Float32Array, sampleRate?: number, options?: NoteMoveOptions & ValidateOptions): Float32Array;
|
|
190
|
+
/**
|
|
191
|
+
* Extract editable note objects from audio and a caller-supplied F0 track.
|
|
192
|
+
*
|
|
193
|
+
* The track is segmented into monophonic notes; each note carries its span in
|
|
194
|
+
* source samples, its span in the track's own frames, its median pitch, two
|
|
195
|
+
* measured quality figures, its per-frame amplitude (RMS) curve, and an identity
|
|
196
|
+
* {@link NoteEdit}. Edit the notes and hand them to {@link renderNotes} to apply
|
|
197
|
+
* the result — the source audio is never mutated, and a set whose edits are all
|
|
198
|
+
* identity renders back to the input bit for bit.
|
|
199
|
+
*
|
|
200
|
+
* The per-note F0 curve is deliberately not returned: it is the caller's own
|
|
201
|
+
* `f0Hz` sliced by `[frameStart, frameEnd)`. The amplitude curve is measured
|
|
202
|
+
* here, so it is, one entry per F0 frame over that note's span.
|
|
203
|
+
*
|
|
204
|
+
* Voicing comes from `voiced` (truthy = voiced) when it is supplied. `voicedProb`
|
|
205
|
+
* is read only when `voiced` is absent or `null`, and then a frame counts as voiced at or above
|
|
206
|
+
* `voicedThreshold` (default 0.5). At least one of the two is required. Because
|
|
207
|
+
* `voicedProb` from pYIN rises with F0 for a fixed frame length, prefer passing
|
|
208
|
+
* a {@link PitchResult}'s `voicedFlag` through `voiced`.
|
|
209
|
+
*
|
|
210
|
+
* @param request - Audio, F0 track, frame cadence and segmenter options
|
|
211
|
+
* @returns One {@link NoteObject} per segmented note, in time order; an empty
|
|
212
|
+
* array when the track segments to nothing
|
|
213
|
+
* @throws RangeError when the selected voicing array differs from `f0Hz` in
|
|
214
|
+
* length (`voiced`, or `voicedProb` when `voiced` is omitted or `null`), or the
|
|
215
|
+
* samples/sample rate fail the shared input checks
|
|
216
|
+
* @throws SonareError (`InvalidParameter`) on an empty `f0Hz`, a non-positive
|
|
217
|
+
* `frameRate`, a `voicedProb` outside
|
|
218
|
+
* `[0, 1]`, or a negative option value
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* ```ts
|
|
222
|
+
* // pitchPyin's default leaves unvoiced frames NaN, which reads here as a
|
|
223
|
+
* // frame carrying no pitch, so fillNa is a choice rather than a requirement.
|
|
224
|
+
* const pitch = pitchPyin({ samples, sampleRate });
|
|
225
|
+
* const notes = extractNotes({
|
|
226
|
+
* samples,
|
|
227
|
+
* sampleRate,
|
|
228
|
+
* f0Hz: pitch.f0,
|
|
229
|
+
* voiced: pitch.voicedFlag,
|
|
230
|
+
* frameRate: sampleRate / 512,
|
|
231
|
+
* minNoteMs: 40,
|
|
232
|
+
* });
|
|
233
|
+
* // Lift the second note by a semitone and mute the third.
|
|
234
|
+
* notes[1].edit.pitchShiftSemitones = 1;
|
|
235
|
+
* notes[2].edit.muted = true;
|
|
236
|
+
* const edited = renderNotes({ samples, sampleRate, notes });
|
|
237
|
+
* ```
|
|
238
|
+
*/
|
|
239
|
+
export declare function extractNotes(request: ExtractNotesRequest): NoteObject[];
|
|
240
|
+
/**
|
|
241
|
+
* Render edited note objects back over their source audio.
|
|
242
|
+
*
|
|
243
|
+
* Only a note whose edit is non-identity is resynthesized; the source passes
|
|
244
|
+
* through everywhere else, so a set of untouched {@link extractNotes} output
|
|
245
|
+
* reproduces the input exactly. The output has the input's length: an edit that
|
|
246
|
+
* pushes a note past either end is truncated there.
|
|
247
|
+
*
|
|
248
|
+
* Per note the order is: pitch curve, time stretch, pitch shift, formant warp,
|
|
249
|
+
* amplitude envelope, then gain.
|
|
250
|
+
*
|
|
251
|
+
* Each note's `onsetSample`, `offsetSample` and `edit` are read, plus its
|
|
252
|
+
* `frameStart`, `frameEnd` and `medianHz` when the request carries an `f0Hz`
|
|
253
|
+
* track for a curve edit to act on; so an extracted note can be passed back
|
|
254
|
+
* as-is, or a note can be built by hand from those fields alone. Overlap is
|
|
255
|
+
* checked on the source spans only — where `timeOffsetSamples` lands a note is
|
|
256
|
+
* not, and a note lengthened past its own span writes into its neighbours'
|
|
257
|
+
* samples, so two moved or stretched notes may be written over each other.
|
|
258
|
+
*
|
|
259
|
+
* @param request - Source audio, the notes to render, the cross-fade length, and
|
|
260
|
+
* the F0 track a vibrato or drift edit reads
|
|
261
|
+
* @returns The rendered audio, the same length and sample rate as the input
|
|
262
|
+
* @throws TypeError when `notes` is not an array, `f0Hz` is not a
|
|
263
|
+
* `Float32Array`, or `voiced` is not a supported flag array
|
|
264
|
+
* @throws RangeError when `frameRate` is non-finite, `voiced` is supplied
|
|
265
|
+
* without `f0Hz`, when its length differs from `f0Hz`, or when the samples or
|
|
266
|
+
* sample rate fail shared checks
|
|
267
|
+
* @throws SonareError (`InvalidParameter`) on a note whose span is empty,
|
|
268
|
+
* reversed or missing, overlapping source spans, a non-finite or non-positive
|
|
269
|
+
* edit field, a negative or non-finite envelope value, a negative `fadeMs` or
|
|
270
|
+
* `vibratoCutoffHz`, a frame span outside `f0Hz`, or a `vibratoDepthChange` /
|
|
271
|
+
* `driftChange` on a note with no usable pitch curve to apply it to
|
|
272
|
+
*
|
|
273
|
+
* @example
|
|
274
|
+
* ```ts
|
|
275
|
+
* const notes = extractNotes({ samples, sampleRate, f0Hz, voiced, frameRate });
|
|
276
|
+
*
|
|
277
|
+
* // Silence the third note and leave the rest untouched.
|
|
278
|
+
* const muted = notes.map((note, index) =>
|
|
279
|
+
* index === 2 ? { ...note, edit: { ...note.edit, muted: true } } : note,
|
|
280
|
+
* );
|
|
281
|
+
* const rendered = renderNotes({ samples, sampleRate, notes: muted, fadeMs: 10 });
|
|
282
|
+
*
|
|
283
|
+
* // Flatten the first note's vibrato, which needs the track it was measured on.
|
|
284
|
+
* const flattened = notes.map((note, index) =>
|
|
285
|
+
* index === 0 ? { ...note, edit: { ...note.edit, vibratoDepthChange: -1 } } : note,
|
|
286
|
+
* );
|
|
287
|
+
* const steady = renderNotes({
|
|
288
|
+
* samples,
|
|
289
|
+
* sampleRate,
|
|
290
|
+
* notes: flattened,
|
|
291
|
+
* f0Hz,
|
|
292
|
+
* frameRate: sampleRate / 512,
|
|
293
|
+
* });
|
|
294
|
+
* ```
|
|
295
|
+
*/
|
|
296
|
+
export declare function renderNotes(request: RenderNotesRequest): Float32Array;
|
|
297
|
+
/**
|
|
298
|
+
* Split one note's pitch curve into a centre, a slow drift and a vibrato.
|
|
299
|
+
*
|
|
300
|
+
* A performed note's pitch is one curve carrying three things at once: the note
|
|
301
|
+
* that was aimed at, a slow wander around it, and a periodic oscillation on top.
|
|
302
|
+
* Editing any of them on its own needs them separated first, and the only thing
|
|
303
|
+
* that decides where drift ends and vibrato begins is `vibratoCutoffHz`. Hand
|
|
304
|
+
* the same cutoff to {@link renderNotes}, or it edits a curve nobody was shown.
|
|
305
|
+
*
|
|
306
|
+
* Frames whose F0 is unusable carry no measurement, so the curve is held at the
|
|
307
|
+
* nearest usable neighbour across them. Both curves therefore have an entry
|
|
308
|
+
* everywhere; when `voiced` is supplied, a host marking held frames should
|
|
309
|
+
* retain both the `f0Hz` and `voiced` arrays because a positive F0 can be
|
|
310
|
+
* explicitly suppressed. A false flag suppresses that frame and a true flag
|
|
311
|
+
* cannot make an unusable F0 valid.
|
|
312
|
+
*
|
|
313
|
+
* A note with no usable pitch is reported as a zero `centreHz` and two empty
|
|
314
|
+
* curves rather than as an error — that is a measurement which came up empty,
|
|
315
|
+
* not a bad argument.
|
|
316
|
+
*
|
|
317
|
+
* @param request - The note's slice of the F0 track, its cadence, its centre, and
|
|
318
|
+
* the cutoff
|
|
319
|
+
* @returns The centre and the two curves, each one entry per frame of `f0Hz`
|
|
320
|
+
* @throws TypeError when `f0Hz` is not a `Float32Array` or `voiced` is not a
|
|
321
|
+
* supported flag array
|
|
322
|
+
* @throws RangeError when `frameRate` is not finite or `voiced` differs in
|
|
323
|
+
* length from `f0Hz`
|
|
324
|
+
* @throws SonareError (`InvalidParameter`) on an empty `f0Hz`, a non-positive
|
|
325
|
+
* `frameRate`, a negative `medianHz`, or a negative `vibratoCutoffHz`
|
|
326
|
+
*
|
|
327
|
+
* @example
|
|
328
|
+
* ```ts
|
|
329
|
+
* const note = notes[0];
|
|
330
|
+
* const { centreHz, driftCents, vibratoCents } = decomposeNotePitch({
|
|
331
|
+
* f0Hz: f0Hz.subarray(note.frameStart, note.frameEnd),
|
|
332
|
+
* frameRate: sampleRate / 512,
|
|
333
|
+
* medianHz: note.medianHz,
|
|
334
|
+
* });
|
|
335
|
+
* ```
|
|
336
|
+
*/
|
|
337
|
+
export declare function decomposeNotePitch(request: DecomposeNotePitchRequest): PitchDecompositionResult;
|
|
338
|
+
/**
|
|
339
|
+
* Split one note of a set in two at a track frame.
|
|
340
|
+
*
|
|
341
|
+
* Both halves are re-derived from the audio and the track the way
|
|
342
|
+
* {@link extractNotes} derives its own, rather than by patching the fields of
|
|
343
|
+
* the note they replace. Both inherit the source note's edit, and the tail's
|
|
344
|
+
* `timeOffsetSamples` absorbs the duration change of the stretched head, so the
|
|
345
|
+
* halves occupy the destination timeline the unsplit note did; a note whose edit
|
|
346
|
+
* is the identity still renders bit for bit after being split. A half with no
|
|
347
|
+
* sample span at that boundary is omitted and the other keeps the edit
|
|
348
|
+
* unchanged. A one-entry envelope is a constant over the span, so both halves
|
|
349
|
+
* get that same entry; a longer one is resampled onto a grid that preserves the
|
|
350
|
+
* rendered gain at every integer source sample.
|
|
351
|
+
*
|
|
352
|
+
* Every note in the set, not just the two halves, has its spans, curves, medians
|
|
353
|
+
* and stability re-derived from `samples` and the track, because a
|
|
354
|
+
* {@link NoteSetEntry} carries no curves for this call to copy through. The
|
|
355
|
+
* frame bounds are therefore what a note is identified by here, and the audio
|
|
356
|
+
* and track must be the ones the set was extracted from or the whole set is
|
|
357
|
+
* re-measured against something else. A set whose re-derived notes would
|
|
358
|
+
* include one with no sample span is rejected rather than shortened.
|
|
359
|
+
*
|
|
360
|
+
* @param request - The source, the current note set, and where to cut
|
|
361
|
+
* @returns The whole new note set, one note longer than the one handed in, or
|
|
362
|
+
* the same length when a half with no sample span is omitted
|
|
363
|
+
* @throws RangeError when the selected voicing array differs from `f0Hz` in
|
|
364
|
+
* length (`voiced`, or `voicedProb` when `voiced` is omitted or `null`), or the
|
|
365
|
+
* samples/sample rate fail the shared input checks
|
|
366
|
+
* @throws SonareError (`InvalidParameter`) on an out-of-range `index`, a `frame`
|
|
367
|
+
* that is not strictly inside that note's own span, a note whose frame span is
|
|
368
|
+
* empty or runs past the track, or the track arguments {@link extractNotes}
|
|
369
|
+
* itself rejects
|
|
370
|
+
*
|
|
371
|
+
* @example
|
|
372
|
+
* ```ts
|
|
373
|
+
* const notes = extractNotes({ samples, sampleRate, f0Hz, voiced, frameRate });
|
|
374
|
+
* const halves = splitNote({
|
|
375
|
+
* samples,
|
|
376
|
+
* sampleRate,
|
|
377
|
+
* f0Hz,
|
|
378
|
+
* voiced,
|
|
379
|
+
* frameRate,
|
|
380
|
+
* notes,
|
|
381
|
+
* index: 1,
|
|
382
|
+
* frame: Math.floor((notes[1].frameStart + notes[1].frameEnd) / 2),
|
|
383
|
+
* });
|
|
384
|
+
* ```
|
|
385
|
+
*/
|
|
386
|
+
export declare function splitNote(request: SplitNoteRequest): NoteObject[];
|
|
387
|
+
/**
|
|
388
|
+
* Join a run of notes into one.
|
|
389
|
+
*
|
|
390
|
+
* The result spans from `notes[first]`'s onset to `notes[last]`'s offset,
|
|
391
|
+
* including whatever the segmenter cut out between them, and its measured fields
|
|
392
|
+
* are derived over that whole span — the pitch and amplitude of an unvoiced gap
|
|
393
|
+
* live in the track and the audio, not in either neighbour.
|
|
394
|
+
*
|
|
395
|
+
* It takes `notes[first]`'s edit, envelope included. Notes carrying different
|
|
396
|
+
* edits have no single correct answer here, so the rule is stated rather than
|
|
397
|
+
* guessed at; a host that cares sets the edit afterwards. Every note in the set
|
|
398
|
+
* is re-derived from `samples` and the track, exactly as {@link splitNote}
|
|
399
|
+
* describes.
|
|
400
|
+
*
|
|
401
|
+
* @param request - The source, the current note set, and the run to join
|
|
402
|
+
* @returns The whole new note set, `last - first` notes shorter than the one
|
|
403
|
+
* handed in
|
|
404
|
+
* @throws RangeError when the selected voicing array differs from `f0Hz` in
|
|
405
|
+
* length (`voiced`, or `voicedProb` when `voiced` is omitted or `null`), or the
|
|
406
|
+
* samples/sample rate fail the shared input checks
|
|
407
|
+
* @throws SonareError (`InvalidParameter`) unless `first < last < notes.length`,
|
|
408
|
+
* on a note whose frame span is empty or runs past the track, or on the track
|
|
409
|
+
* arguments {@link extractNotes} itself rejects
|
|
410
|
+
*
|
|
411
|
+
* @example
|
|
412
|
+
* ```ts
|
|
413
|
+
* // Undo a split by rejoining the two halves it produced.
|
|
414
|
+
* const rejoined = mergeNotes({
|
|
415
|
+
* samples,
|
|
416
|
+
* sampleRate,
|
|
417
|
+
* f0Hz,
|
|
418
|
+
* voiced,
|
|
419
|
+
* frameRate,
|
|
420
|
+
* notes: halves,
|
|
421
|
+
* first: 1,
|
|
422
|
+
* last: 2,
|
|
423
|
+
* });
|
|
424
|
+
* ```
|
|
425
|
+
*/
|
|
426
|
+
export declare function mergeNotes(request: MergeNotesRequest): NoteObject[];
|
|
427
|
+
/**
|
|
428
|
+
* Read one track of an in-memory Standard MIDI File as a reference melody.
|
|
429
|
+
*
|
|
430
|
+
* Each note-on is paired with the next note-off of the same note number on the
|
|
431
|
+
* same channel, and the pair becomes one {@link NoteTarget} at the note's own
|
|
432
|
+
* pitch. Times come from the file's tempo map, so a tempo change or a ramp inside
|
|
433
|
+
* it is followed rather than the initial tempo being scaled.
|
|
434
|
+
*
|
|
435
|
+
* A note-on the track never closes is dropped: it has no end, and the track's end
|
|
436
|
+
* is not a substitute for one — with events after it the note would span the whole
|
|
437
|
+
* remainder and, being the longest overlap everywhere, take the assignment away
|
|
438
|
+
* from every note that follows. Zero-length notes are skipped for the mirror
|
|
439
|
+
* reason: they overlap nothing, so they could never be assigned.
|
|
440
|
+
*
|
|
441
|
+
* @param request - The file's bytes and which MIDI-bearing track to read
|
|
442
|
+
* @returns One target per closed note, sorted by `startSec`; an empty array for a
|
|
443
|
+
* track with no closed note, which is a measurement that came up empty rather
|
|
444
|
+
* than an error
|
|
445
|
+
* @throws SonareError (`InvalidFormat`) when the bytes are not a readable SMF
|
|
446
|
+
* @throws SonareError (`InvalidParameter`) when `trackIndex` names no
|
|
447
|
+
* MIDI-bearing track
|
|
448
|
+
*
|
|
449
|
+
* @example
|
|
450
|
+
* ```ts
|
|
451
|
+
* // A project's own export writes the tempo map as a conductor track, which
|
|
452
|
+
* // carries no MIDI, so the melody is at index 0 rather than 1.
|
|
453
|
+
* const targets = noteTargetsFromSmf({ data: project.exportSmf() });
|
|
454
|
+
* ```
|
|
455
|
+
*/
|
|
456
|
+
export declare function noteTargetsFromSmf(request: NoteTargetsFromSmfRequest): NoteTarget[];
|
|
457
|
+
/**
|
|
458
|
+
* Write each note's `edit.pitchShiftSemitones` from the reference target it
|
|
459
|
+
* overlaps, which is what makes a take follow a written melody instead of a
|
|
460
|
+
* single stated interval.
|
|
461
|
+
*
|
|
462
|
+
* A note is matched to the target it overlaps longest, provided that overlap is
|
|
463
|
+
* at least `minOverlapRatio` of the note's own span; an exact tie goes to the
|
|
464
|
+
* target that starts first, so the answer does not depend on the order the
|
|
465
|
+
* targets arrived in. The shift is `targetMidi` minus the note's own `medianHz`
|
|
466
|
+
* as a MIDI number, saturated at `maxCorrectionSemitones` — a reference an octave
|
|
467
|
+
* out is a wrong reference, and a rejected call would tell the caller less than a
|
|
468
|
+
* bounded correction does.
|
|
469
|
+
*
|
|
470
|
+
* A note whose `medianHz` is not finite and positive is never assigned and never
|
|
471
|
+
* edited, whatever `unmatchedPolicy` says. Such a note has no measured pitch to
|
|
472
|
+
* correct from, so `'nearest'` would compute a shift from a pitch that does not
|
|
473
|
+
* exist; the policy governs notes that have a pitch and no target, which is a
|
|
474
|
+
* different thing from having no pitch.
|
|
475
|
+
*
|
|
476
|
+
* The notes handed in are not modified. Only `edit.pitchShiftSemitones` and
|
|
477
|
+
* `edit.muted` are written on the returned copies; every other field of a note —
|
|
478
|
+
* its spans, its metrics, its amplitude curve and its other edits — comes back
|
|
479
|
+
* exactly as it went in.
|
|
480
|
+
*
|
|
481
|
+
* @param request - The notes, their sample rate, the reference melody, and the
|
|
482
|
+
* three tunable knobs
|
|
483
|
+
* @returns The new note set and how many notes received a target
|
|
484
|
+
* @throws SonareError (`InvalidParameter`) on a non-positive `sampleRate`, an
|
|
485
|
+
* unknown `unmatchedPolicy`, a `minOverlapRatio` outside `[0, 1]`, a negative
|
|
486
|
+
* `maxCorrectionSemitones`, a note missing `onsetSample` / `offsetSample`, or a
|
|
487
|
+
* target whose `startSec`, `endSec` or `targetMidi` is not finite
|
|
488
|
+
*
|
|
489
|
+
* @example
|
|
490
|
+
* ```ts
|
|
491
|
+
* const notes = extractNotes({ samples, sampleRate, f0Hz, voiced, frameRate });
|
|
492
|
+
* const { notes: retuned, assignedCount } = assignNoteTargets({
|
|
493
|
+
* notes,
|
|
494
|
+
* sampleRate,
|
|
495
|
+
* targets: noteTargetsFromSmf({ data: smf }),
|
|
496
|
+
* unmatchedPolicy: 'mute',
|
|
497
|
+
* });
|
|
498
|
+
* const corrected = renderNotes({ samples, sampleRate, notes: retuned });
|
|
499
|
+
* ```
|
|
500
|
+
*/
|
|
501
|
+
export declare function assignNoteTargets(request: AssignNoteTargetsRequest): NoteTargetAssignResult;
|
|
502
|
+
//# sourceMappingURL=effects_note_ops.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"effects_note_ops.d.ts","sourceRoot":"","sources":["../src/effects_note_ops.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EACV,oBAAoB,EACpB,eAAe,EACf,UAAU,EACV,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,sBAAsB,EACtB,yBAAyB,EACzB,wBAAwB,EACxB,WAAW,EACZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAsBpD,MAAM,WAAW,kBAAmB,SAAQ,kBAAkB,EAAE,eAAe;IAC7E,OAAO,EAAE,YAAY,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAgB,SAAQ,eAAe,EAAE,eAAe;IACvE,OAAO,EAAE,YAAY,CAAC;IACtB,UAAU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