How to Remove Background Sound in Real-Time for Linux | Hacker Noon

June 3rd 2020

Author profile picture

Avoid 30 minutes of can you hear me

Video conferences are an important part of our lives especially as a remote developer, even more in this days

When we join into a video conference we always check the camera but rarely check the audio

Most of the laptops already have good cameras and for desktops is cheap to get a nice quality camera, but at the end the video is only our presentation card but the message is at the end the most important thing in a video conference and.

The message is not in the video, is in the audio

The problem

Aside the microphone quality witch is actually acceptable in most of cases we have another enemy

The noise

And here is the issue, our brains actively removes the constant noise and we can not hear it but the microphones can and will transmit the same exact audio waves as are received.

Some apps like zoom have basic noise reduction systems, however, is not the case on all of the video conferencing applications like google hangouts 

The noise cancellation work usually are done in post-production once the audio is recorded, and it is better to give better quality

This is why we will check how to make our microphone sound like a studio 

And make the life easier to your partners and coworkers

To achieve that we will use a plugin named Reafir from Reaper for noise cancellation in real-time

There are many programs that can run audio plugins but in this case, we will focus on the original one Reaper witch is the easiest way

So let’s go ahead

Step 1: Install Reaper 

REAPER is a complete digital audio production application for computers, offering a full multitrack audio and MIDI recording, editing, processing, mixing, and mastering tool set.

The software has a cost of $60 however they offer an infinite evaluation license (just like winrar) for personal use

You can download it in here and run the installation file

Step 2: Installing Jack server

Reaper for Linux doesn’t work with the ALSA audio service so we need to install and setup the jack server

JACK Audio Connection Kit is a low latency sound server that can connect apps through the API 

I recommend to use the Gui for the jack server qjackctl is easy to use and really easy to set up.

Can be installed with this command

apt install qjackctl

Run it and we will see this interface

Once installed we need to setup our audio input interface by clicking in setup

And select our microphone audio interface

Now we need to install some jack utilities before running the server

sudo apt install libasound2-plugins
sudo apt install pulseaudio

And now we can just click on “play” to run the jack server  and we will be able to run Reaper

Step 3: Configure reaper

Noting will happen because we need to setup the audio interfaces by clicking on actions > preferences 

We need to select Jack in the audio system option and apply

Now reaper is able to hear us but we still need to create a new track we can do it with

ctrl + t

And the track will appear here, now we only need to enable it by clicking the red circle to arm the track and we will see the mic levels

Step 4: Enable Reafir

Reafir is an FFT based plugin that allows us to eliminate the background noise in our recordings by subtracting the prerecorded sound from the recording, to enable it we need to click on FX in the track 

Search for reafir (you can use the filter) and click on Ok

We will see the background noise, and this is the noise that we want to remove

Now we need to select in mode subtract, there are many options to enable a noise gate or to cut all the frequencies in a certain range witch is better for best quality results if you already have a record and time to work on, however for real-time the subtract option is better 

And we will need to create a noise profile, this is the noise that will be substracted from the audio record 

We can do it by clicking in the checkbox, wait a few (5-7) seconds and then click again to stop it 

So far we have the reafir plugin enable and we are able to record crystal clear audio but this is not our final goal, we want it for videoconferences

Now we need to save the project and close reaper for now

Step 4: Setup the Jack to ALSA bridge

So the next thing we need to do is to take the audio output from reaper and bring it back to the system but we have one last problem, the video conferencing apps only work with ALSA (Advanced Linux Sound Architecture ) the high-level audio system

So we will need to create a virtual interface to get the sound from the reaper output and send it back to the system as an input device.

In order to do that we will need to execute a system file .asoundrc, we can use any text editor we want 

by running the next command in this case with nano

nano ~/.asoundrc

And we need to add the following lines

save it and restart the system

Step 5: Run it

Now we will need to connect the audio interfaces

Open QjackCtl

Click on start

Open the previous reaper project 

Edit the connections in the QjackCtl patch-bay

Here we will see the audio input system, reaper, and our virtual interface, click on disconnect everything and do the connections manually drag and drop the input system to reaper and the input reaper to the output jack

Step 6: Use it

And we are done now we can go to our video conferencing software and select the pulse audio jack Sink as the main input to get the filtered audio.

Nice videoconferencing



The Noonification banner

Subscribe to get your daily round-up of top tech stories!

read original article here