Blog
For a while now Jitsi Meet has been using the RNNoise library to calculate voice audio detection scores for audio input tracks and leveraging those to implement functionality such as talk while muted and noisy mic detection. However, RNnoise also has the capability to denoise audio.
In this article well briefly go through the steps taken to implement noise suppression using RNnoise in Jitsi Meet.
Whats RNNoise anyway?
RNNoise, as the authors describe it, combines classic signal processing with deep learning, but its small and fast, this makes it perfect for real time audio and does a good job at denoising.
Its written in C which allows us to (relatively) easily use it on the Web by compiling it as a WASM module, that combined with a couple of optimizations gets us noise suppression functionality with very little added latency.
Working with Audio Worklets
Previously Jitsi Meet processed audio using ScriptProcessorNode which handles audio samples on the main UI thread. Because the audio track wasnt altered and we simply extracted some information from a copy of the track, performance issues werent apparent. With noise suppression the track gets modified, so latency is noticeable, not to mention that any interference on the main UI thread will impact the audio quality, so we switched to audio worklets.
Audio worklets run in a separate thread from the main UI thread, so samples can be processed without interference. We wont go into the specifics of implementing one as there are plenty of awesome resources on the web such as: thisand this. Our worklet implementation can be found here.
Webpack integration
Even though using an audio worklet looks fairly straightforward there were a couple of bumps along the road.
First off, and probably the most frustrating part was making them work with webpacks dev server.
Long story short, the dev server has some neat features such as hot module replacement and live reloading, these rely on some bootstrap code added to the output JavaScript bundle. The issue here is that audio worklet code runs under the AudioWorkletGlobalScopes context which doesnt know anything about constructs like window, this or self, however the aforementioned boilerplate code makes ample use of them and there doesnt seem to be a way to tell it that the context in which its running is a worklet.
We tried several approaches but the solution that worked for us was to ignore the dev server bootstrap code altogether for the worklets entry point, which can be configured in webpack config as follows:
That took care of the dev server, however production webpack bundling also introduced boilerplate which made use of the forbidden worklet objects, but in this case its easily configurable by specifying the following output options:
At this point we had a working worklet (pun intended) that didnt break our development environment.
WASM in audio worklets.
Next came adding in the RNnoise WASM module. Jitisi uses RNnoise compiled with emscripten (more details in the project: https://github.com/jitsi/rnnoise-wasm). With the default settings the WASM module will load and compile asynchronously, however because the worklet loads without waiting for the resolution of promises we need to make everything synchronous, so we inline the WASM file by passing in -s SINGLE_FILE=1 to emscripten and we also tell it to synchronously compile it with -s WASM_ASYNC_COMPILATION=0. With that in place everything will be loaded and ready to go when audio samples start coming in.
Efficient audio processing.
Audio processing in worklets happens on the process() callback method in the AudioWorkletProcessor implementation at a fixed rate of 128 samples (this cant be configured as with ScriptProcessorNodes), however RNnoise expects 480 samples for each call to its denoise method rnnoise_process_frame.
To make this work we implemented a circular buffer that minimizes copy operations for optimal performance. It works by having both the buffered samples and the ones that have already been denoised on the same Float32Array with a roll over policy. The full implementation can be found here.
To summarize, we keep track of how many audio samples we have buffered, once we have enough of them (480 to be precise) we send a view of that data to RNnoise where it gets denoised in-place (i.e. no additional copies are required). At this point the circular buffer has a denoised part and possibly some residue samples that didnt fit in the initial 480, which will get processed in the next iteration. The process repeats until we reach the end of the circular buffer at which point we simply start from the beginning and overwrite stale samples; we consider them stale because at this point they have already been denoised and sent.
The worklet code gets compiled as a separate .js bundle and lazy loaded as needed.
Use it in JaaS / using the iframe API
If you are a JaaS customer (or are using Jitsi Meet through the iframe API) we have added an API command to turn this on programmatically too! Check it out.
Check it out!
In Jitsi Meet this feature can be activated by simply clicking on the Noise Suppression button.
Since in this case a sound file is probably worth more than 1000 words, here is an audio sample demonstrating the denoising:
Original audio:
Denoised audio:
Your personal meetings team.
Author: Andrei Gavrilescu
Continued here:
Enhanced noise suppression in Jitsi Meet - Jitsi
- Jitsi - Business VoIP Phone Service | OnSIP [Last Updated On: April 26th, 2014] [Originally Added On: April 26th, 2014]
- Softonic - Jitsi - Download [Last Updated On: April 26th, 2014] [Originally Added On: April 26th, 2014]
- The Architecture of Open Source Applications: Jitsi [Last Updated On: April 26th, 2014] [Originally Added On: April 26th, 2014]
- Jitsi - Wikipedia, the free encyclopedia [Last Updated On: April 26th, 2014] [Originally Added On: April 26th, 2014]
- FLOSS Weekly 293: Jitsi Meet - Video [Last Updated On: May 9th, 2014] [Originally Added On: May 9th, 2014]
- Jitsi Overview: FLOSS Weekly 293 - Video [Last Updated On: May 9th, 2014] [Originally Added On: May 9th, 2014]
- NetSecDemo Secure FTP over Jitsi - Video [Last Updated On: May 9th, 2014] [Originally Added On: May 9th, 2014]
- Eliyah Moore, Barum Jiu Jitsi Vs Cahel Gonzalez, 5 Star Martial Arts - Video [Last Updated On: May 16th, 2014] [Originally Added On: May 16th, 2014]
- Jitsi (Mac) - Download - Softonic [Last Updated On: August 31st, 2014] [Originally Added On: August 31st, 2014]
- Using XMPP chat with Jitsi - Video [Last Updated On: September 12th, 2014] [Originally Added On: September 12th, 2014]
- Jitsi - SIP Softphone - Video [Last Updated On: September 12th, 2014] [Originally Added On: September 12th, 2014]
- The Luminosity of Free Software Episode 20 - Video [Last Updated On: September 13th, 2014] [Originally Added On: September 13th, 2014]
- FOSDEM 2014 - Jitsi Videobridge And Webrtc - Video [Last Updated On: September 16th, 2014] [Originally Added On: September 16th, 2014]
- Just Linux touch screen and Jitsi - Video [Last Updated On: September 16th, 2014] [Originally Added On: September 16th, 2014]
- Bitcoin and dark wallet could be used by terrorists. So what? [Last Updated On: September 24th, 2014] [Originally Added On: September 24th, 2014]
- Top messaging apps flat-out flunk EFF's security review [Last Updated On: November 5th, 2014] [Originally Added On: November 5th, 2014]
- When I say join me in a jitsi meet... - Video [Last Updated On: November 7th, 2014] [Originally Added On: November 7th, 2014]
- Jitsi Flasms Dogfooding: Using your own imperfect solutions helps improve them, - Video [Last Updated On: November 10th, 2014] [Originally Added On: November 10th, 2014]
- IETF91 chairs meeting Honolulu Jitsi Meet presentation - Video [Last Updated On: November 17th, 2014] [Originally Added On: November 17th, 2014]
- IETF91 chairs meeting Honolulu Jitsi Meet questions - Video [Last Updated On: November 17th, 2014] [Originally Added On: November 17th, 2014]
- jitsi videollamada - Video [Last Updated On: December 26th, 2014] [Originally Added On: December 26th, 2014]
- Your first OTR text chat with Jitsi - Video [Last Updated On: December 31st, 2014] [Originally Added On: December 31st, 2014]
- Skype Encrypted Alt. SIP Jitsi Combo [Last Updated On: February 7th, 2015] [Originally Added On: February 7th, 2015]
- Jitsi Wikipdia [Last Updated On: February 7th, 2015] [Originally Added On: February 7th, 2015]
- Jitsi for Mac | MacUpdate - Apple Mac OS X Software & Apps ... [Last Updated On: February 11th, 2015] [Originally Added On: February 11th, 2015]
- Nexi Unified Communication Jitsi Presentazione full - Video [Last Updated On: February 19th, 2015] [Originally Added On: February 19th, 2015]
- JITSI - Video [Last Updated On: April 8th, 2015] [Originally Added On: April 8th, 2015]
- Jitsi Configuration and Review [Last Updated On: November 21st, 2015] [Originally Added On: November 21st, 2015]
- Jitsi: A Multi-Protocol, Cross Platform Compatible Chat, Call ... [Last Updated On: November 21st, 2015] [Originally Added On: November 21st, 2015]
- Jitsi (Build 3132) - Business VoIP Phone Service | OnSIP [Last Updated On: November 21st, 2015] [Originally Added On: November 21st, 2015]
- Jitsi | Tiki Suite [Last Updated On: March 26th, 2016] [Originally Added On: March 26th, 2016]
- Jitsi - [Last Updated On: January 28th, 2017] [Originally Added On: January 28th, 2017]
- Jitsi for Mac - Download - jitsi.en.softonic.com [Last Updated On: February 5th, 2017] [Originally Added On: February 5th, 2017]
- Jitsi | Prometheism.net [Last Updated On: February 8th, 2017] [Originally Added On: February 8th, 2017]
- GitHub - jitsi/jitsi-meet: Jitsi Meet - Secure, Simple and ... [Last Updated On: February 12th, 2017] [Originally Added On: February 12th, 2017]
- Edward Snowden's New Job: Protecting Reporters From Spies - WIRED [Last Updated On: February 14th, 2017] [Originally Added On: February 14th, 2017]
- Snowden helping develop tools to protect journalists and whistleblowers - 'to make the game a little more fair' - Press Gazette [Last Updated On: February 16th, 2017] [Originally Added On: February 16th, 2017]
- Jitsi - Download [Last Updated On: February 18th, 2017] [Originally Added On: February 18th, 2017]
- Jitsi Meet - Android Apps on Google Play [Last Updated On: March 11th, 2017] [Originally Added On: March 11th, 2017]
- Jitsi for Mac OS X Secure instant messaging and VoIP [Last Updated On: March 12th, 2017] [Originally Added On: March 12th, 2017]
- How to Configure and Set-Up Jitsi - Liberty Under Attack [Last Updated On: June 6th, 2017] [Originally Added On: June 6th, 2017]
- Jitsi PediaView.com | Prometheism.net [Last Updated On: June 17th, 2017] [Originally Added On: June 17th, 2017]
- Provisioning | Jitsi | Prometheism.net [Last Updated On: June 26th, 2017] [Originally Added On: June 26th, 2017]
- Provisioning | Jitsi [Last Updated On: June 26th, 2017] [Originally Added On: June 26th, 2017]
- FAQ | Jitsi | Prometheism.net [Last Updated On: June 26th, 2017] [Originally Added On: June 26th, 2017]
- Tsirang vegetable vendors commit to selling local chillies - Kuensel, Buhutan's National Newspaper [Last Updated On: June 27th, 2017] [Originally Added On: June 27th, 2017]
- FAQ | Jitsi | Prometheism.net euvolution.com [Last Updated On: July 3rd, 2017] [Originally Added On: July 3rd, 2017]
- FAQ | Jitsi | Futurist Transhuman News Blog | Prometheism.net [Last Updated On: July 4th, 2017] [Originally Added On: July 4th, 2017]
- Jitsi Meet (advanced) Projects | Prometheism.net [Last Updated On: July 6th, 2017] [Originally Added On: July 6th, 2017]
- FAQ | Jitsi | Prometheism.net euvolution.com | Futurist [Last Updated On: July 6th, 2017] [Originally Added On: July 6th, 2017]
- Jitsi | Futurist Transhuman News Blog - prometheism.net [Last Updated On: July 14th, 2017] [Originally Added On: July 14th, 2017]
- Gladstone gold does club proud | Gladstone Observer - Gladstone Observer [Last Updated On: July 18th, 2017] [Originally Added On: July 18th, 2017]
- Jitsi softphone for Windows OnSIP Support [Last Updated On: July 26th, 2017] [Originally Added On: July 26th, 2017]
- Jitsi for Mac : Free Download : MacUpdate [Last Updated On: August 1st, 2017] [Originally Added On: August 1st, 2017]
- OpenFire Jitsi as Skype(desktop sharing) and Temviewer ... [Last Updated On: February 9th, 2018] [Originally Added On: February 9th, 2018]
- Jitsi Download - softpedia.com [Last Updated On: March 29th, 2018] [Originally Added On: March 29th, 2018]
- Jitsi Meet (advanced) Projects [Last Updated On: June 14th, 2018] [Originally Added On: June 14th, 2018]
- Jitsi (Build 3132) - OnSIP [Last Updated On: November 9th, 2018] [Originally Added On: November 9th, 2018]
- Download Jitsi 2.10.5550 - softpedia.com [Last Updated On: November 9th, 2018] [Originally Added On: November 9th, 2018]
- Jitsi Community Forum [Last Updated On: November 9th, 2018] [Originally Added On: November 9th, 2018]
- FAQ | Jitsi [Last Updated On: November 23rd, 2018] [Originally Added On: November 23rd, 2018]
- Jitsi for Windows - Secure Instant Messaging and VoIP [Last Updated On: February 12th, 2019] [Originally Added On: February 12th, 2019]
- How to Create Your Own Video Conference Server using Jitsi ... [Last Updated On: March 6th, 2019] [Originally Added On: March 6th, 2019]
- What is Jitsi? - open source video conferencing API's ... [Last Updated On: April 9th, 2019] [Originally Added On: April 9th, 2019]
- 8x8 Acquires Jitsi Video Communications Technology From ... [Last Updated On: April 15th, 2019] [Originally Added On: April 15th, 2019]
- Latest users topics - Jitsi Community Forum - developers & users [Last Updated On: April 15th, 2019] [Originally Added On: April 15th, 2019]
- Jitsi - Should I Remove It? [Last Updated On: April 20th, 2019] [Originally Added On: April 20th, 2019]
- Appear.in Vs. Jitsi: Subscription WebRTC Faces Off Against Open-Source VC - VC - VC Daily [Last Updated On: November 18th, 2019] [Originally Added On: November 18th, 2019]
- Philippines eyes fitting end to best SEA Games performance ever - Sports Interactive Network Philippines [Last Updated On: December 12th, 2019] [Originally Added On: December 12th, 2019]
- Fox Sports 1 Dials Up VCC for The Herd With Colin Cowherd - TV Technology [Last Updated On: December 21st, 2019] [Originally Added On: December 21st, 2019]
- Fox Sports 1 Utilized Video Call Center to Extend Reach of Shows Like The Herd with Colin Cowherd - Sports Video Group [Last Updated On: December 21st, 2019] [Originally Added On: December 21st, 2019]
- GoodFirms Discloses the Most Recommended Software of 2020 to Streamline the Business Work Processes - Yahoo Finance [Last Updated On: February 23rd, 2020] [Originally Added On: February 23rd, 2020]
- How The Coronavirus Is Forcing Italy To Become A Digital Country, At Last - Forbes [Last Updated On: March 16th, 2020] [Originally Added On: March 16th, 2020]
- Here's how Zoom is fixing all of those security issues - The Union Journal [Last Updated On: April 12th, 2020] [Originally Added On: April 12th, 2020]
- Five Zoom alternatives to combat social isolation with video chat - The Star Online [Last Updated On: April 12th, 2020] [Originally Added On: April 12th, 2020]
- Zoom Has Privacy Issues, Here Are Some Alternatives - CoinDesk [Last Updated On: April 12th, 2020] [Originally Added On: April 12th, 2020]
- This is Jitsi Meet, the open source video calling application that the Government uses to prepare for press conferences - Explica [Last Updated On: April 12th, 2020] [Originally Added On: April 12th, 2020]
- Zoom security: I've researched problems with video conferencing for years here's what you need to know - The Conversation UK [Last Updated On: May 3rd, 2020] [Originally Added On: May 3rd, 2020]
- Group video calls of up to 100 participants, with encryption and noise cancellation - Explica [Last Updated On: May 3rd, 2020] [Originally Added On: May 3rd, 2020]
- The best Skype alternatives for video calls on your smartphone - AndroidPIT [Last Updated On: May 3rd, 2020] [Originally Added On: May 3rd, 2020]