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先安装会失败,遇到这种情况,确认是否有一些库无法导致。假如是,解决方案: 先把这个库下载然后安装,或者切换源。
四 参考文档