videosdk-plugins-rnnoise 0.0.31__py3-none-any.whl → 0.0.32__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of videosdk-plugins-rnnoise might be problematic. Click here for more details.
- videosdk/plugins/rnnoise/denoise.py +20 -10
- videosdk/plugins/rnnoise/version.py +1 -1
- {videosdk_plugins_rnnoise-0.0.31.dist-info → videosdk_plugins_rnnoise-0.0.32.dist-info}/METADATA +2 -2
- {videosdk_plugins_rnnoise-0.0.31.dist-info → videosdk_plugins_rnnoise-0.0.32.dist-info}/RECORD +5 -5
- {videosdk_plugins_rnnoise-0.0.31.dist-info → videosdk_plugins_rnnoise-0.0.32.dist-info}/WHEEL +0 -0
|
@@ -4,12 +4,15 @@ from .rnnoise import RNN
|
|
|
4
4
|
import numpy as np
|
|
5
5
|
import resampy
|
|
6
6
|
|
|
7
|
+
|
|
7
8
|
class RNNoise(Denoise):
|
|
8
9
|
def __init__(self):
|
|
10
|
+
"""Initialize the RNNoise denoise plugin.
|
|
11
|
+
"""
|
|
9
12
|
super().__init__()
|
|
10
13
|
self.rnnoise = RNN()
|
|
11
14
|
self._target_sample_rate = 48000
|
|
12
|
-
self._frame_duration_ms = 20
|
|
15
|
+
self._frame_duration_ms = 20
|
|
13
16
|
self._rnnoise_frame_size = 480
|
|
14
17
|
|
|
15
18
|
async def denoise(self, audio_frames: bytes, **kwargs: Any) -> bytes:
|
|
@@ -18,29 +21,35 @@ class RNNoise(Denoise):
|
|
|
18
21
|
|
|
19
22
|
audio_np = np.frombuffer(audio_frames, dtype=np.int16)
|
|
20
23
|
num_samples = len(audio_np)
|
|
21
|
-
original_sample_rate = int(
|
|
24
|
+
original_sample_rate = int(
|
|
25
|
+
num_samples * 1000 / self._frame_duration_ms)
|
|
22
26
|
|
|
23
27
|
if original_sample_rate != self._target_sample_rate:
|
|
24
28
|
audio_float = audio_np.astype(np.float32) / 32767.0
|
|
25
|
-
resampled_audio_float = resampy.resample(
|
|
26
|
-
|
|
29
|
+
resampled_audio_float = resampy.resample(
|
|
30
|
+
audio_float, sr_orig=original_sample_rate, sr_new=self._target_sample_rate)
|
|
31
|
+
resampled_audio_np = (resampled_audio_float *
|
|
32
|
+
32767.0).astype(np.int16)
|
|
27
33
|
else:
|
|
28
34
|
resampled_audio_np = audio_np
|
|
29
35
|
|
|
30
|
-
num_rnnoise_frames = len(
|
|
36
|
+
num_rnnoise_frames = len(
|
|
37
|
+
resampled_audio_np) // self._rnnoise_frame_size
|
|
31
38
|
denoised_chunks = []
|
|
32
39
|
|
|
33
40
|
for i in range(num_rnnoise_frames):
|
|
34
41
|
start = i * self._rnnoise_frame_size
|
|
35
42
|
end = start + self._rnnoise_frame_size
|
|
36
43
|
chunk = resampled_audio_np[start:end]
|
|
37
|
-
|
|
44
|
+
|
|
38
45
|
if len(chunk) != self._rnnoise_frame_size:
|
|
39
46
|
continue
|
|
40
47
|
|
|
41
48
|
chunk_bytes = chunk.tobytes()
|
|
42
|
-
_vod_prob, denoised_chunk_bytes = self.rnnoise.process_frame(
|
|
43
|
-
|
|
49
|
+
_vod_prob, denoised_chunk_bytes = self.rnnoise.process_frame(
|
|
50
|
+
chunk_bytes)
|
|
51
|
+
denoised_chunk_np = np.frombuffer(
|
|
52
|
+
denoised_chunk_bytes, dtype=np.int16)
|
|
44
53
|
denoised_chunks.append(denoised_chunk_np)
|
|
45
54
|
|
|
46
55
|
if not denoised_chunks:
|
|
@@ -50,7 +59,8 @@ class RNNoise(Denoise):
|
|
|
50
59
|
|
|
51
60
|
if original_sample_rate != self._target_sample_rate:
|
|
52
61
|
denoised_float = denoised_audio_np.astype(np.float32) / 32767.0
|
|
53
|
-
original_format_float = resampy.resample(
|
|
62
|
+
original_format_float = resampy.resample(
|
|
63
|
+
denoised_float, sr_orig=self._target_sample_rate, sr_new=original_sample_rate)
|
|
54
64
|
final_audio_np = (original_format_float * 32767.0).astype(np.int16)
|
|
55
65
|
else:
|
|
56
66
|
final_audio_np = denoised_audio_np
|
|
@@ -59,4 +69,4 @@ class RNNoise(Denoise):
|
|
|
59
69
|
|
|
60
70
|
async def aclose(self) -> None:
|
|
61
71
|
self.rnnoise.destroy()
|
|
62
|
-
await super().aclose()
|
|
72
|
+
await super().aclose()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.0.
|
|
1
|
+
__version__ = "0.0.32"
|
{videosdk_plugins_rnnoise-0.0.31.dist-info → videosdk_plugins_rnnoise-0.0.32.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: videosdk-plugins-rnnoise
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.32
|
|
4
4
|
Summary: VideoSDK Agent Framework plugin for RNNoise.
|
|
5
5
|
Author: videosdk
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -14,7 +14,7 @@ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
|
14
14
|
Requires-Python: >=3.11
|
|
15
15
|
Requires-Dist: numpy>=1.27
|
|
16
16
|
Requires-Dist: resampy
|
|
17
|
-
Requires-Dist: videosdk-agents>=0.0.
|
|
17
|
+
Requires-Dist: videosdk-agents>=0.0.32
|
|
18
18
|
Description-Content-Type: text/markdown
|
|
19
19
|
|
|
20
20
|
# VideoSDK RNNoise Plugin
|
{videosdk_plugins_rnnoise-0.0.31.dist-info → videosdk_plugins_rnnoise-0.0.32.dist-info}/RECORD
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
videosdk/plugins/rnnoise/__init__.py,sha256=W1ioncb06WtjaxKXUuhQMsr6JHZmNTPeUOXqnRkQiuw,51
|
|
2
2
|
videosdk/plugins/rnnoise/build_rnnoise.py,sha256=2vJDXgS3rl5w98e6XmxhMrSzvBgoYcAf03f4G_iZD98,3480
|
|
3
|
-
videosdk/plugins/rnnoise/denoise.py,sha256=
|
|
3
|
+
videosdk/plugins/rnnoise/denoise.py,sha256=Ait9K-rY4GLNRz2uz71O8WQaqqvBjSLVuqoOiRdbjjk,2564
|
|
4
4
|
videosdk/plugins/rnnoise/rnnoise.py,sha256=HJ5qx8ZFfM0TW_zeioOPoAOqDKcdB0BxCgh0MzS214Y,1359
|
|
5
|
-
videosdk/plugins/rnnoise/version.py,sha256=
|
|
5
|
+
videosdk/plugins/rnnoise/version.py,sha256=WKDnjJM7gYpD9fIwhK2qAZICJAT2ndquQ6VcOar074Y,23
|
|
6
6
|
videosdk/plugins/rnnoise/files/librnnoise.0.dylib,sha256=4nvKWEolh1ZfHeIeteAv0PA3bJEf8OH_dKAQNbsRtQ8,3659392
|
|
7
7
|
videosdk/plugins/rnnoise/files/librnnoise.dylib,sha256=4nvKWEolh1ZfHeIeteAv0PA3bJEf8OH_dKAQNbsRtQ8,3659392
|
|
8
|
-
videosdk_plugins_rnnoise-0.0.
|
|
9
|
-
videosdk_plugins_rnnoise-0.0.
|
|
10
|
-
videosdk_plugins_rnnoise-0.0.
|
|
8
|
+
videosdk_plugins_rnnoise-0.0.32.dist-info/METADATA,sha256=TgvwbPhayKmX_zW6T-yGT9m2Ygqh1956PRn1a68b_OU,1192
|
|
9
|
+
videosdk_plugins_rnnoise-0.0.32.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
10
|
+
videosdk_plugins_rnnoise-0.0.32.dist-info/RECORD,,
|
{videosdk_plugins_rnnoise-0.0.31.dist-info → videosdk_plugins_rnnoise-0.0.32.dist-info}/WHEEL
RENAMED
|
File without changes
|