π JS SDK v1.0.12: Inbound NC
over 1 year ago by Inessa M
Release date: 10 August, 2023
What's New
β New functionality
- Inbound NC (Speaker) support
- Support for loading SDK models from Chrome extension
Inbound NC
Krisp SDK package now includes an inbound model. To use it, firstly move the model to your project and set the URL in the initialization parameters.
new KrispSDK({
params: {
...
inboundModels: {
model8: "/dist/models/model_inbound_8.kw"
}
}
});
After this, you need to create a filter node similar to the outbound stream.
const filterNode = await krispSDK.createNoiseFilter({
audioContext,
isInbound: true
});
Once the FilterNode
is ready, you can enable it and connect it to the destination stream.
let peer1Stream = new MediaStream(); // Inbound stream of first peer connection
let peer2Stream = new MediaStream(); // Inbound stream of second peer connection
filterNode.addEventListener('ready', () => {
filterNode.enable();
const source1 = audioContext.createMediaStreamSource(peer1Stream);
const source2 = audioContext.createMediaStreamSource(peer2Stream);
source1.connect(filterNode);
source2.connect(filterNode);
filterNode.connect(audioContext.destination);
});
βNote: Regardless of the AudioContext sampleRate, the inbound filter node will choose the 8k model. This means that even if you have an AudioContext with a sampleRate of 44100kHz, it will still use the 8k model to filter out inbound noise.