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,
|
||||
}
|
||||
Reference in New Issue
Block a user