Python 音频分析、特征提取的开源库

2023-03-09 15:32:01 +08:00
 829939

https://github.com/libAudioFlux/audioFlux

一个用于音频和音乐分析、特征提取的库,支持数十种时频分析变换方法,以及相应时域、频域数百种特征组合,可以提供给深度学习网络进行训练,用于研究音频领域的分类、分离、音乐信息检索(MIR)、ASR 等各种任务。

  1. 系统、多维度的提取特征和组合,可以灵活的用于各种任务研究分析。
  2. 性能高效,核心大部分 C 实现,基于不同平台 FFT 硬件加速,方便大规模数据特征提取。
  3. 支持移动端,满足移动端音频流实时计算。

快速上手

pip install audioflux

import numpy as np
import audioflux as af

import matplotlib.pyplot as plt
from audioflux.display import fill_spec

# Get a 220Hz's audio file path
sample_path = af.utils.sample_path('220')

# Read audio data and sample rate
audio_arr, sr = af.read(sample_path)

# Extract mel spectrogram
spec_arr, mel_fre_band_arr = af.mel_spectrogram(audio_arr, num=128, radix2_exp=12, samplate=sr)
spec_arr = np.abs(spec_arr)

# Extract mfcc
mfcc_arr, _ = af.mfcc(audio_arr, cc_num=13, mel_num=128, radix2_exp=12, samplate=sr)

# Display
audio_len = audio_arr.shape[0]
# calculate x/y-coords
x_coords = np.linspace(0, audio_len / sr, spec_arr.shape[1] + 1)
y_coords = np.insert(mel_fre_band_arr, 0, 0)
fig, ax = plt.subplots()
img = fill_spec(spec_arr, axes=ax,
                x_coords=x_coords, y_coords=y_coords,
                x_axis='time', y_axis='log',
                title='Mel Spectrogram')
fig.colorbar(img, ax=ax)

fig, ax = plt.subplots()
img = fill_spec(mfcc_arr, axes=ax,
                x_coords=x_coords, x_axis='time',
                title='MFCC')
fig.colorbar(img, ax=ax)

plt.show()

感兴趣的请给个 Star

https://github.com/libAudioFlux/audioFlux

更多实例

https://github.com/libAudioFlux/audioFlux#other-examples

1628 次点击
所在节点    Python
8 条回复
CMLab
2023-03-09 15:41:29 +08:00
复制了一下代码,ipython 运行,确实出效果
smallsung
2023-03-09 16:47:55 +08:00
看起来是跨平台的 好评
tigerstudent
2023-03-09 17:13:28 +08:00
想知道做 ASR 之前,怎么过滤周围的一些杂音,比如说周围人的小声说话声、广播声、喧哗声
CMLab
2023-03-09 17:19:03 +08:00
@tigerstudent 看具体音源和业务情况,这些噪声是低频信号还是高频信号或者有明显特征的频域分布,这样才能有针对性处理,针对 ASR 而言,最简单的方式就是过一下高通滤波器
CMLab
2023-03-09 17:24:08 +08:00
@tigerstudent 如果业务要求较高的效果,可以用深度学习方式,针对噪声相关业务数据标注后,走频谱的 mask 的训练
kevinlq
2023-03-09 22:01:18 +08:00
已 star, 正对对这方面感兴趣,深入学习下
zephyr1
2023-03-10 08:49:14 +08:00
学习
jememouse
2023-04-15 20:13:04 +08:00
不错,最近正在找相关的资料

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/922594

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX