python中基于谱门的噪声抑制

noisereduce的Python项目详细描述


Build StatusCoverage StatusBinderPyPI versionDOI

在python中使用谱门降低噪声

  • 该算法基于降噪效果的outlined by Audacity(但不是完全再现)算法Link to C++ code
  • 该算法需要两个输入:
    1. anoise包含音频剪辑原始噪声的音频剪辑
    2. 一个signal音频剪辑,包含要删除的信号和噪声

算法步骤

  1. 通过噪声音频剪辑计算fft
  2. 通过对噪声(频率)的fft计算统计值
  3. 根据噪声的统计信息(以及算法的期望灵敏度)计算阈值
  4. 在信号上计算fft
  5. 通过将信号fft与阈值进行比较来确定掩模
  6. 在频率和时间上使用滤波器平滑掩模
  7. 掩模被应用于信号的fft,并被反转

安装

pip install noisereduce

noisereduce可以选择使用tensorflow作为后端来加速fft和高斯卷积。它没有列在requirements.txt中,因为(1)它是可选的,(2)tensorflow gpu和tensorflow(cpu)都与这个包兼容。该包要求TensorFlow 2+用于所有TensorFlow操作。

用法

(请参阅笔记本)

import noisereduce as nr
# load data
rate, data = wavfile.read("mywav.wav")
# select section of data that is noise
noisy_part = data[10000:15000]
# perform noise reduction
reduced_noise = nr.reduce_noise(audio_clip=data, noise_clip=noisy_part, verbose=True)

noise_reduce

的参数
n_grad_freq (int): how many frequency channels to smooth over with the mask.
n_grad_time (int): how many time channels to smooth over with the mask.
n_fft (int): number audio of frames between STFT columns.
win_length (int): Each frame of audio is windowed by `window()`. The window will be of length `win_length` and then padded with zeros to match `n_fft`..
hop_length (int):number audio of frames between STFT columns.
n_std_thresh (int): how many standard deviations louder than the mean dB of the noise (at each frequency level) to be considered signal
prop_decrease (float): To what extent should you decrease noise (1 = all, 0 = none)
pad_clipping (bool): Pad the signals with zeros to ensure that the reconstructed data is equal length to the data
        use_tensorflow (bool): Use tensorflow as a backend for convolution and fft to speed up computation
verbose (bool): Whether to plot the steps of the algorithm


<;small>;基于cookiecutter data science project template的项目。#CookieCutterDatascience<;/小>;

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java支持servlet和JSP的使用   java计算模式   Windows上的python PySpark安装异常:Java网关进程在发送其端口号之前退出   java如何解决类中的“Android错误”方法setSupportActionBar?   java JTable为什么单元格颜色不起作用   通过运行时注入实现Java多态性   在Glassfish上使用@EJB注释和Maven的java应用程序客户端   bufferstrategy在java中使用createBufferStrategy()时,拥有2个以上的缓冲区是否有帮助?有什么坏处吗?   用java格式化字符串   带有mvn devserver的Google App Engine Java失败:缺少“guestbook/target/guestbook1.0SNAPSHOT”   java如何测量刚刚收到的UDP数据包大小?   java调用在运行时确定类的泛型方法   java Spring Boot 2.2.4禁用安全性   在java中,如何将文件(通过URL寻址)读入字符串?