mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-21 12:49:06 +00:00
use numpy in waveform calculation
This commit is contained in:
@@ -57,12 +57,9 @@ def get_audio_waveform(path: Path | str, segments_count: int = 256) -> list[int]
|
|||||||
|
|
||||||
# number of decimals to use when rounding the peak value
|
# number of decimals to use when rounding the peak value
|
||||||
digits = 2
|
digits = 2
|
||||||
max_val = float(max(volumes))
|
volumes = np.round(volumes / volumes.max(), digits)
|
||||||
new_volumes = []
|
|
||||||
for x in volumes:
|
|
||||||
new_volumes.append(round(x / max_val, digits))
|
|
||||||
|
|
||||||
return new_volumes
|
return volumes
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user