如题,这个函数的结果不合逻辑,我不明白这个函数在做什么。
例如,这里有一些可重现的代码:
#load sample audio
filename = librosa.util.example_audio_file()
audio, sr = librosa.load(filename)
#get intervals which are non-silent
inter_20 = librosa.effects.split(audio, top_db=20)
inter_5 = librosa.effects.split(audio, top_db=5)
#create audio
above_20 = np.zeros(audio.shape)
above_5 = np.zeros(audio.shape)
for i in inter_20:
start,end = i
above_20[start:end]=audio[start:end]
for j in inter_5:
start,end = j
above_5[start:end]=audio[start:end]
#plot them out:
plt.figure(figsize=[15,3]) #figure 1
plt.plot(audio)
plt.plot(above_5,color='red')
plt.title('Audio above 5 dB')
plt.figure(figsize=[15,3]) #figure 2
plt.plot(audio)
plt.plot(above_20,color='red')
plt.title('Audio above 20 dB')
Run Code Online (Sandbox Code Playgroud)
你可以从这里看到:对于图 1,这是 5dB 以上的音频:

对于图 2,这是 20dB 以上的音频:

高于 20dB 的音频怎么会超过高于 5dB 的音频呢? 对我来说这没有意义。
来自文档: https: //librosa.github.io/librosa/ generated/librosa.effects.split.html
top_db:number > 0
The threshold (in decibels) **below** reference to consider as silence
Run Code Online (Sandbox Code Playgroud)
我认为 top_db:20 意味着低于 (TOP - 20dB) 的所有内容都被视为静音,而不仅仅是 20dB。
并且 TOP - 20dB 以上的会比 TOP - 5dB 多。它还可以解释你的照片。
| 归档时间: |
|
| 查看次数: |
748 次 |
| 最近记录: |