added new fixed code
This commit is contained in:
11
misc.py
Normal file
11
misc.py
Normal file
@@ -0,0 +1,11 @@
|
||||
import numpy as np
|
||||
import librosa
|
||||
from settings import N_FFT, HOP
|
||||
|
||||
|
||||
def audio_to_logmag(audio):
|
||||
# STFT
|
||||
stft = librosa.stft(audio, n_fft=N_FFT, hop_length=HOP)
|
||||
mag = np.abs(stft)
|
||||
logmag = np.log1p(mag) # log(1 + x) for stability
|
||||
return logmag # shape: (freq_bins, time_frames) = (513, T)
|
||||
Reference in New Issue
Block a user