diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-10-12 17:15:33 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-10-12 17:15:33 +0200 |
| commit | 3fbc92d236e243ad23b0bba8aa7399ea2384b1cd (patch) | |
| tree | 2b9acf547393bd29e83e3eab2c0cfc576c7b629b /animism-align/cli/commands/peaks/parse.py | |
| parent | fee9c2fccc2a059d8307c789c110e38f3c3727df (diff) | |
hopefully fixing seek issues not already fixed by CBR
Diffstat (limited to 'animism-align/cli/commands/peaks/parse.py')
| -rw-r--r-- | animism-align/cli/commands/peaks/parse.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/animism-align/cli/commands/peaks/parse.py b/animism-align/cli/commands/peaks/parse.py index f5b36a4..da183f4 100644 --- a/animism-align/cli/commands/peaks/parse.py +++ b/animism-align/cli/commands/peaks/parse.py @@ -26,14 +26,15 @@ def cli(ctx, fp_in): print(f"Loading {fp_in}") y, sr = librosa.load(fp_in, sr=None) - sr_10 = math.ceil(sr / 10) + sr_10 = sr / 10 steps = math.ceil(y.shape[0] / sr_10) peaks = numpy.ndarray(steps) for i in range(steps): - offset = i * sr_10 - slice = y[offset:offset + sr_10] + offset_start = math.floor(i * sr_10) + offset_end = math.ceil((i + 1) * sr_10) + slice = y[offset_start:offset_end] peak = max(abs(slice.min()), slice.max()) peaks[i] = float('%.3f' % peak) # peaks[i * 2 + 1] = float('%.3f' % slice.max()) |
