31 Commits

Author SHA1 Message Date
PatTheMav
49e9d49943
plugins: Update CMakeLists.txt for included plugins 2022-03-16 23:11:08 +01:00
Richard Stanway
42fc705333 obs-filters: Fix incorrect format string
Detected by PVS Studio.
2022-01-15 00:17:02 +01:00
gxalpha
ec7c49a569 obs-filters: Fix unused parameter warnings with speex disabled 2021-12-04 15:23:07 -08:00
Tommy Vercetti
232c35cc22 obs-filters: Add libSpeexDSP guard to method
`method` should be used under the same condition as they were defined. That is when both `LIBRNNOISE_ENABLED` and  `LIBSPEEXDSP_ENABLED` are defined.
2021-10-24 02:02:53 -07:00
jpark37
3d342cd1e1 obs-filters: Fix NvAFX mutex leak 2021-08-23 23:15:11 -07:00
Ryan Foster
835ac0a556 obs-filters: Correct log prefix for noise suppression filter 2021-07-31 15:32:35 -07:00
Ryan Foster
41b3913793 obs-filters: Use correct NVIDIA capitalization 2021-07-31 15:32:35 -07:00
Richard Stanway
5d54cc36a7 obs-filters: Minor NVAFX cleanup
Remove some unused variables, fix incorrect mutex initializer, fix
exporting NVAFX functions via dllexport.
2021-07-24 23:15:45 +02:00
jpark37
4d9d7b7070 obs-filters: Fix comparison type mismatch 2021-07-06 14:08:28 -07:00
Richard Stanway
c5bb1278f4 obs-filters: Test if NVAFX is supported on load
Prevents situations where the redistributable is installed and OBS
enables the RTX denoiser but it is non-functional. Changes were tested
on systems with both supported / unsupported GPUs and it adds around
10-20ms to the load time in both cases.
2021-05-28 23:14:37 -07:00
jpark37
f40eede37a obs-filters: Fix unreferenced variable warning 2021-05-08 14:12:54 -07:00
Richard Stanway
61964d519c obs-filters: Check NVAFX is enabled before using mutexes
Fixes a crash on destroy if NVAFX wasn't actually available.
2021-04-25 19:51:20 +02:00
pkv
535f4765ff obs-filters: RTX denoiser, initialize only output channels
This reduces the initialization from 8 to the actual number of output
channels.
2021-04-25 09:24:07 -07:00
Richard Stanway
64c353c019 obs-filters: Initialize NVIDIA AFX in a thread
Initializing NVAFX is slow as it has to load large models and can cause
significant impact to OBS' startup time. This moves NVAFX initialization
into a separate thread. NVAFX does not appear to be reentrant across
threads, hence a global mutex is also used to avoid reentrancy issues.

The downside of this change is that the first few seconds of audio after
adding the filter or starting OBS will not be filtered, but this is
unlikely to cause any real-world issues.
2021-04-25 09:24:07 -07:00
pkv
38d17acdbb obs-filters: Code cleanup for RTX denoiser
This minor code cleanup commit does the following:
- sets defaults intensity of RTX denoiser to max.
- adds an initialization check of nvafx.
- splits nvafx initialization from channel allocation for better
readibility of the code.
- moves the intensity update from the filter_audio process function
to the plugin update function.
- logs the error code in case nvafx returns an error when running.
(useful for devs; I haven't translated the error codes which are
available in the sdk).
2021-04-05 03:11:51 -07:00
pkv
b46e9bba85 obs-filters: Fix initialization of RTX denoiser
This fixes issue #4441.
The issue occurs when adding the noise suppression filter for the
first time. Rnnoise or speex are the default noise suppression
methods. Line 344 returns which prevents initialization and
allocation for nvafx (rtx denoiser).
With the fix, initialization of nvafx occurs when swapping methods.
2021-04-05 03:11:51 -07:00
Richard Stanway
db7daa6eaf obs-filters: Simplify NVAFX SDK path lookup 2021-03-16 20:34:15 +01:00
Richard Stanway
d8a434bcc8 obs-filters: Minor code cleanup
Remove some unused variables, fix const qualifier and remove printfs.
2021-03-16 20:34:15 +01:00
pkv
54892b27db obs-filters: Add RTX denoiser
This adds RTX denoiser filter to be used with RTX GPUs.
(from Nvidia Audio Effects SDK)
2021-03-13 12:17:11 -08:00
Kurt Kartaltepe
43da6eacd0 obs-filters/obs-outputs: Cleanup unused var warns
Fix unused variables when compiling without rnnoise
Fix unused variable warnings in GCC when using assert() in release
2020-08-23 12:09:59 -07:00
Jérémy Farnaud
7e39109a86 obs-filters: Add option to use RNNoise for noise reduction
This commit adds support to using Xiph and Mozilla RNNoise library for
noise reduction.

