Skip to content

Commit

Permalink
feat(noise-suppression): Add noise suppression effect. (jitsi#11547)
Browse files Browse the repository at this point in the history
* add denoise effect

* denoise prototype

* improve rnnoise / add comments

* revert some unnecessary changes

* Add noise suppressor worklet

* Send notification on failure

* address code review

* additional comments

* additional comments

* update package-lock

* fix rebase changes

* update rnnoise npm package

* sort lang

* adjust webpack performance hint

* address code review

* address code review

* switch ns files to typescript

* fix null-loader version, lang sort

* fix lint

* missing import

* fix lint / address code review

* use single action for ns state

* move activation to thunk

* increase node heap

* copy noise-suppressor to deploy

* fix ts lint
  • Loading branch information
andrei-gavrilescu authored Jul 20, 2022
1 parent 9ce52b2 commit 06491e2
Show file tree
Hide file tree
Showing 26 changed files with 932 additions and 151 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ jobs:
run: $(exit $(git status --porcelain --untracked-files=no | head -255 | wc -l)) || (echo "Dirty git tree"; git diff; exit 1)
- run: npm run lint
- run: for file in lang/*.json; do npx --yes jsonlint -q $file || exit 1; done
- run: make
- env:
NODE_OPTIONS: '--max-old-space-size=4096'
run: make
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ DEPLOY_DIR = libs
LIBJITSIMEET_DIR = node_modules/lib-jitsi-meet
OLM_DIR = node_modules/@matrix-org/olm
TF_WASM_DIR = node_modules/@tensorflow/tfjs-backend-wasm/dist/
RNNOISE_WASM_DIR = node_modules/rnnoise-wasm/dist
RNNOISE_WASM_DIR = node_modules/@jitsi/rnnoise-wasm/dist
TFLITE_WASM = react/features/stream-effects/virtual-background/vendor/tflite
MEET_MODELS_DIR = react/features/stream-effects/virtual-background/vendor/models
FACE_MODELS_DIR = node_modules/@vladmandic/human-models/models
Expand Down Expand Up @@ -49,6 +49,8 @@ deploy-appbundle:
$(BUILD_DIR)/analytics-ga.min.js.map \
$(BUILD_DIR)/face-landmarks-worker.min.js \
$(BUILD_DIR)/face-landmarks-worker.min.js.map \
$(BUILD_DIR)/noise-suppressor-worklet.min.js \
$(BUILD_DIR)/noise-suppressor-worklet.min.js.map \
$(DEPLOY_DIR)
cp \
$(BUILD_DIR)/close3.min.js \
Expand Down
11 changes: 10 additions & 1 deletion conference.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ import {
submitFeedback
} from './react/features/feedback';
import { maybeSetLobbyChatMessageListener } from './react/features/lobby/actions.any';
import { setNoiseSuppressionEnabled } from './react/features/noise-suppression/actions';
import {
isModerationNotificationDisplayed,
showNotification,
Expand Down Expand Up @@ -2017,6 +2018,11 @@ export default {
}

if (this._desktopAudioStream) {
// Noise suppression doesn't work with desktop audio because we can't chain
// track effects yet, disable it first.
// We need to to wait for the effect to clear first or it might interfere with the audio mixer.
await APP.store.dispatch(setNoiseSuppressionEnabled(false));

const localAudio = getLocalJitsiAudioTrack(APP.store.getState());

// If there is a localAudio stream, mix in the desktop audio stream captured by the screen sharing
Expand Down Expand Up @@ -2590,9 +2596,12 @@ export default {

APP.UI.addListener(
UIEvents.AUDIO_DEVICE_CHANGED,
micDeviceId => {
async micDeviceId => {
const audioWasMuted = this.isLocalAudioMuted();

// Disable noise suppression if it was enabled on the previous track.
await APP.store.dispatch(setNoiseSuppressionEnabled(false));

// When the 'default' mic needs to be selected, we need to
// pass the real device id to gUM instead of 'default' in order
// to get the correct MediaStreamTrack from chrome because of the
Expand Down
7 changes: 7 additions & 0 deletions lang/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,10 @@
"newDeviceAction": "Use",
"newDeviceAudioTitle": "New audio device detected",
"newDeviceCameraTitle": "New camera detected",
"noiseSuppressionDesktopAudioDescription": "Noise suppression can't be enabled while sharing desktop audio, please disable it and try again.",
"noiseSuppressionFailedTitle": "Failed to start noise suppression",
"noiseSuppressionNoTrackDescription": "Please unmute your microphone first.",
"noiseSuppressionStereoDescription": "Stereo audio noise suppression is not currently supported.",
"oldElectronClientDescription1": "You appear to be using an old version of the Jitsi Meet client which has known security vulnerabilities. Please make sure you update to our ",
"oldElectronClientDescription2": "latest build",
"oldElectronClientDescription3": " now!",
Expand Down Expand Up @@ -1075,6 +1079,7 @@
"muteEveryoneElse": "Mute everyone else",
"muteEveryoneElsesVideoStream": "Stop everyone else's video",
"muteEveryonesVideoStream": "Stop everyone's video",
"noiseSuppression": "Noise suppression",
"participants": "Participants",
"pip": "Toggle Picture-in-Picture mode",
"privateMessage": "Send private message",
Expand Down Expand Up @@ -1115,6 +1120,7 @@
"clap": "Clap",
"closeChat": "Close chat",
"closeReactionsMenu": "Close reactions menu",
"disableNoiseSuppression": "Disable noise suppression",
"disableReactionSounds": "You can disable reaction sounds for this meeting",
"dock": "Dock in main window",
"documentClose": "Close shared document",
Expand Down Expand Up @@ -1151,6 +1157,7 @@
"noAudioSignalDialInDesc": "You can also dial-in using:",
"noAudioSignalDialInLinkDesc": "Dial-in numbers",
"noAudioSignalTitle": "There is no input coming from your mic!",
"noiseSuppression": "Noise suppression",
"noisyAudioInputDesc": "It sounds like your microphone is making noise, please consider muting or changing the device.",
"noisyAudioInputTitle": "Your microphone appears to be noisy!",
"openChat": "Open chat",
Expand Down
Loading

0 comments on commit 06491e2

Please sign in to comment.