%load_ext autoreload
%autoreload 2
#%env CUDA_VISIBLE_DEVICES=3
colab_requirements = [
"pip install librosa",
"pip install noisereduce",
"pip install soundfile",
]
import sys, subprocess
def run_subprocess_command(cmd):
# run the command
process = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)
# print the output
for line in process.stdout:
print(line.decode().strip())
IN_COLAB = "google.colab" in sys.modules
if IN_COLAB:
for i in colab_requirements:
run_subprocess_command(i)
import torch
from noisereduce.torchgate import TorchGate as TG
device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
# Create TorchGating instance
tg = TG(sr=8000, nonstationary=True).to(device)
# Apply Spectral Gate to noisy speech signal
noisy_speech = torch.randn(3, 32000, device=device)
enhanced_speech = tg(noisy_speech)
C:\Users\zorea\.conda\envs\ml\lib\site-packages\noisereduce-3.0.0-py3.10.egg\noisereduce\torchgate\torchgate.py:180: UserWarning: Using padding='same' with even kernel lengths and odd dilation may require a zero-padded copy of the input be created (Triggered internally at C:\cb\pytorch_1000000000000\work\aten\src\ATen\native\Convolution.cpp:1004.)