server: update to have 0-128 range, feedback from jose

This commit is contained in:
2023-08-24 09:00:16 +02:00
committed by Mathieu Virbel
parent 621ae7d681
commit 9dcac97efb

View File

@@ -56,8 +56,8 @@ def get_audio_waveform(path: Path | str, segments_count: int = 256) -> list[int]
volumes = volumes[:current_chunk_idx] volumes = volumes[:current_chunk_idx]
# normalize the volumes 0-2**8 # normalize the volumes 0-128
volumes = volumes * (2**8 - 1) / volumes.max() volumes = volumes * 128 / volumes.max()
return volumes.astype("uint8").tolist() return volumes.astype("uint8").tolist()