Add JavaScript (node-addon) API for speech enhancement GTCRN models (#1996)
This commit is contained in:
28
scripts/node-addon-api/lib/non-streaming-speech-denoiser.js
Normal file
28
scripts/node-addon-api/lib/non-streaming-speech-denoiser.js
Normal file
@@ -0,0 +1,28 @@
|
||||
const addon = require('./addon.js');
|
||||
|
||||
class OfflineSpeechDenoiser {
|
||||
constructor(config) {
|
||||
this.handle = addon.createOfflineSpeechDenoiser(config);
|
||||
this.config = config;
|
||||
|
||||
this.sampleRate =
|
||||
addon.offlineSpeechDenoiserGetSampleRateWrapper(this.handle);
|
||||
}
|
||||
|
||||
/*
|
||||
obj is
|
||||
{samples: samples, sampleRate: sampleRate, enableExternalBuffer: true}
|
||||
|
||||
samples is a float32 array containing samples in the range [-1, 1]
|
||||
sampleRate is a number
|
||||
|
||||
return an object {samples: Float32Array, sampleRate: <a number>}
|
||||
*/
|
||||
run(obj) {
|
||||
return addon.offlineSpeechDenoiserRunWrapper(this.handle, obj);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
OfflineSpeechDenoiser,
|
||||
}
|
||||
@@ -9,6 +9,7 @@ const at = require('./audio-tagg.js');
|
||||
const punct = require('./punctuation.js');
|
||||
const kws = require('./keyword-spotter.js');
|
||||
const sd = require('./non-streaming-speaker-diarization.js');
|
||||
const speech_denoiser = require('./non-streaming-speech-denoiser.js');
|
||||
|
||||
module.exports = {
|
||||
OnlineRecognizer: streaming_asr.OnlineRecognizer,
|
||||
@@ -26,4 +27,5 @@ module.exports = {
|
||||
Punctuation: punct.Punctuation,
|
||||
KeywordSpotter: kws.KeywordSpotter,
|
||||
OfflineSpeakerDiarization: sd.OfflineSpeakerDiarization,
|
||||
OfflineSpeechDenoiser: speech_denoiser.OfflineSpeechDenoiser,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user