made volume more precise

This commit is contained in:
Alexander Karpov 2024-03-08 12:59:48 +03:00
parent 5e0fafd3b7
commit 5088ab308a

View File

@ -65,7 +65,7 @@ def process_mp3_file(path: str, user_id: int) -> None:
def analyze_music_loudness(mp3_file):
y, sr = librosa.load(mp3_file, sr=None)
frame_length = int(0.5 * sr)
frame_length = int(0.1 * sr)
stft = np.abs(librosa.stft(y, n_fft=frame_length, hop_length=frame_length))
rms_energy = librosa.feature.rms(
S=stft, frame_length=frame_length, hop_length=frame_length