File size: 327 Bytes
0f06115
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
from speechbrain.pretrained import SpectralMaskEnhancement
import torchaudio

model = SpectralMaskEnhancement.from_hparams(source="speechbrain/metricgan-plus-voicebank")

def remove_noise(input_path, output_path):
    enhanced = model.enhance_file(input_path)
    torchaudio.save(output_path, enhanced[0], enhanced[1])