RNNoise is a small library using an AI approach to noise reduction
using a pre-trained model like RTX Voice. But unlike RTX Voice, it is
very tiny, use CPU instead of GPU and only use little resources.
Obviously it is not as efficient but will effectively remove background
noise. It uses more CPU than the existing libspeex-based noise
reduction but it also sounds sounds way better.

RNNoise support is added to the noise reduction effect. It can be
enabled with a checkbox in the effect configuration. RNNoise has no
settings.
2020-08-18 11:25:21 -07:00
Clayton Groeneveld
3ea354b4e4 UI, obs-plugins: Add spinbox suffixes where necessary 2019-07-18 04:03:38 -05:00
jp9000
f53df7da64 clang-format: Apply formatting
Code submissions have continually suffered from formatting
inconsistencies that constantly have to be addressed.  Using
clang-format simplifies this by making code formatting more consistent,
and allows automation of the code formatting so that maintainers can
focus more on the code itself instead of code formatting.
2019-06-23 23:49:10 -07:00
J.D. Purcell
459da1c863 obs-filters: Fix heavy distortion in Noise Suppression filter
Noise Suppression: Clamp sample values before converting to integer.
This fixes an issue where samples exceeding full scale would overflow,
resulting in heavy distortion.

Closes jp9000/obs-studio#1113
2018-01-04 20:41:01 -08:00
pkviet
bbac3280c1 libobs: Add surround sound audio support
(This commit also modifies the following modules: UI,
deps/media-playback, coreaudio-encoder, decklink, linux-alsa,
linux-pulseaudio, mac-capture, obs-ffmpeg, obs-filters, obs-libfdk,
obs-outputs, win-dshow, and win-wasapi)

Adds surround sound audio support to the core, core plugins, and user
interface.

Compatible streaming services: Twitch, FB 360 live
Compatible protocols: rtmp / mpeg-ts tcp udp
Compatible file formats: mkv mp4 ts  (others untested)
Compatible codecs: ffmpeg aac, fdk_aac, CoreAudio aac,
		   opus, vorbis, pcm (others untested).
Tested streaming servers: wowza, nginx
	 HLS, mpeg-dash : surround passthrough
Html5 players tested with live surround:
	 videojs, mediaelement, viblast (hls+dash), hls.js
Decklink: on win32, swap channels order for 5.1 7.1
         (due to different channel mapping on wav, mpeg, ffmpeg)
Audio filters: surround working.
Monitoring: surround working (win macOs linux (pulse-audio)).
VST:	 stereo plugins keep in general only the first two channels.
	 surround plugins should work (e.g. mcfx does).
OS: win, macOs, linux (alsa, pulse-audio).
Misc: larger audio bitrates unlocked to accommodate more channels
NB: mf-aac only supports mono and stereo + 5.1 on win 10
         (not implemented due to lack of usefulness)

Closes jp9000/obs-studio#968
2017-11-26 03:41:53 -08:00
Christoph Hohmann
92b216b468 obs-filters: Fix step size for noise suppression filter 2016-08-11 20:56:38 +02:00
jp9000
71dc8d6407 obs-filters: Add comments to noise suppression filter
These comments have been added to clean up the code and make it more
clear of what the code is doing.  The code felt a bit messy, and this
should help prevent the original author of the noise suppression filter
from being lost in case he decides to modify/improve the filter.
2016-07-26 05:06:26 -07:00
jp9000
6fcb5372e9 obs-filters: Remove redundant code
This variable was always being set to that value regardless a few lines
below.
2016-07-26 04:53:46 -07:00
jp9000
155ddf8996 obs-filters: Handle timestamp jumps for noise sup. filter
When buffering audio data, we don't want to buffer audio data that may
be old.  If the audio timing jumps significant and old audio data is
buffered, clear that old data.
2016-07-26 04:50:18 -07:00
jp9000
55a5664363 obs-filters: Buffer noise suppression audio data
The noise suppression filter mistakenly operated on the assumption that
input audio data would always be in 10ms segments, and would crash if
audio data was larger than that size.

Because speexdsp operates on fixed audio frame sizes only, we must
buffer audio data to fit that frame processing size.  This creates a
troublesome situation where you must buffer around that specified frame
size.

The new steps for processing are:
1. Push audio data to input circular buffer.
2. Push number of audio frames and timestamp for that audio packet to an
   'info' circular buffer.
3. Check size of input circular buffer, and while it's equal to or above
   the speexdsp frame size (10ms for minimum latency), pop from the
   input buffer to a temporary buffer (10ms frames) and process it, then
   push that temporary buffer to the output circular buffer.
4. Peek at the front of the 'info' circular buffer.
5. If the output circular buffer frame size is equal or larger than next
   expected number of frames, pop both the info and output buffer, and
   return the audio data with the expected audio frames/timestamp.
2016-07-26 04:29:50 -07:00
Simon
f3d0272f57 obs-filters: Add speexdsp-based noise suppression filter 2016-07-25 20:17:13 -07:00