@libraz/libsonare 1.2.0 → 1.2.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/dist/index.d.ts CHANGED
@@ -651,6 +651,15 @@ interface StreamingEqualizerConfig {
651
651
  sampleRate?: number;
652
652
  maxBlockSize?: number;
653
653
  }
654
+ /** Configuration for {@link StreamingRetune}. */
655
+ interface StreamingRetuneConfig {
656
+ /** Pitch shift in semitones, clamped by the native processor to +/-24. */
657
+ semitones?: number;
658
+ /** Wet/dry mix, clamped by the native processor to 0..1. */
659
+ mix?: number;
660
+ /** Grain size in samples. Use 0/omit to derive it from the sample rate. */
661
+ grainSize?: number;
662
+ }
654
663
  /** Options for {@link StreamingEqualizer.match}. */
655
664
  interface EqMatchOptions {
656
665
  sampleRate?: number;
@@ -1468,6 +1477,37 @@ declare class StreamingEqualizer {
1468
1477
  /** Release the underlying WASM object. Safe to call only once. */
1469
1478
  delete(): void;
1470
1479
  }
1480
+ /**
1481
+ * Block-by-block mono voice retune / pitch shifter.
1482
+ *
1483
+ * State is maintained across {@link processMono} calls. Call {@link prepare}
1484
+ * before processing, and call {@link delete} (or use `try/finally`) to release
1485
+ * the underlying WASM object.
1486
+ */
1487
+ declare class StreamingRetune {
1488
+ private retune;
1489
+ constructor(config?: StreamingRetuneConfig);
1490
+ /**
1491
+ * Allocate and initialize native state for the given sample rate and maximum
1492
+ * process block size.
1493
+ */
1494
+ prepare(sampleRate: number, maxBlockSize: number): void;
1495
+ /** Reset delay, grain, and overlap-add state without changing config. */
1496
+ reset(): void;
1497
+ /**
1498
+ * Update retune settings. Changing `grainSize` takes effect after the next
1499
+ * {@link prepare} call.
1500
+ */
1501
+ setConfig(config: StreamingRetuneConfig): void;
1502
+ /** Current native config. */
1503
+ config(): Required<StreamingRetuneConfig>;
1504
+ /** Resolved grain size in samples after {@link prepare}. */
1505
+ grainSize(): number;
1506
+ /** Process one mono block, returning the shifted samples (same length). */
1507
+ processMono(samples: Float32Array): Float32Array;
1508
+ /** Release the underlying WASM object. Safe to call only once. */
1509
+ delete(): void;
1510
+ }
1471
1511
  /**
1472
1512
  * Get a built-in mixing scene preset serialized as JSON, normalized through the
1473
1513
  * C mixer API (the same path {@link Mixer.fromSceneJson} uses to load it).
@@ -2276,4 +2316,4 @@ declare class StreamAnalyzer {
2276
2316
  dispose(): void;
2277
2317
  }
2278
2318
 
2279
- export { type AcousticResult, type AnalysisResult, type AnalyzerStats, Audio, type AutomationCurve, type BarChord, type Beat, type Chord, type ChordAnalysisResult, type ChordChange, type ChordDetectionOptions, ChordQuality, type ChromaResult, type CqtResult, type Dynamics, EXPECTED_ENGINE_ABI_VERSION, type EngineAutomationPoint, type EngineBounceOptions, type EngineBounceResult, type EngineCapabilities, type EngineCaptureStatus, type EngineClip, type EngineFreezeOptions, type EngineFreezeResult, type EngineGraphSpec, type EngineMarker, type EngineMeterTelemetry, type EngineMetronomeConfig, type EngineParameterInfo, type EngineTelemetry, type EngineTransportState, type EqBand, type EqBandPhase, type EqBandType, type EqCoeffMode, type EqMatchOptions, type EqSpectrumSnapshot, type EqStereoPlacement, type FrameBuffer, type GoniometerPoint, type HpssResult, type Key, type KeyCandidate, type KeyDetectionOptions, KeyProfile, type KeyProfileName, type LufsResult, type MasteringChainConfig, type MasteringChainResult, type MasteringPreset, type MasteringProcessorParams, type MasteringResult, type MasteringStereoChainResult, type MasteringStereoResult, type MelSpectrogramResult, type MelodyPoint, type MelodyResult, type MeterTap, type MfccResult, type MixMeterSnapshot, type MixOptions, type MixResult, Mixer, type MixerProcessResult, type MixerRealtimeBuffer, Mode, type PairAnalysis, type PairProcessor, type PanLaw, type PanMode, type PatternScore, PitchClass as Pitch, PitchClass, type PitchResult, type ProgressCallback, type ProgressiveEstimate, RealtimeEngine, type RhythmFeatures, type Section, SectionType, type SendTiming, type SoloProcessor, type StereoAnalysis, type StftResult, StreamAnalyzer, type StreamConfig, type StreamFramesI16, type StreamFramesU8, StreamingEqualizer, type StreamingEqualizerConfig, StreamingMasteringChain, type StreamingPlatform, type Timbre, type TimeSignature, amplitudeToDb, analyze, analyzeImpulseResponse, analyzeMelody, analyzeSections, analyzeWithProgress, chroma, cqt, cyclicTempogram, dbToAmplitude, dbToPower, deemphasis, detectAcoustic, detectBeats, detectBpm, detectChords, detectDownbeats, detectKey, detectKeyCandidates, detectOnsets, engineAbiVersion, engineCapabilities, fixFrames, fixLength, fourierTempogram, frameSignal, framesToSamples, framesToTime, harmonic, hpss, hzToMel, hzToMidi, hzToNote, init, isInitialized, lufs, masterAudio, masterAudioStereo, mastering, masteringAssistantSuggest, masteringAudioProfile, masteringChain, masteringChainStereo, masteringChainStereoWithProgress, masteringChainWithProgress, masteringPairAnalysisNames, masteringPairAnalyze, masteringPairProcess, masteringPairProcessorNames, masteringPresetNames, masteringProcess, masteringProcessStereo, masteringProcessorNames, masteringStereoAnalysisNames, masteringStereoAnalyze, masteringStreamingPreview, melSpectrogram, melToAudio, melToHz, melToStft, mfcc, mfccToAudio, mfccToMel, midiToHz, mixStereo, mixerScenePresetJson, mixingScenePresetJson, mixingScenePresetNames, momentaryLufs, nnlsChroma, normalize, noteStretch, noteToHz, onsetEnvelope, padCenter, pcen, peakPick, percussive, pitchCorrectToMidi, pitchPyin, pitchShift, pitchYin, plp, powerToDb, preemphasis, resample, rmsEnergy, samplesToFrames, shortTermLufs, spectralBandwidth, spectralCentroid, spectralFlatness, spectralRolloff, splitSilence, stft, stftDb, tempogram, tempogramRatio, timeStretch, timeToFrames, tonnetz, trim, trimSilence, vectorNormalize, version, voiceChange, vqt, zeroCrossingRate };
2319
+ export { type AcousticResult, type AnalysisResult, type AnalyzerStats, Audio, type AutomationCurve, type BarChord, type Beat, type Chord, type ChordAnalysisResult, type ChordChange, type ChordDetectionOptions, ChordQuality, type ChromaResult, type CqtResult, type Dynamics, EXPECTED_ENGINE_ABI_VERSION, type EngineAutomationPoint, type EngineBounceOptions, type EngineBounceResult, type EngineCapabilities, type EngineCaptureStatus, type EngineClip, type EngineFreezeOptions, type EngineFreezeResult, type EngineGraphSpec, type EngineMarker, type EngineMeterTelemetry, type EngineMetronomeConfig, type EngineParameterInfo, type EngineTelemetry, type EngineTransportState, type EqBand, type EqBandPhase, type EqBandType, type EqCoeffMode, type EqMatchOptions, type EqSpectrumSnapshot, type EqStereoPlacement, type FrameBuffer, type GoniometerPoint, type HpssResult, type Key, type KeyCandidate, type KeyDetectionOptions, KeyProfile, type KeyProfileName, type LufsResult, type MasteringChainConfig, type MasteringChainResult, type MasteringPreset, type MasteringProcessorParams, type MasteringResult, type MasteringStereoChainResult, type MasteringStereoResult, type MelSpectrogramResult, type MelodyPoint, type MelodyResult, type MeterTap, type MfccResult, type MixMeterSnapshot, type MixOptions, type MixResult, Mixer, type MixerProcessResult, type MixerRealtimeBuffer, Mode, type PairAnalysis, type PairProcessor, type PanLaw, type PanMode, type PatternScore, PitchClass as Pitch, PitchClass, type PitchResult, type ProgressCallback, type ProgressiveEstimate, RealtimeEngine, type RhythmFeatures, type Section, SectionType, type SendTiming, type SoloProcessor, type StereoAnalysis, type StftResult, StreamAnalyzer, type StreamConfig, type StreamFramesI16, type StreamFramesU8, StreamingEqualizer, type StreamingEqualizerConfig, StreamingMasteringChain, type StreamingPlatform, StreamingRetune, type StreamingRetuneConfig, type Timbre, type TimeSignature, amplitudeToDb, analyze, analyzeImpulseResponse, analyzeMelody, analyzeSections, analyzeWithProgress, chroma, cqt, cyclicTempogram, dbToAmplitude, dbToPower, deemphasis, detectAcoustic, detectBeats, detectBpm, detectChords, detectDownbeats, detectKey, detectKeyCandidates, detectOnsets, engineAbiVersion, engineCapabilities, fixFrames, fixLength, fourierTempogram, frameSignal, framesToSamples, framesToTime, harmonic, hpss, hzToMel, hzToMidi, hzToNote, init, isInitialized, lufs, masterAudio, masterAudioStereo, mastering, masteringAssistantSuggest, masteringAudioProfile, masteringChain, masteringChainStereo, masteringChainStereoWithProgress, masteringChainWithProgress, masteringPairAnalysisNames, masteringPairAnalyze, masteringPairProcess, masteringPairProcessorNames, masteringPresetNames, masteringProcess, masteringProcessStereo, masteringProcessorNames, masteringStereoAnalysisNames, masteringStereoAnalyze, masteringStreamingPreview, melSpectrogram, melToAudio, melToHz, melToStft, mfcc, mfccToAudio, mfccToMel, midiToHz, mixStereo, mixerScenePresetJson, mixingScenePresetJson, mixingScenePresetNames, momentaryLufs, nnlsChroma, normalize, noteStretch, noteToHz, onsetEnvelope, padCenter, pcen, peakPick, percussive, pitchCorrectToMidi, pitchPyin, pitchShift, pitchYin, plp, powerToDb, preemphasis, resample, rmsEnergy, samplesToFrames, shortTermLufs, spectralBandwidth, spectralCentroid, spectralFlatness, spectralRolloff, splitSilence, stft, stftDb, tempogram, tempogramRatio, timeStretch, timeToFrames, tonnetz, trim, trimSilence, vectorNormalize, version, voiceChange, vqt, zeroCrossingRate };
package/dist/index.js CHANGED
@@ -937,6 +937,48 @@ var StreamingEqualizer = class {
937
937
  this.eq.delete();
938
938
  }
939
939
  };
940
+ var StreamingRetune = class {
941
+ constructor(config = {}) {
942
+ if (!module) {
943
+ throw new Error("Module not initialized. Call init() first.");
944
+ }
945
+ this.retune = module.createStreamingRetune(config);
946
+ }
947
+ /**
948
+ * Allocate and initialize native state for the given sample rate and maximum
949
+ * process block size.
950
+ */
951
+ prepare(sampleRate, maxBlockSize) {
952
+ this.retune.prepare(sampleRate, maxBlockSize);
953
+ }
954
+ /** Reset delay, grain, and overlap-add state without changing config. */
955
+ reset() {
956
+ this.retune.reset();
957
+ }
958
+ /**
959
+ * Update retune settings. Changing `grainSize` takes effect after the next
960
+ * {@link prepare} call.
961
+ */
962
+ setConfig(config) {
963
+ this.retune.setConfig(config);
964
+ }
965
+ /** Current native config. */
966
+ config() {
967
+ return this.retune.config();
968
+ }
969
+ /** Resolved grain size in samples after {@link prepare}. */
970
+ grainSize() {
971
+ return this.retune.grainSize();
972
+ }
973
+ /** Process one mono block, returning the shifted samples (same length). */
974
+ processMono(samples) {
975
+ return this.retune.processMono(samples);
976
+ }
977
+ /** Release the underlying WASM object. Safe to call only once. */
978
+ delete() {
979
+ this.retune.delete();
980
+ }
981
+ };
940
982
  function mixerScenePresetJson(preset) {
941
983
  if (!module) {
942
984
  throw new Error("Module not initialized. Call init() first.");
@@ -2008,6 +2050,7 @@ export {
2008
2050
  StreamAnalyzer,
2009
2051
  StreamingEqualizer,
2010
2052
  StreamingMasteringChain,
2053
+ StreamingRetune,
2011
2054
  amplitudeToDb,
2012
2055
  analyze,
2013
2056
  analyzeImpulseResponse,