音频信号处理库——librosa上手指南Python

毕设驱动,故写此文,留念。
更新时间:2020年12月22日21:24:51
在这里插入图片描述

安装-极其简单pip 搞定

pip install librosa

简单上手-加载音频librosa.load

音符识别的小栗子,可以识别音乐中的音符的起始时间

# Beat tracking example,导入函数库
import librosa
# 1. Get the file path to an included audio example
audio_path = 'D://整理资料//cd//Track01.ape'
# 2. Load the audio as a waveform `y` 加载音乐波形文件
#    Store the sampling rate as `sr`
y, sr = librosa.load(audio_path )
# 3. Run the default beat tracker 运行记录节拍的函数
tempo, beat_frames = librosa.beat.beat_track(y=y, sr=sr)
print('Estimated tempo: {:.2f} beats per minute'.format(tempo))
# 4. Convert the frame indices of beat events into timestamps 转变到时间域
beat_times = librosa.frames_to_time(beat_frames, sr=sr)

如下图所示,tempo是节拍的个数,beat_frames 是节拍的帧数 beat_times 是将帧数转化为时间
在这里插入图片描述

在这里插入图片描述

官方网站

在这里插入图片描述

点这里

  • 1
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

和你在一起^_^

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值