@libraz/libsonare 1.7.2 → 1.8.0
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 +6 -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 +873 -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 +477 -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 +129 -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 +3758 -1362
- 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 +457 -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 +652 -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 +510 -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 +164 -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 +850 -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 +3909 -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 +335 -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 +128 -0
- package/dist/worklet/engine-mixer-facade.d.ts.map +1 -0
- package/dist/worklet/engine-node.d.ts +81 -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 +68 -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 +73 -0
- package/dist/worklet/engine-strips.d.ts.map +1 -0
- package/dist/worklet/engine-sync.d.ts +37 -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 +397 -0
- package/dist/worklet/engine.d.ts.map +1 -0
- package/dist/worklet/guards.d.ts +47 -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 +323 -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 +2763 -501
- package/dist/worklet.js.map +1 -1
- package/package.json +23 -12
- package/src/_effects_common.ts +17 -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 +97 -22
- package/src/effects_note_ops.ts +635 -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 +377 -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 +282 -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 +346 -32
- package/src/mastering_dynamics.ts +22 -11
- package/src/metering.ts +67 -24
- package/src/mixer.ts +212 -3
- 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 +268 -270
- package/src/public_types.ts +122 -3
- package/src/public_types_acoustic.ts +112 -3
- package/src/public_types_mastering.ts +254 -73
- package/src/public_types_mixing.ts +363 -1
- package/src/public_types_music.ts +312 -2
- package/src/public_types_playback.ts +195 -0
- package/src/public_types_realtime.ts +39 -7
- package/src/public_types_repair.ts +446 -0
- package/src/public_types_spectral.ts +487 -1
- package/src/quick_analysis.ts +203 -26
- package/src/realtime_engine.ts +711 -28
- 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 +1122 -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 +194 -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 +444 -10
- package/src/worklet/engine-node.ts +78 -26
- package/src/worklet/engine-offline.ts +14 -8
- package/src/worklet/engine-parameter-facade.ts +21 -0
- package/src/worklet/engine-processor.ts +272 -83
- package/src/worklet/engine-register.ts +32 -18
- package/src/worklet/engine-strips.ts +280 -9
- package/src/worklet/engine-sync.ts +14 -6
- package/src/worklet/engine.ts +365 -31
- package/src/worklet/guards.ts +140 -44
- package/src/worklet/messages.ts +227 -2
- package/src/worklet/mixer-processor.ts +109 -47
- package/src/worklet/playback-processor.ts +300 -0
- package/src/worklet/protocol.ts +53 -3
- 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,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Broadband and tonal noise repair: denoise and dehum, with their detectors.
|
|
3
|
+
*/
|
|
4
|
+
import type { HumDetection, MasteringRepairDehumStereoResult, MasteringRepairDenoiseClassicalLinkedResult, MasteringRepairDenoiseClassicalStereoResult, NoiseDetection } from './public_types_repair';
|
|
5
|
+
/** Algorithms accepted by `masteringRepairDenoiseClassical`. */
|
|
6
|
+
export type DenoiseClassicalMode = 'logMmse' | 'mmseStsa' | 'spectralSubtraction';
|
|
7
|
+
/** Noise PSD estimators accepted by `masteringRepairDenoiseClassical`. */
|
|
8
|
+
export type DenoiseClassicalNoiseEstimator = 'quantile' | 'mcra' | 'imcra' | 'spp';
|
|
9
|
+
/** Options for `masteringRepairDenoiseClassical`. */
|
|
10
|
+
export interface DenoiseClassicalOptions {
|
|
11
|
+
mode?: DenoiseClassicalMode;
|
|
12
|
+
noiseEstimator?: DenoiseClassicalNoiseEstimator;
|
|
13
|
+
nFft?: number;
|
|
14
|
+
hopLength?: number;
|
|
15
|
+
ddAlpha?: number;
|
|
16
|
+
reductionDb?: number;
|
|
17
|
+
overSubtraction?: number;
|
|
18
|
+
spectralFloor?: number;
|
|
19
|
+
noiseEstimationQuantile?: number;
|
|
20
|
+
speechPresenceGain?: boolean;
|
|
21
|
+
gainSmoothing?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface MasteringRepairDenoiseClassicalRequest extends DenoiseClassicalOptions {
|
|
24
|
+
samples: Float32Array;
|
|
25
|
+
sampleRate: number;
|
|
26
|
+
}
|
|
27
|
+
/** Request form of `masteringRepairDenoiseClassicalStereo`. */
|
|
28
|
+
export interface MasteringRepairDenoiseClassicalStereoRequest extends DenoiseClassicalOptions {
|
|
29
|
+
left: Float32Array;
|
|
30
|
+
right: Float32Array;
|
|
31
|
+
sampleRate?: number;
|
|
32
|
+
}
|
|
33
|
+
/** Request form of `masteringRepairDenoiseClassicalLinked`. */
|
|
34
|
+
export interface MasteringRepairDenoiseClassicalLinkedRequest extends DenoiseClassicalOptions {
|
|
35
|
+
/** At least one channel; all the same length. */
|
|
36
|
+
channels: Float32Array[];
|
|
37
|
+
sampleRate?: number;
|
|
38
|
+
}
|
|
39
|
+
/** Offline STFT-domain classical denoiser (LogMMSE / MMSE-STSA / SpectralSubtraction). */
|
|
40
|
+
export declare function masteringRepairDenoiseClassical(request: MasteringRepairDenoiseClassicalRequest): Float32Array;
|
|
41
|
+
export declare function masteringRepairDenoiseClassical(samples: Float32Array, sampleRate: number, options?: DenoiseClassicalOptions): Float32Array;
|
|
42
|
+
/**
|
|
43
|
+
* Offline STFT-domain classical denoiser for a stereo pair, driven by one channel-linked
|
|
44
|
+
* gain mask.
|
|
45
|
+
*
|
|
46
|
+
* The mask is built from the channel-summed power and applied unchanged to both channels, so
|
|
47
|
+
* the pass cannot move an interchannel level or phase difference. That is also why the result
|
|
48
|
+
* carries a single `report` rather than one per channel: a pair would be two copies of one
|
|
49
|
+
* measurement and would read as though the two could differ.
|
|
50
|
+
*
|
|
51
|
+
* `report.detected` is therefore a *pair-level* measurement, and the only absolute one in the
|
|
52
|
+
* result. Its levels are dBFS on the channel-summed power, so two identical channels read
|
|
53
|
+
* `10*log10(2)` — about 3.01 dB — above the same material through
|
|
54
|
+
* {@link masteringRepairDenoiseClassical}. A stereo floor is comparable only against another
|
|
55
|
+
* stereo floor, never against a mono one.
|
|
56
|
+
*
|
|
57
|
+
* Needs at least `nFft` samples and REJECTS a shorter input, which is the opposite of
|
|
58
|
+
* {@link masteringRepairDereverbClassicalStereo} — that one pads.
|
|
59
|
+
*
|
|
60
|
+
* Which options are live depends on `mode`: `overSubtraction` and `spectralFloor` are read
|
|
61
|
+
* only by `spectralSubtraction`, and `speechPresenceGain` and `gainSmoothing` only by the
|
|
62
|
+
* other two, so at the default `logMmse` the first pair does nothing.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* const { left, right, report } = masteringRepairDenoiseClassicalStereo({
|
|
67
|
+
* left: leftSamples,
|
|
68
|
+
* right: rightSamples,
|
|
69
|
+
* sampleRate: 48000,
|
|
70
|
+
* reductionDb: 18,
|
|
71
|
+
* });
|
|
72
|
+
* console.log(report.detected.floorDbfs, report.meanReductionDb);
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export declare function masteringRepairDenoiseClassicalStereo(request: MasteringRepairDenoiseClassicalStereoRequest): MasteringRepairDenoiseClassicalStereoResult;
|
|
76
|
+
export declare function masteringRepairDenoiseClassicalStereo(left: Float32Array, right: Float32Array, sampleRate: number, config?: DenoiseClassicalOptions): MasteringRepairDenoiseClassicalStereoResult;
|
|
77
|
+
/**
|
|
78
|
+
* Offline STFT-domain classical denoiser for any number of channels, driven by one
|
|
79
|
+
* channel-linked gain mask.
|
|
80
|
+
*
|
|
81
|
+
* The N-channel form of {@link masteringRepairDenoiseClassicalStereo}, carrying the same
|
|
82
|
+
* guarantee over the whole set: the mask is built from the channel-summed power and applied
|
|
83
|
+
* unchanged to every channel, so no interchannel level or phase difference moves however many
|
|
84
|
+
* channels there are. One `report` for the set, and one output per input channel in input order.
|
|
85
|
+
*
|
|
86
|
+
* A single channel reproduces {@link masteringRepairDenoiseClassical} bit for bit, and two
|
|
87
|
+
* reproduce {@link masteringRepairDenoiseClassicalStereo} plane for plane — `channels[0]` is the
|
|
88
|
+
* left plane and `channels[1]` the right.
|
|
89
|
+
*
|
|
90
|
+
* `report.detected` carries absolute levels and they are the SET's: the floor is referred to the
|
|
91
|
+
* summed mean square of every channel, so N identical channels read `10*log10(N)` above
|
|
92
|
+
* one of them — about 3.01 dB at two channels and 4.77 dB at three. Compare a floor only against
|
|
93
|
+
* one measured over the same number of channels. Every other field of the report is a fraction
|
|
94
|
+
* and does not move with the channel count.
|
|
95
|
+
*
|
|
96
|
+
* Needs at least `nFft` samples and REJECTS a shorter input, which is the opposite of
|
|
97
|
+
* {@link masteringRepairDereverbClassicalLinked} — that one pads.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```ts
|
|
101
|
+
* const { channels, report } = masteringRepairDenoiseClassicalLinked({
|
|
102
|
+
* channels: [frontLeft, frontRight, centre],
|
|
103
|
+
* sampleRate: 48000,
|
|
104
|
+
* reductionDb: 18,
|
|
105
|
+
* });
|
|
106
|
+
* console.log(channels.length, report.detected.floorDbfs);
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
export declare function masteringRepairDenoiseClassicalLinked(request: MasteringRepairDenoiseClassicalLinkedRequest): MasteringRepairDenoiseClassicalLinkedResult;
|
|
110
|
+
export declare function masteringRepairDenoiseClassicalLinked(channels: Float32Array[], sampleRate: number, config?: DenoiseClassicalOptions): MasteringRepairDenoiseClassicalLinkedResult;
|
|
111
|
+
/**
|
|
112
|
+
* How `masteringRepairDehum` removes the harmonic series.
|
|
113
|
+
*
|
|
114
|
+
* `subtract` tracks each harmonic's amplitude and phase and subtracts the tone they describe,
|
|
115
|
+
* so material sitting at the same frequency but uncorrelated with the tracked series survives.
|
|
116
|
+
* `notch` cascades one RBJ notch per harmonic and removes everything inside each notch's
|
|
117
|
+
* bandwidth, hum or programme alike.
|
|
118
|
+
*/
|
|
119
|
+
export type DehumMode = 'subtract' | 'notch';
|
|
120
|
+
/** Options for `masteringRepairDehum`. */
|
|
121
|
+
export interface DehumOptions {
|
|
122
|
+
fundamentalHz?: number;
|
|
123
|
+
harmonics?: number;
|
|
124
|
+
q?: number;
|
|
125
|
+
adaptive?: boolean;
|
|
126
|
+
searchRangeHz?: number;
|
|
127
|
+
adaptation?: number;
|
|
128
|
+
frameSize?: number;
|
|
129
|
+
pllBandwidth?: number;
|
|
130
|
+
/** Defaults to `'subtract'`. */
|
|
131
|
+
mode?: DehumMode;
|
|
132
|
+
}
|
|
133
|
+
export interface MasteringRepairDehumRequest extends DehumOptions {
|
|
134
|
+
samples: Float32Array;
|
|
135
|
+
sampleRate: number;
|
|
136
|
+
}
|
|
137
|
+
/** Request form of `masteringRepairDehumStereo`. */
|
|
138
|
+
export interface MasteringRepairDehumStereoRequest extends DehumOptions {
|
|
139
|
+
left: Float32Array;
|
|
140
|
+
right: Float32Array;
|
|
141
|
+
sampleRate?: number;
|
|
142
|
+
}
|
|
143
|
+
/** Offline mains-hum remover. */
|
|
144
|
+
export declare function masteringRepairDehum(request: MasteringRepairDehumRequest): Float32Array;
|
|
145
|
+
export declare function masteringRepairDehum(samples: Float32Array, sampleRate: number, options?: DehumOptions): Float32Array;
|
|
146
|
+
/**
|
|
147
|
+
* Offline mains-hum remover for a stereo pair.
|
|
148
|
+
*
|
|
149
|
+
* With `adaptive` set, mains hum is one physical source, so the tracker reads the channel
|
|
150
|
+
* mean and both cascades follow the one frequency it finds: `appliedFundamentalHz` and
|
|
151
|
+
* `fundamentalDriftHz` come back identical in both reports by construction, while each
|
|
152
|
+
* report's `detected` still measures that channel's own input and each channel keeps its
|
|
153
|
+
* own filter state, so neither channel's transient rings through the other. With `adaptive`
|
|
154
|
+
* clear, which is the default, nothing is shared and the two channels are filtered
|
|
155
|
+
* independently at the configured frequency.
|
|
156
|
+
*/
|
|
157
|
+
export declare function masteringRepairDehumStereo(request: MasteringRepairDehumStereoRequest): MasteringRepairDehumStereoResult;
|
|
158
|
+
export declare function masteringRepairDehumStereo(left: Float32Array, right: Float32Array, sampleRate: number, config?: DehumOptions): MasteringRepairDehumStereoResult;
|
|
159
|
+
/** Request form of `masteringRepairDetectNoiseFloor`. */
|
|
160
|
+
export interface MasteringRepairDetectNoiseFloorRequest extends DenoiseClassicalOptions {
|
|
161
|
+
samples: Float32Array;
|
|
162
|
+
sampleRate: number;
|
|
163
|
+
}
|
|
164
|
+
/** Request form of `masteringRepairNoiseBandBins`. */
|
|
165
|
+
export interface MasteringRepairNoiseBandBinsRequest {
|
|
166
|
+
nFft?: number;
|
|
167
|
+
sampleRate?: number;
|
|
168
|
+
}
|
|
169
|
+
/** Request form of `masteringRepairDetectHum`. */
|
|
170
|
+
export interface MasteringRepairDetectHumRequest extends DehumOptions {
|
|
171
|
+
samples: Float32Array;
|
|
172
|
+
sampleRate: number;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Measures the noise floor without denoising.
|
|
176
|
+
*
|
|
177
|
+
* Runs the STFT and the configured noise estimator — the two stages
|
|
178
|
+
* {@link masteringRepairDenoiseClassical} runs — and stops before the gain mask, which is why
|
|
179
|
+
* no attenuation figure appears here.
|
|
180
|
+
*
|
|
181
|
+
* Needs at least `nFft` samples and THROWS for a shorter buffer, the opposite of
|
|
182
|
+
* {@link masteringRepairDetectReverb}, which pads one.
|
|
183
|
+
*
|
|
184
|
+
* `floorDbfs` is an absolute level, so it is comparable only against another figure measured
|
|
185
|
+
* over the same channel count.
|
|
186
|
+
*/
|
|
187
|
+
export declare function masteringRepairDetectNoiseFloor(request: MasteringRepairDetectNoiseFloorRequest): NoiseDetection;
|
|
188
|
+
export declare function masteringRepairDetectNoiseFloor(samples: Float32Array, sampleRate: number, options?: DenoiseClassicalOptions): NoiseDetection;
|
|
189
|
+
/**
|
|
190
|
+
* Bin boundaries of the grid {@link masteringRepairDetectNoiseFloor} reports `bandFloorDbfs` on.
|
|
191
|
+
*
|
|
192
|
+
* Band `k` covers the one-sided STFT bins `[bins[k], bins[k + 1])`, and bin `b` sits at
|
|
193
|
+
* `b * sampleRate / nFft` Hz.
|
|
194
|
+
*
|
|
195
|
+
* The geometric band edges are rounded to bins, so a band narrower than the bin spacing comes
|
|
196
|
+
* out EMPTY — `bins[k] === bins[k + 1]` — and its `bandFloorDbfs[k]` reads as the floor
|
|
197
|
+
* sentinel because no bin landed in it, NOT because that region was quiet. Telling those two
|
|
198
|
+
* apart is what this grid is for, and the rounding cannot be recovered from the band count
|
|
199
|
+
* alone.
|
|
200
|
+
*
|
|
201
|
+
* Nothing but the analysis geometry decides the grid, so no denoise config is taken: one call
|
|
202
|
+
* describes every floor measured at that `nFft` and `sampleRate`, whatever mode or estimator
|
|
203
|
+
* produced it.
|
|
204
|
+
*
|
|
205
|
+
* @param nFft - STFT size the bins belong to; a positive power of two, the same rule
|
|
206
|
+
* {@link masteringRepairDetectNoiseFloor} applies to its config, so every grid returned here
|
|
207
|
+
* is one that entry can report on. Defaults to 1024.
|
|
208
|
+
* @param sampleRate - Sample rate the bins belong to, in Hz; positive. Defaults to 22050.
|
|
209
|
+
* @returns 33 bin indices, low to high — one more than the 32 bands: the first bin of every
|
|
210
|
+
* band plus the one-past-the-end bin of the last, which is `nFft / 2 + 1`. Non-decreasing.
|
|
211
|
+
* @throws If `nFft` is not a positive power of two, or `sampleRate` is not positive.
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* ```ts
|
|
215
|
+
* const bins = masteringRepairNoiseBandBins({ nFft: 1024, sampleRate: 48000 });
|
|
216
|
+
* const floor = masteringRepairDetectNoiseFloor({ samples, sampleRate: 48000, nFft: 1024 });
|
|
217
|
+
* floor.bandFloorDbfs.forEach((level, k) => {
|
|
218
|
+
* if (bins[k] === bins[k + 1]) return; // empty band: `level` is the sentinel, not a measurement
|
|
219
|
+
* console.log((bins[k] * 48000) / 1024, level);
|
|
220
|
+
* });
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
export declare function masteringRepairNoiseBandBins(request?: MasteringRepairNoiseBandBinsRequest): Int32Array;
|
|
224
|
+
export declare function masteringRepairNoiseBandBins(nFft?: number, sampleRate?: number): Int32Array;
|
|
225
|
+
/**
|
|
226
|
+
* Measures hum without filtering.
|
|
227
|
+
*
|
|
228
|
+
* Always runs the estimation path, whatever `adaptive` says: the fixed path notches the
|
|
229
|
+
* configured frequency without ever looking for hum, so a detector following the flag would
|
|
230
|
+
* hand back its own input. `fundamentalProminence` is the winning candidate's projected energy
|
|
231
|
+
* over the median candidate, so `1.0` means no peak was found at all — it is not a lock flag.
|
|
232
|
+
*
|
|
233
|
+
* `harmonicDbfs` is measured at every `k*f0` the sample rate carries, not only the ones a
|
|
234
|
+
* cascade would notch; a `k*f0` at or past Nyquist reads the dB floor because nothing is there
|
|
235
|
+
* to measure.
|
|
236
|
+
*/
|
|
237
|
+
export declare function masteringRepairDetectHum(request: MasteringRepairDetectHumRequest): HumDetection;
|
|
238
|
+
export declare function masteringRepairDetectHum(samples: Float32Array, sampleRate: number, options?: DehumOptions): HumDetection;
|
|
239
|
+
//# sourceMappingURL=repair_noise.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repair_noise.d.ts","sourceRoot":"","sources":["../src/repair_noise.ts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;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,CAAC,EAAE,mCAAmC,GAC5C,UAAU,CAAC;AACd,wBAAgB,4BAA4B,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;AAe7F;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,+BAA+B,GAAG,YAAY,CAAC;AACjG,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,YAAY,GACrB,YAAY,CAAC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Silence trimming, with the range detector it shares its geometry with.
|
|
3
|
+
*/
|
|
4
|
+
import type { MasteringRepairTrimSilenceStereoResult, TrimRange } from './public_types_repair';
|
|
5
|
+
/** Trimming modes accepted by `masteringRepairTrimSilence`. */
|
|
6
|
+
export type TrimSilenceMode = 'peak' | 'lufsGated';
|
|
7
|
+
/** Options for `masteringRepairTrimSilence`. */
|
|
8
|
+
export interface TrimSilenceOptions {
|
|
9
|
+
threshold?: number;
|
|
10
|
+
paddingSamples?: number;
|
|
11
|
+
mode?: TrimSilenceMode;
|
|
12
|
+
gateLufs?: number;
|
|
13
|
+
windowMs?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface MasteringRepairTrimSilenceRequest extends TrimSilenceOptions {
|
|
16
|
+
samples: Float32Array;
|
|
17
|
+
sampleRate: number;
|
|
18
|
+
}
|
|
19
|
+
/** Request form of `masteringRepairTrimSilenceStereo`. */
|
|
20
|
+
export interface MasteringRepairTrimSilenceStereoRequest extends TrimSilenceOptions {
|
|
21
|
+
left: Float32Array;
|
|
22
|
+
right: Float32Array;
|
|
23
|
+
sampleRate?: number;
|
|
24
|
+
}
|
|
25
|
+
/** Offline silence trimmer (peak threshold or LUFS-gated). */
|
|
26
|
+
export declare function masteringRepairTrimSilence(request: MasteringRepairTrimSilenceRequest): Float32Array;
|
|
27
|
+
export declare function masteringRepairTrimSilence(samples: Float32Array, sampleRate: number, options?: TrimSilenceOptions): Float32Array;
|
|
28
|
+
/**
|
|
29
|
+
* Offline silence trimmer for a stereo pair, cutting both channels to one shared range.
|
|
30
|
+
*
|
|
31
|
+
* Each channel is scanned on its own and the two ranges are UNIONED, so the pair keeps
|
|
32
|
+
* whatever either channel calls signal and both outputs come back the same length. The scan
|
|
33
|
+
* never reads a downmix: `0.5 * (left + right)` halves material carried by one channel alone,
|
|
34
|
+
* which can drop it under the gate, and cancels an antiphase pair to exactly zero, which would
|
|
35
|
+
* read full-level audio in both channels as silence. Trimming is destructive, so the rule errs
|
|
36
|
+
* toward keeping.
|
|
37
|
+
*
|
|
38
|
+
* The only repair stereo entry that SHORTENS its input: `result.left.length` is the output
|
|
39
|
+
* length, and the input's says nothing about it. A pair in which neither channel carries signal
|
|
40
|
+
* returns two EMPTY arrays and succeeds — it does not throw and does not return null.
|
|
41
|
+
*
|
|
42
|
+
* `report.range` is the union that was applied to both channels. `leftRange` and `rightRange`
|
|
43
|
+
* are the per-channel scans it was formed from, so a caller can see which channel decided each
|
|
44
|
+
* edge; a channel carrying nothing reports an empty range and contributes nothing to the union.
|
|
45
|
+
* With nothing kept, `report.range` is `(inputLength, inputLength)`, so `removedHeadSamples` is
|
|
46
|
+
* the whole input and `removedTailSamples` is 0 — the two still sum to the input length and
|
|
47
|
+
* only the split between the ends is arbitrary.
|
|
48
|
+
*
|
|
49
|
+
* Which option is live depends on `mode`: `threshold` is read ONLY by `'peak'`, and `gateLufs`
|
|
50
|
+
* and `windowMs` ONLY by `'lufsGated'`. Changing an option the active mode does not read is
|
|
51
|
+
* silently inert rather than an error.
|
|
52
|
+
*
|
|
53
|
+
* That gated mode compares an UNWEIGHTED RMS over a window centred on each sample against
|
|
54
|
+
* `gateLufs`, so the figure it gates on is dBFS rather than a BS.1770 loudness, and `windowMs`
|
|
55
|
+
* sizes that window and does nothing else. The window is clipped at the buffer ends, so a
|
|
56
|
+
* sample near either edge is judged on a shorter one.
|
|
57
|
+
*
|
|
58
|
+
* `paddingSamples` widens the kept range in both directions and is clamped to the buffer, so it
|
|
59
|
+
* can never reach past either end; a pass that kept nothing is not padded. A NEGATIVE count is
|
|
60
|
+
* refused by name rather than absorbed into 0 or into the default — the underlying field is
|
|
61
|
+
* unsigned, and a negative one would arrive as an enormous count instead.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* const { left, right, report, leftRange, rightRange } = masteringRepairTrimSilenceStereo({
|
|
66
|
+
* left: leftSamples,
|
|
67
|
+
* right: rightSamples,
|
|
68
|
+
* sampleRate: 48000,
|
|
69
|
+
* mode: 'peak',
|
|
70
|
+
* threshold: 0.01,
|
|
71
|
+
* });
|
|
72
|
+
* console.log(left.length, report.removedHeadSamples, leftRange.first, rightRange.first);
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export declare function masteringRepairTrimSilenceStereo(request: MasteringRepairTrimSilenceStereoRequest): MasteringRepairTrimSilenceStereoResult;
|
|
76
|
+
export declare function masteringRepairTrimSilenceStereo(left: Float32Array, right: Float32Array, sampleRate: number, config?: TrimSilenceOptions): MasteringRepairTrimSilenceStereoResult;
|
|
77
|
+
/** Request form of `masteringRepairDetectTrimRange`. */
|
|
78
|
+
export interface MasteringRepairDetectTrimRangeRequest extends TrimSilenceOptions {
|
|
79
|
+
samples: Float32Array;
|
|
80
|
+
sampleRate: number;
|
|
81
|
+
}
|
|
82
|
+
/** Request form of `masteringRepairDetectTrimRangeStereo`. */
|
|
83
|
+
export interface MasteringRepairDetectTrimRangeStereoRequest extends TrimSilenceOptions {
|
|
84
|
+
left: Float32Array;
|
|
85
|
+
right: Float32Array;
|
|
86
|
+
sampleRate?: number;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Measures the range {@link masteringRepairTrimSilence} would keep, without trimming.
|
|
90
|
+
*
|
|
91
|
+
* The padding `paddingSamples` asks for is already INSIDE the returned range, so this is the
|
|
92
|
+
* range the repair would cut to rather than the detected extent of the signal. A buffer with
|
|
93
|
+
* nothing above the threshold reports `(length, length)`.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```ts
|
|
97
|
+
* const range = masteringRepairDetectTrimRange({ samples, sampleRate: 48000, threshold: 0.01 });
|
|
98
|
+
* const keptSeconds = (range.lastExclusive - range.first) / 48000;
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
export declare function masteringRepairDetectTrimRange(request: MasteringRepairDetectTrimRangeRequest): TrimRange;
|
|
102
|
+
export declare function masteringRepairDetectTrimRange(samples: Float32Array, sampleRate: number, options?: TrimSilenceOptions): TrimRange;
|
|
103
|
+
/**
|
|
104
|
+
* Measures the one range a stereo trim pass would cut both channels to.
|
|
105
|
+
*
|
|
106
|
+
* Each channel is scanned on its own and the two ranges are UNIONED, so the pair keeps whatever
|
|
107
|
+
* either channel calls signal. A channel with nothing above the threshold contributes NO EDGE
|
|
108
|
+
* rather than an edge at the buffer's end: the union of a silent channel and an active one is
|
|
109
|
+
* the active channel's range exactly, where a naive `min`/`max` would push `lastExclusive` out
|
|
110
|
+
* to the buffer end and keep the whole tail.
|
|
111
|
+
*
|
|
112
|
+
* A downmix is not read: summing to mono halves material carried by one channel alone and
|
|
113
|
+
* cancels an antiphase pair outright, either of which would read full-level audio as silence.
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```ts
|
|
117
|
+
* const range = masteringRepairDetectTrimRangeStereo({ left, right, sampleRate: 48000 });
|
|
118
|
+
* console.log(range.first, range.lastExclusive);
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
export declare function masteringRepairDetectTrimRangeStereo(request: MasteringRepairDetectTrimRangeStereoRequest): TrimRange;
|
|
122
|
+
export declare function masteringRepairDetectTrimRangeStereo(left: Float32Array, right: Float32Array, sampleRate: number, config?: TrimSilenceOptions): TrimRange;
|
|
123
|
+
//# sourceMappingURL=repair_trim.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repair_trim.d.ts","sourceRoot":"","sources":["../src/repair_trim.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,sCAAsC,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAM/F,+DAA+D;AAC/D,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,WAAW,CAAC;AAEnD,gDAAgD;AAChD,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,iCAAkC,SAAQ,kBAAkB;IAC3E,OAAO,EAAE,YAAY,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,0DAA0D;AAC1D,MAAM,WAAW,uCAAwC,SAAQ,kBAAkB;IACjF,IAAI,EAAE,YAAY,CAAC;IACnB,KAAK,EAAE,YAAY,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,8DAA8D;AAC9D,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,iCAAiC,GACzC,YAAY,CAAC;AAChB,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,YAAY,CAAC;AAahB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,uCAAuC,GAC/C,sCAAsC,CAAC;AAC1C,wBAAgB,gCAAgC,CAC9C,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,YAAY,EACnB,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,kBAAkB,GAC1B,sCAAsC,CAAC;AAoB1C,wDAAwD;AACxD,MAAM,WAAW,qCAAsC,SAAQ,kBAAkB;IAC/E,OAAO,EAAE,YAAY,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,8DAA8D;AAC9D,MAAM,WAAW,2CAA4C,SAAQ,kBAAkB;IACrF,IAAI,EAAE,YAAY,CAAC;IACnB,KAAK,EAAE,YAAY,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,qCAAqC,GAC7C,SAAS,CAAC;AACb,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,SAAS,CAAC;AAiBb;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oCAAoC,CAClD,OAAO,EAAE,2CAA2C,GACnD,SAAS,CAAC;AACb,wBAAgB,oCAAoC,CAClD,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,YAAY,EACnB,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,kBAAkB,GAC1B,SAAS,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { SampleDesc, SampleZoneDesc } from './instrument_types';
|
|
2
|
+
/**
|
|
3
|
+
* Host-supplied PCM for the sample synthesis engine: a bank of float samples
|
|
4
|
+
* plus key/velocity keymaps, bound alongside a {@link SynthPatch} whose
|
|
5
|
+
* `engineMode` is `'sample'`.
|
|
6
|
+
*
|
|
7
|
+
* {@link Project.loadSoundFont} is the other door into sampled playback — it
|
|
8
|
+
* parses a container and brings its own generator model. This one takes
|
|
9
|
+
* waveforms a host already has, described by nothing but a keymap, so playing
|
|
10
|
+
* them does not require authoring an SF2. Decoding is the caller's job, and
|
|
11
|
+
* WASM has no host filesystem: the bank takes mono float frames from memory.
|
|
12
|
+
*
|
|
13
|
+
* A bank is built on the control thread and then read as immutable data. Add
|
|
14
|
+
* every sample and zone BEFORE the bounce that binds it starts: the pool is
|
|
15
|
+
* contiguous and moves as it grows, so a sample added while something sounds
|
|
16
|
+
* invalidates the voices reading it.
|
|
17
|
+
*
|
|
18
|
+
* The embind handle is not garbage-collected, so release it with
|
|
19
|
+
* {@link SampleBank.delete} once every bounce that names it has finished.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const bank = new SampleBank();
|
|
24
|
+
* try {
|
|
25
|
+
* const index = bank.addSample(pcm, { rootKey: 60, sourceRate: 44100 });
|
|
26
|
+
* bank.addZone({ sampleIndex: index }); // the whole keyboard
|
|
27
|
+
* const audio = project.bounceWithSynthInstrument(
|
|
28
|
+
* { engineMode: 'sample', sampleSet: 0, sampleBank: bank },
|
|
29
|
+
* { totalFrames: 24000 },
|
|
30
|
+
* );
|
|
31
|
+
* } finally {
|
|
32
|
+
* bank.delete();
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare class SampleBank {
|
|
37
|
+
private readonly native;
|
|
38
|
+
private released;
|
|
39
|
+
/**
|
|
40
|
+
* Identity a binding names this bank by, so no raw pointer crosses into JS.
|
|
41
|
+
* Hosts pass the `SampleBank` itself as `sampleBank`.
|
|
42
|
+
*
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
readonly nativeId: number;
|
|
46
|
+
/** Create an empty bank. */
|
|
47
|
+
constructor();
|
|
48
|
+
/**
|
|
49
|
+
* Copy mono float frames into the bank and return the new sample's index,
|
|
50
|
+
* which {@link SampleZoneDesc.sampleIndex} names. The frames are copied, so
|
|
51
|
+
* the array may be reused afterwards.
|
|
52
|
+
*
|
|
53
|
+
* Loop points are clamped inside the sample and a loop mode whose loop
|
|
54
|
+
* survives the clamp empty is dropped, so a malformed loop plays as an
|
|
55
|
+
* unlooped sample rather than as a wrap over nothing. An empty array, and a
|
|
56
|
+
* bank that would exceed 67,108,864 sample points, throw.
|
|
57
|
+
*
|
|
58
|
+
* A NaN or Inf frame, `fineTuneCents` or `sourceRate` throws too, and the
|
|
59
|
+
* bank is left unchanged. Such a value is unattributable once stored: the
|
|
60
|
+
* reader's interpolation spreads one bad frame across the whole sustain, and
|
|
61
|
+
* a bad tuning offset renders the voice silent with no error raised.
|
|
62
|
+
*/
|
|
63
|
+
addSample(data: Float32Array, desc?: SampleDesc): number;
|
|
64
|
+
/**
|
|
65
|
+
* Append a key/velocity rectangle to a keymap set, creating any sets below
|
|
66
|
+
* it. A patch names a set; the first zone in it covering a note is the one
|
|
67
|
+
* that sounds.
|
|
68
|
+
*
|
|
69
|
+
* Every bound defaults on its own (see {@link SampleZoneDesc}), so an empty
|
|
70
|
+
* rectangle is the whole keyboard at every velocity and narrowing one axis
|
|
71
|
+
* leaves the other whole. A `sampleIndex` the bank does not have, an inverted
|
|
72
|
+
* key or velocity range, and a `setIndex` at or above 4096 all throw.
|
|
73
|
+
*/
|
|
74
|
+
addZone(zone?: SampleZoneDesc): void;
|
|
75
|
+
/** Samples added so far. */
|
|
76
|
+
sampleCount(): number;
|
|
77
|
+
/** Keymap sets the bank has (one past the highest index used). */
|
|
78
|
+
setCount(): number;
|
|
79
|
+
/** Release the underlying WASM object. Idempotent, as the Node facade is. */
|
|
80
|
+
delete(): void;
|
|
81
|
+
/** Alias for {@link SampleBank.delete}, provided for cross-binding (Node) compatibility. */
|
|
82
|
+
destroy(): void;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=sample_bank.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sample_bank.d.ts","sourceRoot":"","sources":["../src/sample_bank.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiB;IACxC,OAAO,CAAC,QAAQ,CAAS;IAEzB;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B,4BAA4B;;IAM5B;;;;;;;;;;;;;;OAcG;IACH,SAAS,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,GAAE,UAAe,GAAG,MAAM;IAI5D;;;;;;;;;OASG;IACH,OAAO,CAAC,IAAI,GAAE,cAAmB,GAAG,IAAI;IAKxC,4BAA4B;IAC5B,WAAW,IAAI,MAAM;IAIrB,kEAAkE;IAClE,QAAQ,IAAI,MAAM;IAIlB,6EAA6E;IAC7E,MAAM,IAAI,IAAI;IAQd,4FAA4F;IAC5F,OAAO,IAAI,IAAI;CAGhB"}
|
package/dist/scale.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Snap a MIDI value to the nearest pitch class enabled by `modeMask`.
|
|
3
|
+
*
|
|
4
|
+
* `modeMask` is a 12-bit mask. For natural C major use `0b101010110101`.
|
|
5
|
+
* `referenceMidi` defaults to A4 (69) when passed as 0.
|
|
6
|
+
*/
|
|
7
|
+
export declare function scaleQuantizeMidi(root: number, modeMask: number, midi: number, referenceMidi?: number): number;
|
|
8
|
+
export declare function scaleCorrectionSemitones(root: number, modeMask: number, midi: number, referenceMidi?: number): number;
|
|
9
|
+
export declare function scalePitchClassEnabled(root: number, modeMask: number, pitchClass: number): boolean;
|
|
10
|
+
//# sourceMappingURL=scale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scale.d.ts","sourceRoot":"","sources":["../src/scale.ts"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,aAAa,SAAI,GAChB,MAAM,CAIR;AAED,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,aAAa,SAAI,GAChB,MAAM,CAIR;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,OAAO,CAET"}
|