使用 librosa 提取节拍时间戳处的振幅

问题描述 投票:0回答:1

我有一个音频文件 (.wav),并且我有该音频的节拍注释。

例如。

beats_timestamps = [1.22,2.22,3.33,4.44,5.55]
# 虚拟示例

这些值是指歌曲/音频中出现节拍的时间(以秒为单位)。

还有, 我已经使用

加载了音频文件

audio_signal, sample_rate = librosa.load(file_path, sr=None, duration=60)
# 60 秒的音频。

我的要求是提取这些beats_timestamps处的幅度/信号强度..

我目前正在使用

beats_to_samples = librosa.time_to_samples(beats, sr=sample_rate)
beat_samples_to_frames = librosa.samples_to_frames(beats_to_samples )
signal_strength_at_beats_timestamps = audio_signal[beat_samples_to_frames]

我不确定这是否是在这些单独的节拍时间戳处提取信号/强度的正确方法。这是正确的方法还是有一种方法可以验证其是否正确?

python data-science librosa
1个回答
0
投票

单个音频样本并不能很好地衡量“信号强度”。更好的选择是声级,例如通过 librosa.feature.rms 计算。您可以设置一个frame_length(以样本为单位)以对应例如10毫秒。

© www.soinside.com 2019 - 2024. All rights reserved.