@libraz/libsonare 1.5.4 → 1.6.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/README.md +109 -20
- package/dist/analysis.d.ts +5730 -0
- package/dist/analysis.js +2464 -0
- package/dist/analysis.js.map +1 -0
- package/dist/index.d.ts +873 -63
- package/dist/index.js +1037 -265
- package/dist/index.js.map +1 -1
- package/dist/schemas/realtime-voice-changer-preset-pack.schema.json +27 -0
- package/dist/schemas/realtime-voice-changer-preset.schema.json +140 -0
- package/dist/sonare-analysis.js +2 -0
- package/dist/sonare-analysis.wasm +0 -0
- package/dist/sonare.js +1 -1
- package/dist/sonare.wasm +0 -0
- package/dist/worker.d.ts +65 -0
- package/dist/worker.js +707 -0
- package/dist/worker.js.map +1 -0
- package/dist/worklet.d.ts +596 -86
- package/dist/worklet.js +1658 -235
- package/dist/worklet.js.map +1 -1
- package/package.json +23 -11
- package/src/_chain_config.ts +5 -23
- package/src/analysis.ts +137 -0
- package/src/analysis_helpers.ts +29 -0
- package/src/audio.ts +5 -3
- package/src/clip_page_streamer.ts +62 -8
- package/src/codes.ts +51 -64
- package/src/effects_mastering.ts +1 -0
- package/src/effects_transform.ts +12 -6
- package/src/errors.ts +1 -0
- package/src/feature_core.ts +159 -3
- package/src/feature_music.ts +35 -16
- package/src/feature_pitch.ts +75 -6
- package/src/feature_spectral.ts +234 -8
- package/src/feature_spectrogram.ts +186 -5
- package/src/features.ts +16 -1
- package/src/index.ts +104 -7
- package/src/mastering_chain.ts +20 -8
- package/src/mastering_core.ts +7 -0
- package/src/mastering_dynamics.ts +7 -1
- package/src/metering.ts +51 -5
- package/src/mixer.ts +14 -1
- package/src/opfs_clip_pages.ts +26 -1
- package/src/project.ts +7 -0
- package/src/project_class.ts +74 -13
- package/src/project_internal.ts +24 -29
- package/src/project_types.ts +69 -10
- package/src/public_types.ts +68 -0
- package/src/public_types_mastering.ts +28 -0
- package/src/public_types_mixing.ts +11 -2
- package/src/public_types_music.ts +13 -0
- package/src/public_types_spectral.ts +43 -3
- package/src/quick_analysis.ts +48 -12
- package/src/realtime_engine.ts +162 -4
- package/src/realtime_voice_changer.ts +51 -77
- package/src/sonare-analysis.js.d.ts +8 -0
- package/src/sonare.js.d.ts +305 -9
- package/src/streaming_processors.ts +22 -1
- package/src/validation.ts +6 -0
- package/src/web_midi.ts +36 -4
- package/src/worker.ts +196 -0
- package/src/worker_client.ts +352 -0
- package/src/worker_protocol.ts +59 -0
- package/src/worklet/engine-automation.ts +2 -1
- package/src/worklet/engine-capture-facade.ts +13 -4
- package/src/worklet/engine-clips.ts +12 -3
- package/src/worklet/engine-node.ts +212 -4
- package/src/worklet/engine-offline.ts +7 -2
- package/src/worklet/engine-parameter-facade.ts +26 -5
- package/src/worklet/engine-processor.ts +383 -42
- package/src/worklet/engine-register.ts +8 -0
- package/src/worklet/engine-strips.ts +17 -1
- package/src/worklet/engine-sync.ts +2 -6
- package/src/worklet/engine-tempo-facade.ts +8 -6
- package/src/worklet/engine.ts +380 -13
- package/src/worklet/guards.ts +22 -1
- package/src/worklet/messages.ts +141 -9
- package/src/worklet/protocol.ts +303 -17
- package/src/worklet/voice-changer-processor.ts +12 -15
- package/src/worklet.ts +20 -1
|
@@ -233,6 +233,10 @@ export interface Beat {
|
|
|
233
233
|
export interface Chord {
|
|
234
234
|
root: PitchClass;
|
|
235
235
|
bass: PitchClass;
|
|
236
|
+
/** Canonical core spelling; stable across all language bindings. */
|
|
237
|
+
rootName: string;
|
|
238
|
+
/** Canonical core spelling; stable across all language bindings. */
|
|
239
|
+
bassName: string;
|
|
236
240
|
quality: ChordQuality;
|
|
237
241
|
start: number;
|
|
238
242
|
end: number;
|
|
@@ -311,6 +315,13 @@ export interface TimeSignature {
|
|
|
311
315
|
confidence: number;
|
|
312
316
|
}
|
|
313
317
|
|
|
318
|
+
/** Existing tempo-estimator hypothesis retained by unified analysis. */
|
|
319
|
+
export interface BpmHypothesis {
|
|
320
|
+
value: number;
|
|
321
|
+
confidence: number;
|
|
322
|
+
relation: 'primary' | 'half' | 'double' | 'other';
|
|
323
|
+
}
|
|
324
|
+
|
|
314
325
|
/**
|
|
315
326
|
* Rhythm features
|
|
316
327
|
*/
|
|
@@ -339,8 +350,10 @@ export interface MelodyContour {
|
|
|
339
350
|
export interface AnalysisResult {
|
|
340
351
|
bpm: number;
|
|
341
352
|
bpmConfidence: number;
|
|
353
|
+
bpmCandidates: BpmHypothesis[];
|
|
342
354
|
key: Key;
|
|
343
355
|
timeSignature: TimeSignature;
|
|
356
|
+
timeSignatureCandidates: TimeSignature[];
|
|
344
357
|
beatTimes: Float32Array;
|
|
345
358
|
beats: Beat[];
|
|
346
359
|
chords: Chord[];
|
|
@@ -30,15 +30,16 @@ export interface PitchCorrectOptions extends ValidateOptions {
|
|
|
30
30
|
export interface NoteStretchOptions {
|
|
31
31
|
/** Note onset position in samples (selects the region). Default 0. */
|
|
32
32
|
onsetSample?: number;
|
|
33
|
-
/** Note offset position in samples (selects the region).
|
|
33
|
+
/** Note offset position in samples (selects the region). Defaults to the input length. */
|
|
34
34
|
offsetSample?: number;
|
|
35
|
-
/** Stretch ratio (0.5 =
|
|
35
|
+
/** Stretch ratio (0.5 = half duration, 2.0 = double duration). Default 1. */
|
|
36
36
|
stretchRatio?: number;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
/** Options for `noteMove`. */
|
|
40
40
|
export interface NoteMoveOptions {
|
|
41
41
|
onsetSample?: number;
|
|
42
|
+
/** Defaults to the input length. */
|
|
42
43
|
offsetSample?: number;
|
|
43
44
|
targetOnsetSample?: number;
|
|
44
45
|
}
|
|
@@ -47,7 +48,7 @@ export interface NoteMoveOptions {
|
|
|
47
48
|
export type SpectralEditMode = 'gain' | 'attenuate' | 'mute' | 'heal';
|
|
48
49
|
|
|
49
50
|
/** Analysis/synthesis window used by `spectralEdit`. */
|
|
50
|
-
export type SpectralEditWindow = 'hann' | 'hamming' | 'blackman' | 'rectangular';
|
|
51
|
+
export type SpectralEditWindow = 'hann' | 'hamming' | 'blackman' | 'rectangular' | 'rect';
|
|
51
52
|
|
|
52
53
|
/** One time x frequency rectangle edit op for `spectralEdit`. */
|
|
53
54
|
export interface SpectralRegionOp {
|
|
@@ -181,13 +182,52 @@ export interface PitchResult {
|
|
|
181
182
|
meanF0: number;
|
|
182
183
|
}
|
|
183
184
|
|
|
185
|
+
/** Per-bin pitch candidates and peak magnitudes from spectral piptrack. */
|
|
186
|
+
export interface PiptrackResult {
|
|
187
|
+
nBins: number;
|
|
188
|
+
nFrames: number;
|
|
189
|
+
pitches: Float32Array;
|
|
190
|
+
magnitudes: Float32Array;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** Magnitude and reassigned time/frequency coordinates for every STFT bin. */
|
|
194
|
+
export interface ReassignedSpectrogramResult {
|
|
195
|
+
nBins: number;
|
|
196
|
+
nFrames: number;
|
|
197
|
+
magnitude: Float32Array;
|
|
198
|
+
times: Float32Array;
|
|
199
|
+
frequencies: Float32Array;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/** Row-major matrix returned by librosa.segment-compatible APIs. */
|
|
203
|
+
export interface SegmentMatrix {
|
|
204
|
+
rows: number;
|
|
205
|
+
cols: number;
|
|
206
|
+
values: Float32Array;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/** One stable monophonic note region segmented from an F0 track. */
|
|
210
|
+
export interface NoteSegment {
|
|
211
|
+
frameStart: number;
|
|
212
|
+
frameEnd: number;
|
|
213
|
+
startSeconds: number;
|
|
214
|
+
endSeconds: number;
|
|
215
|
+
medianCents: number;
|
|
216
|
+
}
|
|
217
|
+
|
|
184
218
|
/**
|
|
185
219
|
* Loudness measurement result (EBU R128 / ITU-R BS.1770)
|
|
186
220
|
*/
|
|
187
221
|
export interface LufsResult {
|
|
188
222
|
integratedLufs: number;
|
|
223
|
+
/** Final complete 400 ms window, not Max-M. */
|
|
189
224
|
momentaryLufs: number;
|
|
225
|
+
/** Final complete 3 s window, not Max-S. */
|
|
190
226
|
shortTermLufs: number;
|
|
227
|
+
/** Maximum 400 ms window (EBU R128 Max-M). */
|
|
228
|
+
maxMomentaryLufs: number;
|
|
229
|
+
/** Maximum 3 s window (EBU R128 Max-S). */
|
|
230
|
+
maxShortTermLufs: number;
|
|
191
231
|
loudnessRange: number;
|
|
192
232
|
}
|
|
193
233
|
|
package/src/quick_analysis.ts
CHANGED
|
@@ -43,12 +43,29 @@ export interface SamplesRequest extends GuardedOptions {
|
|
|
43
43
|
sampleRate?: number;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
/** Peak-picking configuration for {@link detectOnsets}. */
|
|
47
|
+
export interface OnsetDetectOptions {
|
|
48
|
+
nFft?: number;
|
|
49
|
+
hopLength?: number;
|
|
50
|
+
threshold?: number;
|
|
51
|
+
preMax?: number;
|
|
52
|
+
postMax?: number;
|
|
53
|
+
preAvg?: number;
|
|
54
|
+
postAvg?: number;
|
|
55
|
+
delta?: number;
|
|
56
|
+
wait?: number;
|
|
57
|
+
backtrack?: boolean;
|
|
58
|
+
backtrackRange?: number;
|
|
59
|
+
}
|
|
60
|
+
export interface DetectOnsetsRequest extends SamplesRequest, OnsetDetectOptions {}
|
|
61
|
+
|
|
46
62
|
/** Canonical request form for key detection functions. */
|
|
47
63
|
export interface DetectKeyRequest extends KeyDetectionOptions, SamplesRequest {}
|
|
48
64
|
|
|
49
65
|
/** Canonical request form for analysis with synchronous progress reporting. */
|
|
50
66
|
export interface AnalyzeWithProgressRequest extends SamplesRequest {
|
|
51
|
-
onProgress
|
|
67
|
+
onProgress?: ProgressCallback;
|
|
68
|
+
cancel?: () => boolean;
|
|
52
69
|
}
|
|
53
70
|
|
|
54
71
|
/** Canonical request form for chord detection. */
|
|
@@ -207,20 +224,20 @@ export function detectKeyCandidates(
|
|
|
207
224
|
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
208
225
|
* @returns Array of onset times in seconds
|
|
209
226
|
*/
|
|
210
|
-
export function detectOnsets(request:
|
|
227
|
+
export function detectOnsets(request: DetectOnsetsRequest): Float32Array;
|
|
211
228
|
export function detectOnsets(
|
|
212
229
|
samples: Float32Array,
|
|
213
230
|
sampleRate?: number,
|
|
214
|
-
options?: GuardedOptions,
|
|
231
|
+
options?: OnsetDetectOptions & GuardedOptions,
|
|
215
232
|
): Float32Array;
|
|
216
233
|
export function detectOnsets(
|
|
217
|
-
samples: Float32Array |
|
|
234
|
+
samples: Float32Array | DetectOnsetsRequest,
|
|
218
235
|
sampleRate = 22050,
|
|
219
|
-
options: GuardedOptions = {},
|
|
236
|
+
options: OnsetDetectOptions & GuardedOptions = {},
|
|
220
237
|
): Float32Array {
|
|
221
238
|
const request = samples instanceof Float32Array ? { samples, sampleRate, ...options } : samples;
|
|
222
239
|
validateAnalysisInput('detectOnsets', request.samples, request.sampleRate ?? 22050, request);
|
|
223
|
-
return requireModule().detectOnsets(request.samples, request.sampleRate ?? 22050);
|
|
240
|
+
return requireModule().detectOnsets(request.samples, request.sampleRate ?? 22050, request);
|
|
224
241
|
}
|
|
225
242
|
|
|
226
243
|
/**
|
|
@@ -378,20 +395,38 @@ export function chordFunctionalAnalysis(
|
|
|
378
395
|
* the UI responsive for long inputs, drive this from a Web Worker and use
|
|
379
396
|
* {@link analyzeWithProgress} to report progress.
|
|
380
397
|
*/
|
|
381
|
-
export
|
|
398
|
+
export interface MusicAnalyzeOptions {
|
|
399
|
+
nFft?: number;
|
|
400
|
+
hopLength?: number;
|
|
401
|
+
bpmMin?: number;
|
|
402
|
+
bpmMax?: number;
|
|
403
|
+
startBpm?: number;
|
|
404
|
+
useTriadsOnly?: boolean;
|
|
405
|
+
useHpss?: boolean;
|
|
406
|
+
chromaHighpassHz?: number;
|
|
407
|
+
useBassWeighted?: boolean;
|
|
408
|
+
chromaHopMultiplier?: number;
|
|
409
|
+
useChordHmm?: boolean;
|
|
410
|
+
useChordKeyContext?: boolean;
|
|
411
|
+
chordHmmBeamWidth?: number;
|
|
412
|
+
detectChordInversions?: boolean;
|
|
413
|
+
}
|
|
414
|
+
export interface MusicAnalyzeRequest extends SamplesRequest, MusicAnalyzeOptions {}
|
|
415
|
+
|
|
416
|
+
export function analyze(request: MusicAnalyzeRequest): AnalysisResult;
|
|
382
417
|
export function analyze(
|
|
383
418
|
samples: Float32Array,
|
|
384
419
|
sampleRate?: number,
|
|
385
|
-
options?: GuardedOptions,
|
|
420
|
+
options?: GuardedOptions & MusicAnalyzeOptions,
|
|
386
421
|
): AnalysisResult;
|
|
387
422
|
export function analyze(
|
|
388
|
-
samples: Float32Array |
|
|
423
|
+
samples: Float32Array | MusicAnalyzeRequest,
|
|
389
424
|
sampleRate = 22050,
|
|
390
|
-
options: GuardedOptions = {},
|
|
425
|
+
options: GuardedOptions & MusicAnalyzeOptions = {},
|
|
391
426
|
): AnalysisResult {
|
|
392
427
|
const request = samples instanceof Float32Array ? { samples, sampleRate, ...options } : samples;
|
|
393
428
|
validateAnalysisInput('analyze', request.samples, request.sampleRate ?? 22050, request);
|
|
394
|
-
const result = requireModule().analyze(request.samples, request.sampleRate ?? 22050);
|
|
429
|
+
const result = requireModule().analyze(request.samples, request.sampleRate ?? 22050, request);
|
|
395
430
|
return convertAnalysisResult(result);
|
|
396
431
|
}
|
|
397
432
|
|
|
@@ -541,7 +576,8 @@ export function analyzeWithProgress(
|
|
|
541
576
|
const result = requireModule().analyzeWithProgress(
|
|
542
577
|
request.samples,
|
|
543
578
|
request.sampleRate ?? 22050,
|
|
544
|
-
request.onProgress,
|
|
579
|
+
request.onProgress ?? (() => {}),
|
|
580
|
+
request.cancel ?? (() => false),
|
|
545
581
|
);
|
|
546
582
|
return convertAnalysisResult(result);
|
|
547
583
|
}
|
package/src/realtime_engine.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { panLawCode, panModeCode, sendTimingCode } from './codes';
|
|
2
2
|
import { ErrorCode, SonareError } from './errors';
|
|
3
3
|
import { getSonareModule } from './module_state';
|
|
4
|
-
import type { SynthPatch } from './project';
|
|
4
|
+
import type { ProjectMidiCcBinding, SynthPatch } from './project';
|
|
5
5
|
import type { EqBand, PanLaw, PanMode, SendTiming } from './public_types';
|
|
6
6
|
import type {
|
|
7
7
|
WasmClipPageRequest,
|
|
@@ -38,6 +38,7 @@ export type EngineMarker = WasmEngineMarker;
|
|
|
38
38
|
export type EngineMetronomeConfig = WasmEngineMetronomeConfig;
|
|
39
39
|
export type EngineGraphSpec = WasmEngineGraphSpec;
|
|
40
40
|
export type EngineCaptureStatus = WasmEngineCaptureStatus;
|
|
41
|
+
export type EngineCaptureSource = EngineCaptureStatus['source'] | number;
|
|
41
42
|
export type EngineBounceOptions = WasmEngineBounceOptions;
|
|
42
43
|
export type EngineBounceResult = WasmEngineBounceResult;
|
|
43
44
|
export type EngineFreezeOptions = WasmEngineFreezeOptions;
|
|
@@ -161,6 +162,7 @@ export class RealtimeEngine {
|
|
|
161
162
|
maxBlockSize = 128,
|
|
162
163
|
commandCapacity = 1024,
|
|
163
164
|
telemetryCapacity = 1024,
|
|
165
|
+
maxChannels = 64,
|
|
164
166
|
) {
|
|
165
167
|
const module = getSonareModule();
|
|
166
168
|
const capabilities = engineCapabilities();
|
|
@@ -174,6 +176,7 @@ export class RealtimeEngine {
|
|
|
174
176
|
maxBlockSize,
|
|
175
177
|
commandCapacity,
|
|
176
178
|
telemetryCapacity,
|
|
179
|
+
maxChannels,
|
|
177
180
|
);
|
|
178
181
|
}
|
|
179
182
|
|
|
@@ -182,8 +185,15 @@ export class RealtimeEngine {
|
|
|
182
185
|
maxBlockSize: number,
|
|
183
186
|
commandCapacity = 1024,
|
|
184
187
|
telemetryCapacity = 1024,
|
|
188
|
+
maxChannels = 64,
|
|
185
189
|
): void {
|
|
186
|
-
this.native.
|
|
190
|
+
this.native.prepareWithChannels(
|
|
191
|
+
sampleRate,
|
|
192
|
+
maxBlockSize,
|
|
193
|
+
commandCapacity,
|
|
194
|
+
telemetryCapacity,
|
|
195
|
+
maxChannels,
|
|
196
|
+
);
|
|
187
197
|
}
|
|
188
198
|
|
|
189
199
|
/** Queue a sample-accurate parameter change (engine kSetParam). */
|
|
@@ -256,7 +266,12 @@ export class RealtimeEngine {
|
|
|
256
266
|
* synthesizer GM fallback bank (the data-free floor).
|
|
257
267
|
*/
|
|
258
268
|
setSf2Instrument(
|
|
259
|
-
config: {
|
|
269
|
+
config: {
|
|
270
|
+
destinationId?: number;
|
|
271
|
+
gain?: number;
|
|
272
|
+
polyphony?: number;
|
|
273
|
+
preferModelForModeledFamilies?: boolean;
|
|
274
|
+
} = {},
|
|
260
275
|
destinationId = config.destinationId ?? 0,
|
|
261
276
|
): void {
|
|
262
277
|
this.native.setSf2Instrument(destinationId, config);
|
|
@@ -290,6 +305,11 @@ export class RealtimeEngine {
|
|
|
290
305
|
);
|
|
291
306
|
}
|
|
292
307
|
|
|
308
|
+
/** Bind a 7/14-bit CC, RPN, or NRPN descriptor to a live parameter. */
|
|
309
|
+
bindMidiCcBinding(binding: ProjectMidiCcBinding): void {
|
|
310
|
+
this.native.bindMidiCcBinding(binding);
|
|
311
|
+
}
|
|
312
|
+
|
|
293
313
|
clearMidiCcBindings(): void {
|
|
294
314
|
this.native.clearMidiCcBindings();
|
|
295
315
|
}
|
|
@@ -342,6 +362,10 @@ export class RealtimeEngine {
|
|
|
342
362
|
return this.native.externalMidiDroppedCount();
|
|
343
363
|
}
|
|
344
364
|
|
|
365
|
+
externalMidiPendingCount(): number {
|
|
366
|
+
return this.native.externalMidiPendingCount();
|
|
367
|
+
}
|
|
368
|
+
|
|
345
369
|
/**
|
|
346
370
|
* Drain queued external-MIDI events, already lowered to MIDI 1.0 byte
|
|
347
371
|
* messages ready to write to a Web MIDI output port. Call once per audio
|
|
@@ -353,6 +377,31 @@ export class RealtimeEngine {
|
|
|
353
377
|
return this.native.drainExternalMidi(maxRecords);
|
|
354
378
|
}
|
|
355
379
|
|
|
380
|
+
/** Scalar, allocation-free external-MIDI drain for AudioWorklet SAB output. */
|
|
381
|
+
popExternalMidiToScratch(): boolean {
|
|
382
|
+
return this.native.popExternalMidiToScratch();
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
externalMidiScratchDestinationId(): number {
|
|
386
|
+
return this.native.externalMidiScratchDestinationId();
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
externalMidiScratchRenderFrame(): number {
|
|
390
|
+
return this.native.externalMidiScratchRenderFrame();
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
externalMidiScratchByteWord(): number {
|
|
394
|
+
return this.native.externalMidiScratchByteWord();
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
externalMidiScratchByteCount(): number {
|
|
398
|
+
return this.native.externalMidiScratchByteCount();
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
consumeExternalMidiScratch(): void {
|
|
402
|
+
this.native.consumeExternalMidiScratch();
|
|
403
|
+
}
|
|
404
|
+
|
|
356
405
|
pushMidiInputNoteOn(
|
|
357
406
|
group: number,
|
|
358
407
|
channel: number,
|
|
@@ -422,6 +471,11 @@ export class RealtimeEngine {
|
|
|
422
471
|
this.native.pushMidiCc(destinationId, group, channel, controller, value, renderFrame);
|
|
423
472
|
}
|
|
424
473
|
|
|
474
|
+
/** Queue one immediate MIDI 1.0 channel-voice UMP word for a destination. */
|
|
475
|
+
pushMidiUmp(destinationId: number, word0: number, renderFrame = -1): void {
|
|
476
|
+
this.native.pushMidiUmp(destinationId, word0, renderFrame);
|
|
477
|
+
}
|
|
478
|
+
|
|
425
479
|
/**
|
|
426
480
|
* Queue an immediate (live) MIDI SysEx frame to a MIDI destination. `data` is
|
|
427
481
|
* the full message including the leading 0xF0 and trailing 0xF7 (1..512
|
|
@@ -475,10 +529,16 @@ export class RealtimeEngine {
|
|
|
475
529
|
this.native.settleParameters();
|
|
476
530
|
}
|
|
477
531
|
|
|
532
|
+
/** Drains queued commands on an offline/control-only engine immediately. */
|
|
533
|
+
flushControlCommands(): void {
|
|
534
|
+
this.native.flushControlCommands();
|
|
535
|
+
}
|
|
536
|
+
|
|
478
537
|
seekPpq(ppq: number, renderFrame = -1): void {
|
|
479
538
|
this.native.seekPpq(ppq, renderFrame);
|
|
480
539
|
}
|
|
481
540
|
|
|
541
|
+
/** Set a finite tempo in the range (0, 100000] BPM. */
|
|
482
542
|
setTempo(bpm: number): void {
|
|
483
543
|
this.native.setTempo(bpm);
|
|
484
544
|
}
|
|
@@ -551,6 +611,7 @@ export class RealtimeEngine {
|
|
|
551
611
|
this.native.setLoopFromMarkers(startMarkerId, endMarkerId);
|
|
552
612
|
}
|
|
553
613
|
|
|
614
|
+
/** Set a metronome config; click lengths are limited to one second. */
|
|
554
615
|
setMetronome(config: EngineMetronomeConfig): void {
|
|
555
616
|
this.native.setMetronome(config);
|
|
556
617
|
}
|
|
@@ -817,6 +878,27 @@ export class RealtimeEngine {
|
|
|
817
878
|
return this.native.popClipPageRequest();
|
|
818
879
|
}
|
|
819
880
|
|
|
881
|
+
/**
|
|
882
|
+
* Moves one native request into the binding's persistent scalar scratch.
|
|
883
|
+
* This avoids creating an embind JS object in AudioWorklet process().
|
|
884
|
+
*/
|
|
885
|
+
popClipPageRequestToScratch(): boolean {
|
|
886
|
+
return this.native.popClipPageRequestToScratch();
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
clipPageRequestScratchClipId(): number {
|
|
890
|
+
return this.native.clipPageRequestScratchClipId();
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
clipPageRequestScratchSample(): number {
|
|
894
|
+
return this.native.clipPageRequestScratchSample();
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
/** Cumulative page misses dropped because the native bounded request queue was full. */
|
|
898
|
+
clipPageRequestOverflowCount(): number {
|
|
899
|
+
return this.native.clipPageRequestOverflowCount();
|
|
900
|
+
}
|
|
901
|
+
|
|
820
902
|
setCaptureBuffer(numChannels: number, capacityFrames: number): void {
|
|
821
903
|
this.native.setCaptureBuffer(numChannels, capacityFrames);
|
|
822
904
|
}
|
|
@@ -829,10 +911,11 @@ export class RealtimeEngine {
|
|
|
829
911
|
this.native.setCapturePunch(startSample, endSample, enabled);
|
|
830
912
|
}
|
|
831
913
|
|
|
832
|
-
setCaptureSource(source:
|
|
914
|
+
setCaptureSource(source: EngineCaptureSource): void {
|
|
833
915
|
this.native.setCaptureSource(source);
|
|
834
916
|
}
|
|
835
917
|
|
|
918
|
+
/** Positive values delay capture relative to the punch window. */
|
|
836
919
|
setRecordOffsetSamples(offsetSamples: number): void {
|
|
837
920
|
this.native.setRecordOffsetSamples(offsetSamples);
|
|
838
921
|
}
|
|
@@ -853,6 +936,10 @@ export class RealtimeEngine {
|
|
|
853
936
|
return this.native.capturedAudio();
|
|
854
937
|
}
|
|
855
938
|
|
|
939
|
+
/**
|
|
940
|
+
* Renders in place, adding engine output to `channels`. Zero each plane first
|
|
941
|
+
* when it contains no upstream input.
|
|
942
|
+
*/
|
|
856
943
|
process(channels: Float32Array[]): Float32Array[] {
|
|
857
944
|
return this.native.process(channels);
|
|
858
945
|
}
|
|
@@ -878,6 +965,7 @@ export class RealtimeEngine {
|
|
|
878
965
|
|
|
879
966
|
/**
|
|
880
967
|
* Runs the engine in place over the prepared per-channel scratch buffers.
|
|
968
|
+
* Zero each active span first when it contains no upstream input.
|
|
881
969
|
* Allocation-free: safe to call on the AudioWorklet render thread after
|
|
882
970
|
* `prepareChannels`.
|
|
883
971
|
*/
|
|
@@ -905,6 +993,51 @@ export class RealtimeEngine {
|
|
|
905
993
|
return this.native.drainTelemetry(maxRecords);
|
|
906
994
|
}
|
|
907
995
|
|
|
996
|
+
popTelemetryToScratch(): boolean {
|
|
997
|
+
return this.native.popTelemetryToScratch();
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
telemetryScratchType(): number {
|
|
1001
|
+
return this.native.telemetryScratchType();
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
telemetryScratchError(): number {
|
|
1005
|
+
return this.native.telemetryScratchError();
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
telemetryScratchRenderFrame(): number {
|
|
1009
|
+
return Number(this.native.telemetryScratchRenderFrame());
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
telemetryScratchTimelineSample(): number {
|
|
1013
|
+
return Number(this.native.telemetryScratchTimelineSample());
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
telemetryScratchAudibleTimelineSample(): number {
|
|
1017
|
+
return Number(this.native.telemetryScratchAudibleTimelineSample());
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
telemetryScratchGraphLatencySamplesQ8(): number {
|
|
1021
|
+
return this.native.telemetryScratchGraphLatencySamplesQ8();
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
telemetryScratchValue(): number {
|
|
1025
|
+
return this.native.telemetryScratchValue();
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
popMeterTelemetryToScratch(): boolean {
|
|
1029
|
+
return this.native.popMeterTelemetryToScratch();
|
|
1030
|
+
}
|
|
1031
|
+
meterScratchTargetId(): number {
|
|
1032
|
+
return this.native.meterScratchTargetId();
|
|
1033
|
+
}
|
|
1034
|
+
meterScratchRenderFrame(): number {
|
|
1035
|
+
return Number(this.native.meterScratchRenderFrame());
|
|
1036
|
+
}
|
|
1037
|
+
meterScratchValue(field: number): number {
|
|
1038
|
+
return this.native.meterScratchValue(field);
|
|
1039
|
+
}
|
|
1040
|
+
|
|
908
1041
|
drainMeterTelemetry(maxRecords = 1024): EngineMeterTelemetry[] {
|
|
909
1042
|
return this.native.drainMeterTelemetry(maxRecords);
|
|
910
1043
|
}
|
|
@@ -936,6 +1069,31 @@ export class RealtimeEngine {
|
|
|
936
1069
|
return this.native.drainScopeTelemetry(maxRecords);
|
|
937
1070
|
}
|
|
938
1071
|
|
|
1072
|
+
popScopeTelemetryToScratch(): boolean {
|
|
1073
|
+
return this.native.popScopeTelemetryToScratch();
|
|
1074
|
+
}
|
|
1075
|
+
scopeScratchTargetId(): number {
|
|
1076
|
+
return this.native.scopeScratchTargetId();
|
|
1077
|
+
}
|
|
1078
|
+
scopeScratchRenderFrame(): number {
|
|
1079
|
+
return Number(this.native.scopeScratchRenderFrame());
|
|
1080
|
+
}
|
|
1081
|
+
scopeScratchBandCount(): number {
|
|
1082
|
+
return this.native.scopeScratchBandCount();
|
|
1083
|
+
}
|
|
1084
|
+
scopeScratchBand(index: number): number {
|
|
1085
|
+
return this.native.scopeScratchBand(index);
|
|
1086
|
+
}
|
|
1087
|
+
scopeScratchPointCount(): number {
|
|
1088
|
+
return this.native.scopeScratchPointCount();
|
|
1089
|
+
}
|
|
1090
|
+
scopeScratchPointLeft(index: number): number {
|
|
1091
|
+
return this.native.scopeScratchPointLeft(index);
|
|
1092
|
+
}
|
|
1093
|
+
scopeScratchPointRight(index: number): number {
|
|
1094
|
+
return this.native.scopeScratchPointRight(index);
|
|
1095
|
+
}
|
|
1096
|
+
|
|
939
1097
|
destroy(): void {
|
|
940
1098
|
this.native.delete();
|
|
941
1099
|
}
|