As titled, the result of this function is not logical and I don't understand what the function is doing.
For example, here is some reproducible code:
#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')
you can see from here: for figure 1, which is audio above 5dB:
for figure 2, which is audio above 20dB:
How can it be that audio above 20dB is more than audio above 5dB? To me this doesn't make sense.