echogarden 0.12.2 → 1.0.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 +15 -14
- package/data/schemas/options.json +398 -111
- package/dist/alignment/DTWMfccSequenceAlignment.d.ts +1 -1
- package/dist/alignment/DTWMfccSequenceAlignment.js +8 -8
- package/dist/alignment/DTWSequenceAlignment.d.ts +1 -1
- package/dist/alignment/DTWSequenceAlignment.js +1 -1
- package/dist/alignment/DTWSequenceAlignmentWindowed.d.ts +1 -1
- package/dist/alignment/DTWSequenceAlignmentWindowed.js +2 -2
- package/dist/alignment/LevenshteinSequenceAlignment.d.ts +1 -1
- package/dist/alignment/LevenshteinSequenceAlignment.js +1 -1
- package/dist/alignment/SpeechAlignment.d.ts +9 -10
- package/dist/alignment/SpeechAlignment.js +136 -105
- package/dist/alignment/SpeechAlignment.js.map +1 -1
- package/dist/api/API.d.ts +13 -12
- package/dist/api/API.js +14 -13
- package/dist/api/API.js.map +1 -1
- package/dist/api/APIOptions.d.ts +5 -4
- package/dist/api/Alignment.d.ts +15 -9
- package/dist/api/Alignment.js +88 -74
- package/dist/api/Alignment.js.map +1 -1
- package/dist/api/Common.js +1 -1
- package/dist/api/Denoising.d.ts +6 -6
- package/dist/api/Denoising.js +23 -23
- package/dist/api/Denoising.js.map +1 -1
- package/dist/api/LanguageDetection.d.ts +19 -12
- package/dist/api/LanguageDetection.js +88 -38
- package/dist/api/LanguageDetection.js.map +1 -1
- package/dist/api/Recognition.d.ts +16 -6
- package/dist/api/Recognition.js +129 -55
- package/dist/api/Recognition.js.map +1 -1
- package/dist/api/SourceSeparation.d.ts +17 -0
- package/dist/api/SourceSeparation.js +61 -0
- package/dist/api/SourceSeparation.js.map +1 -0
- package/dist/api/Synthesis.d.ts +18 -18
- package/dist/api/Synthesis.js +191 -164
- package/dist/api/Synthesis.js.map +1 -1
- package/dist/api/Translation.d.ts +19 -8
- package/dist/api/Translation.js +132 -35
- package/dist/api/Translation.js.map +1 -1
- package/dist/api/Vad.d.ts +10 -5
- package/dist/api/Vad.js +76 -38
- package/dist/api/Vad.js.map +1 -1
- package/dist/audio/AudioBufferConversion.d.ts +1 -1
- package/dist/audio/AudioBufferConversion.js +4 -4
- package/dist/audio/AudioPlayer.d.ts +1 -1
- package/dist/audio/AudioPlayer.js +26 -26
- package/dist/audio/AudioPlayer.js.map +1 -1
- package/dist/audio/AudioRecorder.d.ts +1 -1
- package/dist/audio/AudioRecorder.js +5 -5
- package/dist/audio/AudioUtilities.d.ts +13 -9
- package/dist/audio/AudioUtilities.js +86 -24
- package/dist/audio/AudioUtilities.js.map +1 -1
- package/dist/cli/CLI.d.ts +3 -3
- package/dist/cli/CLI.js +271 -162
- package/dist/cli/CLI.js.map +1 -1
- package/dist/cli/CLIConfigFile.js +8 -8
- package/dist/cli/CLILauncher.js +6 -6
- package/dist/cli/CLIOptionsSchema.js +2 -2
- package/dist/cli/CLIParser.js +5 -5
- package/dist/cli/CLIStarter.js +4 -4
- package/dist/codecs/FFMpegTranscoder.d.ts +2 -2
- package/dist/codecs/FFMpegTranscoder.js +37 -37
- package/dist/codecs/FFMpegTranscoder.js.map +1 -1
- package/dist/codecs/TIMITCodec.js +5 -5
- package/dist/codecs/WaveCodec.d.ts +1 -1
- package/dist/codecs/WaveCodec.js +22 -22
- package/dist/denoising/RNNoise.d.ts +1 -1
- package/dist/denoising/RNNoise.js +9 -9
- package/dist/dsp/BiquadFilter.d.ts +3 -2
- package/dist/dsp/BiquadFilter.js +18 -11
- package/dist/dsp/BiquadFilter.js.map +1 -1
- package/dist/dsp/DecayingPeakEstimator.d.ts +16 -0
- package/dist/dsp/DecayingPeakEstimator.js +23 -0
- package/dist/dsp/DecayingPeakEstimator.js.map +1 -0
- package/dist/dsp/FFT.d.ts +8 -4
- package/dist/dsp/FFT.js +76 -30
- package/dist/dsp/FFT.js.map +1 -1
- package/dist/dsp/KWeightingFilter.d.ts +9 -0
- package/dist/dsp/KWeightingFilter.js +40 -0
- package/dist/dsp/KWeightingFilter.js.map +1 -0
- package/dist/dsp/LoudnessEstimator.d.ts +21 -0
- package/dist/dsp/LoudnessEstimator.js +47 -0
- package/dist/dsp/LoudnessEstimator.js.map +1 -0
- package/dist/dsp/MFCC.d.ts +2 -2
- package/dist/dsp/MFCC.js +15 -15
- package/dist/dsp/MelSpectogram.d.ts +1 -1
- package/dist/dsp/MelSpectogram.js +6 -6
- package/dist/dsp/Rubberband.d.ts +11 -11
- package/dist/dsp/Rubberband.js +27 -27
- package/dist/dsp/Sonic.d.ts +1 -1
- package/dist/dsp/Sonic.js +3 -3
- package/dist/dsp/SpeexResampler.d.ts +1 -1
- package/dist/dsp/SpeexResampler.js +2 -2
- package/dist/math/VectorMath.d.ts +12 -8
- package/dist/math/VectorMath.js +35 -32
- package/dist/math/VectorMath.js.map +1 -1
- package/dist/nlp/ChineseSegmentation.js +2 -2
- package/dist/nlp/CompromiseNLP.js +3 -3
- package/dist/nlp/EspeakPhonemizer.js +30 -30
- package/dist/nlp/IPA.js +20 -20
- package/dist/nlp/JapaneseSegmentation.js +6 -6
- package/dist/nlp/Lexicon.d.ts +1 -1
- package/dist/nlp/Lexicon.js +7 -7
- package/dist/nlp/Segmentation.d.ts +3 -0
- package/dist/nlp/Segmentation.js +21 -14
- package/dist/nlp/Segmentation.js.map +1 -1
- package/dist/nlp/TextNormalizer.js +16 -16
- package/dist/recognition/AmazonTranscribeSTT.d.ts +2 -2
- package/dist/recognition/AmazonTranscribeSTT.js +13 -14
- package/dist/recognition/AmazonTranscribeSTT.js.map +1 -1
- package/dist/recognition/AzureCognitiveServicesSTT.js +5 -6
- package/dist/recognition/AzureCognitiveServicesSTT.js.map +1 -1
- package/dist/recognition/GoogleCloudSTT.d.ts +3 -3
- package/dist/recognition/GoogleCloudSTT.js +18 -18
- package/dist/recognition/OpenAICloudSTT.d.ts +19 -0
- package/dist/recognition/OpenAICloudSTT.js +81 -0
- package/dist/recognition/OpenAICloudSTT.js.map +1 -0
- package/dist/recognition/SileroSTT.d.ts +2 -2
- package/dist/recognition/SileroSTT.js +25 -25
- package/dist/recognition/VoskSTT.d.ts +2 -2
- package/dist/recognition/VoskSTT.js +8 -8
- package/dist/recognition/WhisperCppSTT.d.ts +88 -0
- package/dist/recognition/WhisperCppSTT.js +332 -0
- package/dist/recognition/WhisperCppSTT.js.map +1 -0
- package/dist/recognition/WhisperSTT.d.ts +49 -25
- package/dist/recognition/WhisperSTT.js +626 -481
- package/dist/recognition/WhisperSTT.js.map +1 -1
- package/dist/server/Client.d.ts +1 -1
- package/dist/server/Client.js +22 -22
- package/dist/server/Server.js +9 -9
- package/dist/server/Server.js.map +1 -1
- package/dist/server/Worker.d.ts +22 -22
- package/dist/server/Worker.js +36 -36
- package/dist/server/Worker.js.map +1 -1
- package/dist/server/WorkerStarter.js +2 -2
- package/dist/source-separation/MDXNetSourceSeparation.d.ts +11 -0
- package/dist/source-separation/MDXNetSourceSeparation.js +161 -0
- package/dist/source-separation/MDXNetSourceSeparation.js.map +1 -0
- package/dist/speech-language-detection/SileroLanguageDetection.d.ts +1 -1
- package/dist/speech-language-detection/SileroLanguageDetection.js +7 -7
- package/dist/subtitles/Subtitles.d.ts +10 -0
- package/dist/subtitles/Subtitles.js +2 -2
- package/dist/subtitles/Subtitles.js.map +1 -1
- package/dist/synthesis/AwsPollyTTS.d.ts +1 -1
- package/dist/synthesis/AwsPollyTTS.js +12 -12
- package/dist/synthesis/AzureCognitiveServicesTTS.js +7 -7
- package/dist/synthesis/CoquiServerTTS.js +10 -10
- package/dist/synthesis/CoquiServerTTS.js.map +1 -1
- package/dist/synthesis/ElevenlabsTTS.d.ts +23 -0
- package/dist/synthesis/ElevenlabsTTS.js +103 -0
- package/dist/synthesis/ElevenlabsTTS.js.map +1 -0
- package/dist/synthesis/EspeakTTS.d.ts +6 -5
- package/dist/synthesis/EspeakTTS.js +81 -69
- package/dist/synthesis/EspeakTTS.js.map +1 -1
- package/dist/synthesis/FliteTTS.d.ts +3 -3
- package/dist/synthesis/FliteTTS.js +154 -154
- package/dist/synthesis/FliteTTS.js.map +1 -1
- package/dist/synthesis/GoogleCloudTTS.d.ts +3 -3
- package/dist/synthesis/GoogleCloudTTS.js +17 -17
- package/dist/synthesis/GoogleCloudTTS.js.map +1 -1
- package/dist/synthesis/GoogleTranslateTTS.d.ts +1 -1
- package/dist/synthesis/GoogleTranslateTTS.js +103 -103
- package/dist/synthesis/MicrosoftEdgeTTS.d.ts +2 -2
- package/dist/synthesis/MicrosoftEdgeTTS.js +74 -74
- package/dist/synthesis/OpenAICloudTTS.d.ts +13 -0
- package/dist/synthesis/OpenAICloudTTS.js +169 -0
- package/dist/synthesis/OpenAICloudTTS.js.map +1 -0
- package/dist/synthesis/SamTTS.js +3 -3
- package/dist/synthesis/SapiTTS.d.ts +3 -3
- package/dist/synthesis/SapiTTS.js +26 -26
- package/dist/synthesis/StreamlabsPollyTTS.d.ts +2 -2
- package/dist/synthesis/StreamlabsPollyTTS.js +27 -27
- package/dist/synthesis/SvoxPicoTTS.d.ts +2 -2
- package/dist/synthesis/SvoxPicoTTS.js +65 -65
- package/dist/synthesis/SvoxPicoTTS.js.map +1 -1
- package/dist/synthesis/VitsTTS.d.ts +3 -3
- package/dist/synthesis/VitsTTS.js +378 -378
- package/dist/synthesis/VitsTTS.js.map +1 -1
- package/dist/tests/Test.js +2 -2
- package/dist/utilities/Compression.d.ts +5 -0
- package/dist/utilities/Compression.js +29 -13
- package/dist/utilities/Compression.js.map +1 -1
- package/dist/utilities/FileDownloader.d.ts +1 -1
- package/dist/utilities/FileDownloader.js +16 -16
- package/dist/utilities/FileSystem.js +7 -7
- package/dist/utilities/Locale.d.ts +7 -7
- package/dist/utilities/Locale.js +15 -15
- package/dist/utilities/Logger.js +3 -3
- package/dist/utilities/ObjectUtilities.js +19 -19
- package/dist/utilities/OpenPromise.js +2 -2
- package/dist/utilities/OpenPromise.js.map +1 -1
- package/dist/utilities/PackageManager.js +31 -0
- package/dist/utilities/PackageManager.js.map +1 -1
- package/dist/utilities/PathUtilities.js +8 -8
- package/dist/utilities/RandomGenerator.js +2 -2
- package/dist/utilities/SmoothEstimator.d.ts +8 -0
- package/dist/utilities/SmoothEstimator.js +25 -0
- package/dist/utilities/SmoothEstimator.js.map +1 -0
- package/dist/utilities/TarballMaker.js +8 -8
- package/dist/utilities/Timeline.d.ts +3 -2
- package/dist/utilities/Timeline.js +11 -11
- package/dist/utilities/Timeline.js.map +1 -1
- package/dist/utilities/Timer.js +4 -4
- package/dist/utilities/Utilities.d.ts +4 -0
- package/dist/utilities/Utilities.js +38 -15
- package/dist/utilities/Utilities.js.map +1 -1
- package/dist/utilities/WasmMemoryManager.js +7 -7
- package/dist/utilities/WebReader.js +23 -23
- package/dist/utilities/WikipediaReader.js +2 -2
- package/dist/voice-activity-detection/AdaptiveGateVAD.d.ts +28 -0
- package/dist/voice-activity-detection/AdaptiveGateVAD.js +138 -0
- package/dist/voice-activity-detection/AdaptiveGateVAD.js.map +1 -0
- package/dist/voice-activity-detection/SileroVAD.d.ts +1 -1
- package/dist/voice-activity-detection/SileroVAD.js +5 -5
- package/dist/voice-activity-detection/SileroVAD.js.map +1 -1
- package/dist/voice-activity-detection/WebRtcVAD.d.ts +1 -1
- package/dist/voice-activity-detection/WebRtcVAD.js +4 -4
- package/docs/API.md +29 -11
- package/docs/CLI.md +31 -7
- package/docs/Contributing.md +38 -0
- package/docs/Development.md +93 -19
- package/docs/Engines.md +28 -16
- package/docs/Licenses.md +4 -1
- package/docs/Options.md +158 -78
- package/docs/Releases.md +262 -0
- package/docs/Server.md +7 -7
- package/docs/Tasklist.md +95 -76
- package/docs/Technical.md +4 -4
- package/package.json +13 -14
- package/src/alignment/DTWMfccSequenceAlignment.ts +9 -9
- package/src/alignment/DTWSequenceAlignment.ts +2 -2
- package/src/alignment/DTWSequenceAlignmentWindowed.ts +3 -3
- package/src/alignment/LevenshteinSequenceAlignment.ts +2 -2
- package/src/alignment/SpeechAlignment.ts +204 -119
- package/src/api/API.ts +14 -13
- package/src/api/APIOptions.ts +12 -11
- package/src/api/Alignment.ts +147 -90
- package/src/api/Common.ts +1 -1
- package/src/api/Denoising.ts +28 -28
- package/src/api/LanguageDetection.ts +135 -48
- package/src/api/Recognition.ts +198 -59
- package/src/api/SourceSeparation.ts +99 -0
- package/src/api/Synthesis.ts +217 -181
- package/src/api/Translation.ts +193 -40
- package/src/api/Vad.ts +110 -41
- package/src/audio/AudioBufferConversion.ts +4 -4
- package/src/audio/AudioPlayer.ts +27 -27
- package/src/audio/AudioRecorder.ts +5 -5
- package/src/audio/AudioUtilities.ts +107 -24
- package/src/cli/CLI.ts +313 -164
- package/src/cli/CLIConfigFile.ts +8 -8
- package/src/cli/CLILauncher.ts +6 -6
- package/src/cli/CLIOptionsSchema.ts +2 -2
- package/src/cli/CLIParser.ts +5 -5
- package/src/cli/CLIStarter.ts +4 -4
- package/src/codecs/FFMpegTranscoder.ts +38 -38
- package/src/codecs/TIMITCodec.ts +5 -5
- package/src/codecs/WaveCodec.ts +22 -22
- package/src/denoising/RNNoise.ts +9 -9
- package/src/dsp/BiquadFilter.ts +19 -11
- package/src/dsp/DecayingPeakEstimator.ts +35 -0
- package/src/dsp/FFT.ts +103 -35
- package/src/dsp/KWeightingFilter.ts +43 -0
- package/src/dsp/LoudnessEstimator.ts +74 -0
- package/src/dsp/MFCC.ts +15 -15
- package/src/dsp/MelSpectogram.ts +7 -7
- package/src/dsp/Rubberband.ts +38 -38
- package/src/dsp/Sonic.ts +4 -4
- package/src/dsp/SpeexResampler.ts +2 -2
- package/src/math/VectorMath.ts +42 -33
- package/src/nlp/ChineseSegmentation.ts +3 -3
- package/src/nlp/CompromiseNLP.ts +3 -3
- package/src/nlp/EspeakPhonemizer.ts +30 -30
- package/src/nlp/IPA.ts +20 -20
- package/src/nlp/JapaneseSegmentation.ts +6 -6
- package/src/nlp/Lexicon.ts +8 -8
- package/src/nlp/Segmentation.ts +23 -14
- package/src/nlp/TextNormalizer.ts +16 -16
- package/src/recognition/AmazonTranscribeSTT.ts +16 -17
- package/src/recognition/AzureCognitiveServicesSTT.ts +8 -6
- package/src/recognition/GoogleCloudSTT.ts +21 -21
- package/src/recognition/OpenAICloudSTT.ts +142 -0
- package/src/recognition/SileroSTT.ts +26 -26
- package/src/recognition/VoskSTT.ts +10 -10
- package/src/recognition/WhisperCppSTT.ts +555 -0
- package/src/recognition/WhisperSTT.ts +760 -507
- package/src/server/Client.ts +23 -23
- package/src/server/Server.ts +9 -9
- package/src/server/Worker.ts +53 -53
- package/src/server/WorkerStarter.ts +2 -2
- package/src/source-separation/MDXNetSourceSeparation.ts +228 -0
- package/src/speech-language-detection/SileroLanguageDetection.ts +8 -8
- package/src/subtitles/Subtitles.ts +3 -3
- package/src/synthesis/AwsPollyTTS.ts +14 -14
- package/src/synthesis/AzureCognitiveServicesTTS.ts +10 -10
- package/src/synthesis/CoquiServerTTS.ts +10 -10
- package/src/synthesis/ElevenlabsTTS.ts +137 -0
- package/src/synthesis/EspeakTTS.ts +90 -71
- package/src/synthesis/FliteTTS.ts +157 -157
- package/src/synthesis/GoogleCloudTTS.ts +19 -19
- package/src/synthesis/GoogleTranslateTTS.ts +104 -104
- package/src/synthesis/MicrosoftEdgeTTS.ts +80 -80
- package/src/synthesis/OpenAICloudTTS.ts +196 -0
- package/src/synthesis/SamTTS.ts +3 -3
- package/src/synthesis/SapiTTS.ts +29 -29
- package/src/synthesis/StreamlabsPollyTTS.ts +29 -29
- package/src/synthesis/SvoxPicoTTS.ts +67 -67
- package/src/synthesis/VitsTTS.ts +380 -380
- package/src/tests/Test.ts +4 -4
- package/src/utilities/Compression.ts +34 -13
- package/src/utilities/FileDownloader.ts +19 -19
- package/src/utilities/FileSystem.ts +7 -7
- package/src/utilities/Locale.ts +22 -22
- package/src/utilities/Logger.ts +4 -4
- package/src/utilities/ObjectUtilities.ts +19 -19
- package/src/utilities/OpenPromise.ts +2 -2
- package/src/utilities/PackageManager.ts +40 -0
- package/src/utilities/PathUtilities.ts +8 -8
- package/src/utilities/RandomGenerator.ts +3 -3
- package/src/utilities/SmoothEstimator.ts +35 -0
- package/src/utilities/TarballMaker.ts +9 -9
- package/src/utilities/Timeline.ts +15 -13
- package/src/utilities/Timer.ts +4 -4
- package/src/utilities/Utilities.ts +49 -15
- package/src/utilities/WasmMemoryManager.ts +7 -7
- package/src/utilities/WebReader.ts +23 -23
- package/src/utilities/WikipediaReader.ts +2 -2
- package/src/voice-activity-detection/AdaptiveGateVAD.ts +202 -0
- package/src/voice-activity-detection/SileroVAD.ts +5 -5
- package/src/voice-activity-detection/WebRtcVAD.ts +5 -5
- package/dist/synthesis/ElevenLabsTTS.d.ts +0 -8
- package/dist/synthesis/ElevenLabsTTS.js +0 -82
- package/dist/synthesis/ElevenLabsTTS.js.map +0 -1
- package/src/synthesis/ElevenLabsTTS.ts +0 -104
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { BiquadFilter, createHighpassFilter, createHighshelfFilter } from './BiquadFilter.js';
|
|
2
|
+
export class KWeightingFilter {
|
|
3
|
+
sampleRate;
|
|
4
|
+
useStandard44100Filters;
|
|
5
|
+
highShelfFilter;
|
|
6
|
+
highPassFilter;
|
|
7
|
+
constructor(sampleRate, useStandard44100Filters = false) {
|
|
8
|
+
this.sampleRate = sampleRate;
|
|
9
|
+
this.useStandard44100Filters = useStandard44100Filters;
|
|
10
|
+
if (useStandard44100Filters) {
|
|
11
|
+
// These parameter values are taken from ITU-R BS.1770-2
|
|
12
|
+
// and designed only for a 44100 Hz sampling rate:
|
|
13
|
+
this.highShelfFilter = new BiquadFilter({
|
|
14
|
+
b0: 1.53512485958697,
|
|
15
|
+
b1: -2.69169618940638,
|
|
16
|
+
b2: 1.19839281085285,
|
|
17
|
+
a1: -1.69065929318241,
|
|
18
|
+
a2: 0.73248077421585,
|
|
19
|
+
});
|
|
20
|
+
this.highPassFilter = new BiquadFilter({
|
|
21
|
+
b0: 1.0,
|
|
22
|
+
b1: -2.0,
|
|
23
|
+
b2: 1.0,
|
|
24
|
+
a1: -1.99004745483398,
|
|
25
|
+
a2: 0.99007225036621,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
this.highShelfFilter = createHighshelfFilter(sampleRate, 2000.0, 4.0);
|
|
30
|
+
this.highPassFilter = createHighpassFilter(sampleRate, 1.5, 0.01);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
process(sample) {
|
|
34
|
+
let outputSample = sample;
|
|
35
|
+
outputSample = this.highShelfFilter.filter(outputSample);
|
|
36
|
+
outputSample = this.highPassFilter.filter(outputSample);
|
|
37
|
+
return outputSample;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=KWeightingFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KWeightingFilter.js","sourceRoot":"","sources":["../../src/dsp/KWeightingFilter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE9F,MAAM,OAAO,gBAAgB;IAKX;IACA;IALR,eAAe,CAAc;IAC7B,cAAc,CAAc;IAErC,YACiB,UAAkB,EAClB,0BAA0B,KAAK;QAD/B,eAAU,GAAV,UAAU,CAAQ;QAClB,4BAAuB,GAAvB,uBAAuB,CAAQ;QAE/C,IAAI,uBAAuB,EAAE,CAAC;YAC7B,wDAAwD;YACxD,kDAAkD;YAClD,IAAI,CAAC,eAAe,GAAG,IAAI,YAAY,CAAC;gBACvC,EAAE,EAAE,gBAAgB;gBACpB,EAAE,EAAE,CAAC,gBAAgB;gBACrB,EAAE,EAAE,gBAAgB;gBACpB,EAAE,EAAE,CAAC,gBAAgB;gBACrB,EAAE,EAAE,gBAAgB;aACpB,CAAC,CAAA;YAEF,IAAI,CAAC,cAAc,GAAG,IAAI,YAAY,CAAC;gBACtC,EAAE,EAAE,GAAG;gBACP,EAAE,EAAE,CAAC,GAAG;gBACR,EAAE,EAAE,GAAG;gBACP,EAAE,EAAE,CAAC,gBAAgB;gBACrB,EAAE,EAAE,gBAAgB;aACpB,CAAC,CAAA;QACH,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,eAAe,GAAG,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,CAAC,CAAA;YACrE,IAAI,CAAC,cAAc,GAAG,oBAAoB,CAAC,UAAU,EAAE,GAAG,EAAE,IAAI,CAAC,CAAA;QAClE,CAAC;IACF,CAAC;IAED,OAAO,CAAC,MAAc;QACrB,IAAI,YAAY,GAAG,MAAM,CAAA;QAEzB,YAAY,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,YAAY,CAAC,CAAA;QACxD,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,YAAY,CAAC,CAAA;QAEvD,OAAO,YAAY,CAAA;IACpB,CAAC;CACD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SmoothEstimator } from '../utilities/SmoothEstimator.js';
|
|
2
|
+
import { KWeightingFilter } from './KWeightingFilter.js';
|
|
3
|
+
export declare class LoudnessEstimator {
|
|
4
|
+
readonly options: LoudnessEstimatorOptions;
|
|
5
|
+
readonly channelFilters: KWeightingFilter[];
|
|
6
|
+
readonly channelMeanSquares: SmoothEstimator[];
|
|
7
|
+
readonly minPower: number;
|
|
8
|
+
constructor(options: LoudnessEstimatorOptions);
|
|
9
|
+
process(sample: number, channel: number): void;
|
|
10
|
+
get currentLoudness(): number;
|
|
11
|
+
getCurrentRMSForChannel(channel: number): number;
|
|
12
|
+
}
|
|
13
|
+
export interface LoudnessEstimatorOptions {
|
|
14
|
+
sampleRate: number;
|
|
15
|
+
channelCount: number;
|
|
16
|
+
positiveAdaptationRate: number;
|
|
17
|
+
negativeAdaptationRate: number;
|
|
18
|
+
initialEstimate: number;
|
|
19
|
+
minimumLoudness: number;
|
|
20
|
+
applyKWeighting: boolean;
|
|
21
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { decibelsToGainFactor, gainFactorToDecibels } from '../audio/AudioUtilities.js';
|
|
2
|
+
import { SmoothEstimator } from '../utilities/SmoothEstimator.js';
|
|
3
|
+
import { KWeightingFilter } from './KWeightingFilter.js';
|
|
4
|
+
export class LoudnessEstimator {
|
|
5
|
+
options;
|
|
6
|
+
channelFilters = [];
|
|
7
|
+
channelMeanSquares = [];
|
|
8
|
+
minPower;
|
|
9
|
+
constructor(options) {
|
|
10
|
+
this.options = options;
|
|
11
|
+
const initialMeanSquares = decibelsToGainFactor(options.initialEstimate) ** 2;
|
|
12
|
+
const ticksPerSecond = this.options.sampleRate * this.options.channelCount;
|
|
13
|
+
for (let i = 0; i < options.channelCount; i++) {
|
|
14
|
+
const weightingFilter = new KWeightingFilter(options.sampleRate);
|
|
15
|
+
const channelMeanSquares = new SmoothEstimator(options.positiveAdaptationRate / ticksPerSecond, options.negativeAdaptationRate / ticksPerSecond, initialMeanSquares);
|
|
16
|
+
this.channelFilters.push(weightingFilter);
|
|
17
|
+
this.channelMeanSquares.push(channelMeanSquares);
|
|
18
|
+
}
|
|
19
|
+
this.minPower = decibelsToGainFactor(options.minimumLoudness) ** 2;
|
|
20
|
+
}
|
|
21
|
+
process(sample, channel) {
|
|
22
|
+
let filteredSample;
|
|
23
|
+
if (this.options.applyKWeighting) {
|
|
24
|
+
filteredSample = this.channelFilters[channel].process(sample);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
filteredSample = sample;
|
|
28
|
+
}
|
|
29
|
+
const filteredSampleSquared = filteredSample ** 2;
|
|
30
|
+
const channelMeanSquares = this.channelMeanSquares[channel];
|
|
31
|
+
channelMeanSquares.update(filteredSampleSquared);
|
|
32
|
+
channelMeanSquares.estimate = Math.max(channelMeanSquares.estimate, this.minPower);
|
|
33
|
+
}
|
|
34
|
+
get currentLoudness() {
|
|
35
|
+
let totalMeanSquares = 0;
|
|
36
|
+
for (let i = 0; i < this.options.channelCount; i++) {
|
|
37
|
+
totalMeanSquares += this.channelMeanSquares[i].estimate;
|
|
38
|
+
}
|
|
39
|
+
const rms = Math.sqrt(totalMeanSquares / this.options.channelCount);
|
|
40
|
+
const rmsDecibels = gainFactorToDecibels(rms);
|
|
41
|
+
return rmsDecibels;
|
|
42
|
+
}
|
|
43
|
+
getCurrentRMSForChannel(channel) {
|
|
44
|
+
return Math.sqrt(this.channelMeanSquares[channel].estimate);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=LoudnessEstimator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoudnessEstimator.js","sourceRoot":"","sources":["../../src/dsp/LoudnessEstimator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,MAAM,OAAO,iBAAiB;IAMD;IALnB,cAAc,GAAuB,EAAE,CAAA;IACvC,kBAAkB,GAAsB,EAAE,CAAA;IAE1C,QAAQ,CAAQ;IAEzB,YAA4B,OAAiC;QAAjC,YAAO,GAAP,OAAO,CAA0B;QAC5D,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAA;QAE7E,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAA;QAE1E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,EAAE,EAAE,CAAC;YAC/C,MAAM,eAAe,GACpB,IAAI,gBAAgB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;YAEzC,MAAM,kBAAkB,GACvB,IAAI,eAAe,CAAC,OAAO,CAAC,sBAAsB,GAAG,cAAc,EAAE,OAAO,CAAC,sBAAsB,GAAG,cAAc,EAAE,kBAAkB,CAAC,CAAA;YAE1I,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;YACzC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA;QACjD,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,oBAAoB,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAA;IACnE,CAAC;IAED,OAAO,CAAC,MAAc,EAAE,OAAe;QACtC,IAAI,cAAsB,CAAA;QAE1B,IAAI,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC;YAClC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAC9D,CAAC;aAAM,CAAC;YACP,cAAc,GAAG,MAAM,CAAA;QACxB,CAAC;QAED,MAAM,qBAAqB,GAAG,cAAc,IAAI,CAAC,CAAA;QAEjD,MAAM,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAA;QAE3D,kBAAkB,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAA;QAEhD,kBAAkB,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;IACnF,CAAC;IAED,IAAI,eAAe;QAClB,IAAI,gBAAgB,GAAG,CAAC,CAAA;QAExB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,EAAE,EAAE,CAAC;YACpD,gBAAgB,IAAI,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAA;QACxD,CAAC;QAED,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;QACnE,MAAM,WAAW,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAA;QAE7C,OAAO,WAAW,CAAA;IACnB,CAAC;IAED,uBAAuB,CAAC,OAAe;QACtC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAA;IAC5D,CAAC;CACD"}
|
package/dist/dsp/MFCC.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { RawAudio } from
|
|
1
|
+
import { RawAudio } from '../audio/AudioUtilities.js';
|
|
2
2
|
export declare function computeMFCCs(monoAudio: RawAudio, options?: MfccOptions): Promise<number[][]>;
|
|
3
3
|
export declare function melSpectogramToMFCCs(melSpectogram: Float32Array[], mfccFeatureCount: number): Float32Array[];
|
|
4
|
-
export declare function melSpectrumToMFCC(melSpectrum: Float32Array, mfccFeatureCount: number, dctMatrix: Float32Array[], normalization?:
|
|
4
|
+
export declare function melSpectrumToMFCC(melSpectrum: Float32Array, mfccFeatureCount: number, dctMatrix: Float32Array[], normalization?: 'none' | 'orthonormal'): Float32Array;
|
|
5
5
|
export declare function createDCTType2CoefficientMatrix(mfccFeatureCount: number, melBandCount: number): Float32Array[];
|
|
6
6
|
export declare function mfccBufferToVectors(mfccBuffer: Float64Array, mfccFeatureCount: number): number[][];
|
|
7
7
|
export declare function applyEmphasis(samples: Float32Array, emphasisFactor?: number, initialState?: number): Float32Array;
|
package/dist/dsp/MFCC.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { extendDeep } from
|
|
2
|
-
import { Logger } from
|
|
3
|
-
import { resampleAudioSpeex } from
|
|
4
|
-
import { computeMelSpectogram } from
|
|
5
|
-
import { powerToDecibels } from
|
|
6
|
-
import { normalizeVectors } from
|
|
1
|
+
import { extendDeep } from '../utilities/ObjectUtilities.js';
|
|
2
|
+
import { Logger } from '../utilities/Logger.js';
|
|
3
|
+
import { resampleAudioSpeex } from './SpeexResampler.js';
|
|
4
|
+
import { computeMelSpectogram } from './MelSpectogram.js';
|
|
5
|
+
import { powerToDecibels } from '../audio/AudioUtilities.js';
|
|
6
|
+
import { normalizeVectors } from '../math/VectorMath.js';
|
|
7
7
|
export async function computeMFCCs(monoAudio, options = {}) {
|
|
8
8
|
const logger = new Logger();
|
|
9
|
-
logger.start(
|
|
9
|
+
logger.start('Initialize options');
|
|
10
10
|
if (monoAudio.audioChannels.length != 1) {
|
|
11
|
-
throw new Error(
|
|
11
|
+
throw new Error('Audio must be mono');
|
|
12
12
|
}
|
|
13
13
|
options = extendDefaultMfccOptions(options);
|
|
14
14
|
const analysisSampleRate = options.analysisSampleRate;
|
|
@@ -28,22 +28,22 @@ export async function computeMFCCs(monoAudio, options = {}) {
|
|
|
28
28
|
const resampledAudio = await resampleAudioSpeex(monoAudio, analysisSampleRate);
|
|
29
29
|
let mfccs;
|
|
30
30
|
if (emphasisFactor > 0) {
|
|
31
|
-
logger.start(
|
|
31
|
+
logger.start('Apply emphasis');
|
|
32
32
|
resampledAudio.audioChannels[0] = applyEmphasis(resampledAudio.audioChannels[0], emphasisFactor);
|
|
33
33
|
}
|
|
34
|
-
logger.start(
|
|
34
|
+
logger.start('Compute Mel spectogram');
|
|
35
35
|
const { melSpectogram } = await computeMelSpectogram(resampledAudio, fftOrder, windowSize, hopLength, filterbankCount, lowerFrequencyHz, upperFrequencyHz);
|
|
36
|
-
logger.start(
|
|
36
|
+
logger.start('Extract MFCCs from Mel spectogram');
|
|
37
37
|
const mfccsFloat32 = melSpectogramToMFCCs(melSpectogram, featureCount);
|
|
38
38
|
mfccs = mfccsFloat32.map(mfcc => Array.from(mfcc));
|
|
39
39
|
if (options.normalize) {
|
|
40
|
-
logger.start(
|
|
40
|
+
logger.start('Normalize MFCCs');
|
|
41
41
|
const { normalizedVectors, mean, stdDeviation } = normalizeVectors(mfccs);
|
|
42
42
|
mfccs = normalizedVectors;
|
|
43
43
|
//mfccs = mfccs.map(mfcc => subtractVectors(mfcc, mean))
|
|
44
44
|
}
|
|
45
45
|
if (lifteringFactor > 0) {
|
|
46
|
-
logger.start(
|
|
46
|
+
logger.start('Apply liftering to MFCCs');
|
|
47
47
|
mfccs = applyLiftering(mfccs, lifteringFactor);
|
|
48
48
|
}
|
|
49
49
|
if (zeroFirstCoefficient) {
|
|
@@ -60,11 +60,11 @@ export function melSpectogramToMFCCs(melSpectogram, mfccFeatureCount) {
|
|
|
60
60
|
const mfccs = melSpectogram.map(frame => melSpectrumToMFCC(frame, mfccFeatureCount, dctMatrix));
|
|
61
61
|
return mfccs;
|
|
62
62
|
}
|
|
63
|
-
export function melSpectrumToMFCC(melSpectrum, mfccFeatureCount, dctMatrix, normalization =
|
|
63
|
+
export function melSpectrumToMFCC(melSpectrum, mfccFeatureCount, dctMatrix, normalization = 'orthonormal') {
|
|
64
64
|
const melBandCount = melSpectrum.length;
|
|
65
65
|
let firstFeatureNormalizationFactor;
|
|
66
66
|
let nonfirstFeatureNormalizationFactor;
|
|
67
|
-
if (normalization ==
|
|
67
|
+
if (normalization == 'orthonormal') {
|
|
68
68
|
firstFeatureNormalizationFactor = Math.sqrt(1 / (4 * mfccFeatureCount));
|
|
69
69
|
nonfirstFeatureNormalizationFactor = Math.sqrt(1 / (2 * mfccFeatureCount));
|
|
70
70
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RawAudio } from
|
|
1
|
+
import { RawAudio } from '../audio/AudioUtilities.js';
|
|
2
2
|
export declare function computeMelSpectogram(rawAudio: RawAudio, fftOrder: number, windowSize: number, hopLength: number, filterbankCount: number, lowerFrequencyHz: number, upperFrequencyHz: number): Promise<{
|
|
3
3
|
melSpectogram: Float32Array[];
|
|
4
4
|
fftFrames: Float32Array[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Logger } from
|
|
2
|
-
import * as FFT from
|
|
1
|
+
import { Logger } from '../utilities/Logger.js';
|
|
2
|
+
import * as FFT from './FFT.js';
|
|
3
3
|
export async function computeMelSpectogram(rawAudio, fftOrder, windowSize, hopLength, filterbankCount, lowerFrequencyHz, upperFrequencyHz) {
|
|
4
4
|
const logger = new Logger();
|
|
5
|
-
logger.start(
|
|
5
|
+
logger.start('Compute mel filterbank');
|
|
6
6
|
const binCount = (fftOrder / 2) + 2;
|
|
7
7
|
const nyquistFrequency = rawAudio.sampleRate / 2;
|
|
8
8
|
const binFrequencies = FFT.getBinFrequencies(binCount, nyquistFrequency);
|
|
@@ -15,10 +15,10 @@ export async function computeMelSpectogram(rawAudio, fftOrder, windowSize, hopLe
|
|
|
15
15
|
}
|
|
16
16
|
export async function computeMelSpectogramUsingFilterbanks(rawAudio, fftOrder, windowSize, hopLength, filterbanks) {
|
|
17
17
|
const logger = new Logger();
|
|
18
|
-
logger.start(
|
|
18
|
+
logger.start('Compute short-time FFTs');
|
|
19
19
|
const audioSamples = rawAudio.audioChannels[0];
|
|
20
|
-
const fftFrames = await FFT.stftr(audioSamples, fftOrder, windowSize, hopLength,
|
|
21
|
-
logger.start(
|
|
20
|
+
const fftFrames = await FFT.stftr(audioSamples, fftOrder, windowSize, hopLength, 'hann');
|
|
21
|
+
logger.start('Convert FFT frames to a mel spectogram');
|
|
22
22
|
const melSpectogram = fftFramesToMelSpectogram(fftFrames, filterbanks);
|
|
23
23
|
logger.end();
|
|
24
24
|
return { melSpectogram, fftFrames };
|
package/dist/dsp/Rubberband.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RawAudio } from
|
|
1
|
+
import { RawAudio } from '../audio/AudioUtilities.js';
|
|
2
2
|
export declare function stretchTimePitch(rawAudio: RawAudio, speed: number, pitchScale: number, options: RubberbandOptions): Promise<RawAudio>;
|
|
3
3
|
export declare function getRubberbandInstance(): Promise<any>;
|
|
4
4
|
export declare function rubberBandOptionsToFlags(options: RubberbandOptions): number;
|
|
@@ -39,14 +39,14 @@ export declare enum RubberBandPresetOption {
|
|
|
39
39
|
}
|
|
40
40
|
export declare const defaultRubberbandOptions: RubberbandOptions;
|
|
41
41
|
export type RubberbandOptions = {
|
|
42
|
-
stretch?:
|
|
43
|
-
transients?:
|
|
44
|
-
detector?:
|
|
45
|
-
phase?:
|
|
46
|
-
window?:
|
|
47
|
-
smoothing?:
|
|
48
|
-
formant?:
|
|
49
|
-
pitch?:
|
|
50
|
-
channels?:
|
|
51
|
-
engine?:
|
|
42
|
+
stretch?: 'elastic' | 'precise';
|
|
43
|
+
transients?: 'crisp' | 'mixed' | 'smooth';
|
|
44
|
+
detector?: 'compound' | 'percussive' | 'soft';
|
|
45
|
+
phase?: 'laminar' | 'independent';
|
|
46
|
+
window?: 'standard' | 'long' | 'short';
|
|
47
|
+
smoothing?: 'off' | 'on';
|
|
48
|
+
formant?: 'shited' | 'preserved';
|
|
49
|
+
pitch?: 'high-speed' | 'high-quality' | 'high-consistency';
|
|
50
|
+
channels?: 'apart' | 'together';
|
|
51
|
+
engine?: 'faster' | 'finer';
|
|
52
52
|
};
|
package/dist/dsp/Rubberband.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { extendDeep } from
|
|
2
|
-
import { concatFloat32Arrays } from
|
|
3
|
-
import { WasmMemoryManager } from
|
|
1
|
+
import { extendDeep } from '../utilities/ObjectUtilities.js';
|
|
2
|
+
import { concatFloat32Arrays } from '../utilities/Utilities.js';
|
|
3
|
+
import { WasmMemoryManager } from '../utilities/WasmMemoryManager.js';
|
|
4
4
|
let rubberbandInstance;
|
|
5
5
|
export async function stretchTimePitch(rawAudio, speed, pitchScale, options) {
|
|
6
6
|
options = extendDeep(defaultRubberbandOptions, options);
|
|
@@ -90,46 +90,46 @@ export async function getRubberbandInstance() {
|
|
|
90
90
|
}
|
|
91
91
|
export function rubberBandOptionsToFlags(options) {
|
|
92
92
|
let flags = 0;
|
|
93
|
-
if (options.stretch ==
|
|
93
|
+
if (options.stretch == 'precise') {
|
|
94
94
|
flags += RubberBandOptionFlag.StretchPrecise;
|
|
95
95
|
}
|
|
96
|
-
if (options.transients ==
|
|
96
|
+
if (options.transients == 'mixed') {
|
|
97
97
|
flags += RubberBandOptionFlag.TransientsMixed;
|
|
98
98
|
}
|
|
99
|
-
else if (options.transients ==
|
|
99
|
+
else if (options.transients == 'smooth') {
|
|
100
100
|
flags += RubberBandOptionFlag.TransientsSmooth;
|
|
101
101
|
}
|
|
102
|
-
if (options.detector ==
|
|
102
|
+
if (options.detector == 'percussive') {
|
|
103
103
|
flags += RubberBandOptionFlag.DetectorPercussive;
|
|
104
104
|
}
|
|
105
|
-
else if (options.detector ==
|
|
105
|
+
else if (options.detector == 'soft') {
|
|
106
106
|
flags += RubberBandOptionFlag.DetectorSoft;
|
|
107
107
|
}
|
|
108
|
-
if (options.phase ==
|
|
108
|
+
if (options.phase == 'independent') {
|
|
109
109
|
flags += RubberBandOptionFlag.PhaseIndependent;
|
|
110
110
|
}
|
|
111
|
-
if (options.window ==
|
|
111
|
+
if (options.window == 'short') {
|
|
112
112
|
flags += RubberBandOptionFlag.WindowShort;
|
|
113
113
|
}
|
|
114
|
-
else if (options.window ==
|
|
114
|
+
else if (options.window == 'long') {
|
|
115
115
|
flags += RubberBandOptionFlag.WindowLong;
|
|
116
116
|
}
|
|
117
|
-
if (options.smoothing ==
|
|
117
|
+
if (options.smoothing == 'on') {
|
|
118
118
|
flags += RubberBandOptionFlag.SmoothingOn;
|
|
119
119
|
}
|
|
120
|
-
if (options.formant ==
|
|
120
|
+
if (options.formant == 'preserved') {
|
|
121
121
|
flags += RubberBandOptionFlag.FormantPreserved;
|
|
122
122
|
}
|
|
123
|
-
if (options.pitch ==
|
|
123
|
+
if (options.pitch == 'high-quality') {
|
|
124
124
|
flags += RubberBandOptionFlag.PitchHighQuality;
|
|
125
125
|
}
|
|
126
|
-
else if (options.pitch ==
|
|
126
|
+
else if (options.pitch == 'high-consistency') {
|
|
127
127
|
flags += RubberBandOptionFlag.PitchHighConsistency;
|
|
128
128
|
}
|
|
129
|
-
if (options.channels ==
|
|
129
|
+
if (options.channels == 'together') {
|
|
130
130
|
flags += RubberBandOptionFlag.ChannelsTogether;
|
|
131
131
|
}
|
|
132
|
-
if (options.engine ==
|
|
132
|
+
if (options.engine == 'finer') {
|
|
133
133
|
flags += RubberBandOptionFlag.EngineFiner;
|
|
134
134
|
}
|
|
135
135
|
return flags;
|
|
@@ -172,15 +172,15 @@ export var RubberBandPresetOption;
|
|
|
172
172
|
RubberBandPresetOption[RubberBandPresetOption["PercussiveOptions"] = 1056768] = "PercussiveOptions";
|
|
173
173
|
})(RubberBandPresetOption || (RubberBandPresetOption = {}));
|
|
174
174
|
export const defaultRubberbandOptions = {
|
|
175
|
-
stretch:
|
|
176
|
-
transients:
|
|
177
|
-
detector:
|
|
178
|
-
phase:
|
|
179
|
-
window:
|
|
180
|
-
smoothing:
|
|
181
|
-
formant:
|
|
182
|
-
pitch:
|
|
183
|
-
channels:
|
|
184
|
-
engine:
|
|
175
|
+
stretch: 'elastic',
|
|
176
|
+
transients: 'crisp',
|
|
177
|
+
detector: 'compound',
|
|
178
|
+
phase: 'laminar',
|
|
179
|
+
window: 'standard',
|
|
180
|
+
smoothing: 'off',
|
|
181
|
+
formant: 'shited',
|
|
182
|
+
pitch: 'high-speed',
|
|
183
|
+
channels: 'apart',
|
|
184
|
+
engine: 'faster'
|
|
185
185
|
};
|
|
186
186
|
//# sourceMappingURL=Rubberband.js.map
|
package/dist/dsp/Sonic.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { RawAudio } from
|
|
1
|
+
import { RawAudio } from '../audio/AudioUtilities.js';
|
|
2
2
|
export declare function stretchTimePitch(rawAudio: RawAudio, speed: number, pitchScale: number): Promise<RawAudio>;
|
package/dist/dsp/Sonic.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WasmMemoryManager } from
|
|
1
|
+
import { WasmMemoryManager } from '../utilities/WasmMemoryManager.js';
|
|
2
2
|
let sonicInstance;
|
|
3
3
|
export async function stretchTimePitch(rawAudio, speed, pitchScale) {
|
|
4
4
|
const sampleRate = rawAudio.sampleRate;
|
|
@@ -14,11 +14,11 @@ export async function stretchTimePitch(rawAudio, speed, pitchScale) {
|
|
|
14
14
|
inputSamplesRef.view.set(inputSamples);
|
|
15
15
|
const writeSuccess = m._sonicWriteFloatToStream(streamPtr, inputSamplesRef.address, inputSampleCount);
|
|
16
16
|
if (writeSuccess != 1) {
|
|
17
|
-
throw new Error(
|
|
17
|
+
throw new Error('Sonic error: failed write to stream');
|
|
18
18
|
}
|
|
19
19
|
const flushSuccess = m._sonicFlushStream(streamPtr);
|
|
20
20
|
if (flushSuccess != 1) {
|
|
21
|
-
throw new Error(
|
|
21
|
+
throw new Error('Sonic error: failed flushing stream');
|
|
22
22
|
}
|
|
23
23
|
const samplesAvailable = m._sonicSamplesAvailable(streamPtr);
|
|
24
24
|
const outputSamplesRef = wasmMemory.allocFloat32Array(samplesAvailable);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { RawAudio } from
|
|
1
|
+
import { RawAudio } from '../audio/AudioUtilities.js';
|
|
2
2
|
export declare function resampleAudioSpeex(rawAudio: RawAudio, outSampleRate: number, quality?: number): Promise<RawAudio>;
|
|
3
3
|
export declare function getSpeexResamplerInstance(): Promise<any>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { cloneRawAudio } from
|
|
2
|
-
import { WasmMemoryManager } from
|
|
1
|
+
import { cloneRawAudio } from '../audio/AudioUtilities.js';
|
|
2
|
+
import { WasmMemoryManager } from '../utilities/WasmMemoryManager.js';
|
|
3
3
|
let speexResamplerInstance;
|
|
4
4
|
export async function resampleAudioSpeex(rawAudio, outSampleRate, quality = 0) {
|
|
5
5
|
const channelCount = rawAudio.audioChannels.length;
|
|
@@ -10,12 +10,12 @@ export declare function centerVectors(vectors: number[][], weights?: number[]):
|
|
|
10
10
|
};
|
|
11
11
|
export declare function centerVector(vector: number[]): number[];
|
|
12
12
|
export declare function scaleToSumTo1(vector: number[]): number[];
|
|
13
|
-
export declare function normalizeVector(vector: number[], kind?:
|
|
13
|
+
export declare function normalizeVector(vector: number[], kind?: 'population' | 'sample'): {
|
|
14
14
|
normalizedVector: number[];
|
|
15
15
|
mean: number;
|
|
16
16
|
stdDeviation: number;
|
|
17
17
|
};
|
|
18
|
-
export declare function normalizeVectors(vectors: number[][], kind?:
|
|
18
|
+
export declare function normalizeVectors(vectors: number[][], kind?: 'population' | 'sample'): {
|
|
19
19
|
normalizedVectors: number[][];
|
|
20
20
|
mean: number[];
|
|
21
21
|
stdDeviation: number[];
|
|
@@ -23,20 +23,20 @@ export declare function normalizeVectors(vectors: number[][], kind?: "population
|
|
|
23
23
|
export declare function deNormalizeVectors(normalizedVectors: number[][], originalMean: number[], originalStdDeviation: number[]): number[][];
|
|
24
24
|
export declare function meanOfVectors(vectors: number[][]): number[];
|
|
25
25
|
export declare function weightedMeanOfVectors(vectors: number[][], weights: number[]): number[];
|
|
26
|
-
export declare function stdDeviationOfVectors(vectors: number[][], kind?:
|
|
27
|
-
export declare function varianceOfVectors(vectors: number[][], kind?:
|
|
26
|
+
export declare function stdDeviationOfVectors(vectors: number[][], kind?: 'population' | 'sample', mean?: number[]): number[];
|
|
27
|
+
export declare function varianceOfVectors(vectors: number[][], kind?: 'population' | 'sample', mean?: number[]): number[];
|
|
28
28
|
export declare function meanOfVector(vector: number[]): number;
|
|
29
29
|
export declare function medianOfVector(vector: number[]): number;
|
|
30
|
-
export declare function stdDeviationOfVector(vector: number[], kind?:
|
|
31
|
-
export declare function varianceOfVector(vector: number[], kind?:
|
|
30
|
+
export declare function stdDeviationOfVector(vector: number[], kind?: 'population' | 'sample', mean?: number): number;
|
|
31
|
+
export declare function varianceOfVector(vector: number[], kind?: 'population' | 'sample', mean?: number): number;
|
|
32
32
|
export declare function logOfVector(vector: number[], minVal?: number): number[];
|
|
33
33
|
export declare function expOfVector(vector: number[]): number[];
|
|
34
34
|
export declare function transpose(matrix: number[][]): number[][];
|
|
35
35
|
export declare function movingAverageOfWindow3(vector: number[]): number[];
|
|
36
36
|
export declare function averageMeanSquaredError(actual: number[][], expected: number[][]): number;
|
|
37
37
|
export declare function meanSquaredError(actual: number[], expected: number[]): number;
|
|
38
|
-
export declare function
|
|
39
|
-
export declare function
|
|
38
|
+
export declare function euclidianDistance(vector1: number[], vector2: number[]): number;
|
|
39
|
+
export declare function squaredEuclidianDistance(vector1: number[], vector2: number[]): number;
|
|
40
40
|
export declare function cosineDistance(vector1: number[], vector2: number[]): number;
|
|
41
41
|
export declare function cosineSimilarity(vector1: number[], vector2: number[]): number;
|
|
42
42
|
export declare function minkowskiDistance(vector1: number[], vector2: number[], power: number): number;
|
|
@@ -68,3 +68,7 @@ export declare class IncrementalMean {
|
|
|
68
68
|
addValueToMean(value: number): void;
|
|
69
69
|
}
|
|
70
70
|
export type DistanceFunction = (a: number[], b: number[]) => number;
|
|
71
|
+
export interface ComplexNumber {
|
|
72
|
+
real: number;
|
|
73
|
+
imaginary: number;
|
|
74
|
+
}
|