added new fixed code

This commit is contained in:
2026-01-10 20:35:21 +01:00
parent 79f93e5c29
commit 8379ac8e12
6 changed files with 396 additions and 110 deletions

11
misc.py Normal file
View 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)