Accent Conversion (AC)
For more information about the AC Technology, please refer to our SDK Features section.
AC Integration in JS
Once Krisp JS SDK is setup, there are a few steps to follow in order to start using AC.
KrispSDK Constructor Arguments
Property | Type | Default | Description |
---|---|---|---|
params.useAR | Boolean | false | This flag indicates if you want to use AC or not |
params.useRawModelPath | Boolean | false | Use this for setting model paths from other origins, otherwise skip this |
params.useSharedArrayBuffer | Boolean | false | Enables using SharedArrayBuffer between worker and worklet threads to exchange audio data improving CPU performance. Make sure to check the Security Requirements before using the feature |
params.frameDurationMS | Number | 10 | Allows setting variable frame duration buffer sizes via frameDurationMS. Currently, we support the following values: 10, 15, 20, 30, 32 A higher frameDurationMS value is expected to reduce CPU load |
params.models.modelAR | String | undefined | path to the AC model |
Step 1. Configure KrispSDK to use AC
To use AC you should adjust KrispSDK params on creation. There are few options to configure:
const sdk = new KrispSDK({
params: {
useAR: true,
models: {
modelAR: "/dist/models/modelAR.kef", // Add AR model url (provided with the sdk)**
},
},
});
Step 2. Pass audio stream while creating acccentFilterNode
After configuring KrispSDK you have to pass an audio stream while creating the accent filter
const audioSettings = {
audio: {
echoCancellation: true,
noiseSuppression: false,
autoGainControl: false
}
};
const stream = await navigator.mediaDevices.getUserMedia(audioSettings);
const accentFilterNode = await krispSDK.createAccentReductionFilter(
{
audioContext,
stream
},
function onReady() {
filterNode.enable();
// triggered when Accent Filter initialized
// handle you own buisness logic
},
function onDispose() {
// triggered when Accent Filter disposed
// handle you own buisness logic
}
);
source.connect(accentFilterNode).connect(destination);
destination.stream; // destination stream is the resulting stream which can be used in your buisness logic
You can checkout the live demo
Updated 3 days ago