python librosa 实例解析
2022/5/3 22:13:08
本文主要是介绍python librosa 实例解析,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
一 概念 librosa是一个用于音乐和音频分析的python包。它提供了创建音乐信息检索系统所需的构建块。 核心函数:![](/upload/202205/03/202205032213075248.png)
import librosa print(librosa.__version__)
如运行成功,说明安装成功的。 接下来测试基本功能,提取beat:
# Beat tracking example import librosa # 1. Get the file path to an included audio example filename = librosa.example('nutcracker') # 2. Load the audio as a waveform `y` # Store the sampling rate as `sr` y, sr = librosa.load(filename) # 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) print(beat_times)
三 总结备忘 1.关于安装: 一般使用pip先安装会失败,遇到这种情况,确认是否有一些库无法导致。假如是,解决方案: 先把这个库下载然后安装,或者切换源。
四 参考文档
- Python音频信号处理库函数librosa介绍_浩浩乎@的博客-CSDN博客_librosa
- https://librosa.org/doc/main/tutorial.html
这篇关于python librosa 实例解析的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-05-08有遇到过吗?同样的规则 Excel 中 比Python 结果大
- 2024-03-30开始python成长之路
- 2024-03-29python optparse
- 2024-03-29python map 函数
- 2024-03-20invalid format specifier python
- 2024-03-18pool.map python
- 2024-03-18threads in python
- 2024-03-14python Ai 应用开发基础训练,字符串,字典,文件
- 2024-03-13id3 algorithm python
- 2024-03-13sum array elements python