# Size of our frame is 552 samples
frame_len = 552
# Size of the overlap is 221 samples
frame_hop = 221
# Slices data array into overlapping frames without previously defined variables
frames = librosa.util.frame(y,
frame_length=frame_len,
hop_length=frame_hop)
# Computing average loudness in frame.
# summing the square of our frame and dividing by frame length
# Squaring the Signal positive and negative don't cancel each other out.
energy = np.sum(frames**2, axis=0) / frame_len
# Convert to decibels and add a tiny (1e-10) constant to avoid log(0) errors
# Since the above calculates power we multiply by 10 (not 20 as would be the case for Amplitude) [1]
# To obtain the average decibel power of our frame
energy_db = 10 * np.log10(energy + 1e-10)
# Comparing the loudest frame energy_db.max() to other frames
# anything not louder than energy_db.max() - 40db, is cut off
# We return a Boolean Array
vad_mask = energy_db > (energy_db.max() - 40)
< /code>
Das Problem, auf das ich gehe, ist, dass ich die Überlappung halte, wenn ich nur naiv filtere und abflach, ich halte. (Effektiv klingt das so, als würde ich die Frequenz senken) < /p>
# We select only the vad_mask frames
speech_frames = frames[:, vad_mask]
# Transpose and flatten the frames to yield one continious signal
y_vad = speech_frames.T.reshape(-1)
Ich könnte einfach die vorhergehenden und nachfolgenden 221 Proben aus jedem Frame entfernen, aber ich frage mich, ob es eine Librosa -Funktion gibt, die mir hilft.
Hallo, ich habe einen sehr einfachen VAD -Filter mit Librosa erstellt. < /p> [code]# Size of our frame is 552 samples frame_len = 552 # Size of the overlap is 221 samples frame_hop = 221
# Slices data array into overlapping frames without previously defined variables frames = librosa.util.frame(y, frame_length=frame_len, hop_length=frame_hop)
# Computing average loudness in frame. # summing the square of our frame and dividing by frame length # Squaring the Signal positive and negative don't cancel each other out. energy = np.sum(frames**2, axis=0) / frame_len
# Convert to decibels and add a tiny (1e-10) constant to avoid log(0) errors # Since the above calculates power we multiply by 10 (not 20 as would be the case for Amplitude) [1] # To obtain the average decibel power of our frame energy_db = 10 * np.log10(energy + 1e-10)
# Comparing the loudest frame energy_db.max() to other frames # anything not louder than energy_db.max() - 40db, is cut off # We return a Boolean Array vad_mask = energy_db > (energy_db.max() - 40)
< /code> Das Problem, auf das ich gehe, ist, dass ich die Überlappung halte, wenn ich nur naiv filtere und abflach, ich halte. (Effektiv klingt das so, als würde ich die Frequenz senken) < /p> # We select only the vad_mask frames speech_frames = frames[:, vad_mask] # Transpose and flatten the frames to yield one continious signal y_vad = speech_frames.T.reshape(-1) [/code] Ich könnte einfach die vorhergehenden und nachfolgenden 221 Proben aus jedem Frame entfernen, aber ich frage mich, ob es eine Librosa -Funktion gibt, die mir hilft.
Ich habe ein Bild gegeben, das ein Bild in diesem Beitrag geliefert habe, und wie Sie sehen können, dass ein Kasten geschrieben wurde. i scrolled down but after applying overflow:scroll to the...
Ich habe ein Bild gegeben, das ein Bild in diesem Beitrag geliefert habe, und wie Sie sehen können, dass ein Kasten geschrieben wurde. i scrolled down but after applying overflow:scroll to the...
Ich versuche, Librosa in eine Sagemaker -Notebook -Instanz zu importieren, aber es sagt mir, dass die SNDFile -Bibliothek nicht gefunden wird. Ich habe versucht, Conda install -c Conda -forge...
Ich versuche, die dp-Methode zu verwenden, um die beste Lösung zu finden. Der beste Code unten funktioniert nicht.
def max_reward_schedule(rewards, task_durations):
n = len(rewards)
m = len...