Noise Suppression technology mutes the unwanted background noise, providing clear audio for communication. Both recording audio and applying noise suppression to the recorded audio is not trivial.
Picovoice's Koala Noise Suppression provides a fast and easy method for processing and suppressing audio on device (i.e, audio is processed on the browser).
Koala Noise Suppression engine is available for all major browsers: Chrome, Safari, Firefox and Edge.
Install Koala Noise Suppression Web SDK
Install Koala Noise Suppression Web SDK using npm
:
Sign up for Picovoice Console
Sign up for Picovoice Console for free and copy your AccessKey
. It handles authentication and authorization.
Usage
Koala Noise Suppression Model
Add the Koala Noise Suppression model to the project by:
- Either copying the model file to the project's public directory:
(or)
- Create a base64 string of the model using the
pvbase64
script included in the package:
Create an object containing the Koala Noise Suppression model options:
Initialization
Create callback functions:
processCallback
: gets the results of Koala Noise Suppression engine.
processErrorCallback
: Optional callback to handle errors if an error occurs while running Koala Noise Suppression engine.
Initialize Koala Noise Suppression with koalaModel
variable containing the model options and the callback functions defined above:
KoalaWorker
uses web workers to process audio data. Web workers might not be supported (i.e. Firefox private mode). In this case,
use Koala
instead, which use main thread to process audio data.
Processing Audio Frames
Koala Noise Suppression processes audio in chunks (frames). The .frameLength
property gives the number of audio samples per frame that are required by Koala Noise Suppression, while the .sampleRate
property gives the audio sample rate that is required. Audio samples must be 16-bit integers.
The enhanced audio is received from processCallback
as mentioned above. In the case that the next audio frame does not follow the previous one, call reset
before calling process
again.
Clean up
Clean up allocated resources:
If Koala
was used instead of KoalaWorker
, clean resources with await koala.release()
.
Working Example
All that is left is to wire up the audio recording. This example uses WebVoiceProcessor to record audio.
Install web-voice-processor
using npm
:
The following code snippet records audio from and applies noise suppression to the recorded data:
For a complete working project, take a look at the Koala Noise Suppression Web Demo or dive into the Koala Noise Suppression Web SDK quick start guide.
Start Building