- commit
- 587c39cf80b69da0c4d0957bf73d3b1f8ce7f842
- parent
- 77da25e37fae738171baca6acafce9aea48ab051
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2025-07-28 11:26
perf: use multiprocessing to analyze timbre
Diffstat
| M | player.py | 4 | +++- |
1 files changed, 3 insertions, 1 deletions
diff --git a/player.py b/player.py
@@ -6,6 +6,7 @@ import pickle 6 6 import random 7 7 import shutil 8 8 from pathlib import Path -1 9 from multiprocessing import Pool 9 10 10 11 import librosa 11 12 import numpy @@ -56,7 +57,8 @@ def timbre(y): 56 57 57 58 58 59 def analyze(buffers):59 -1 timbres = numpy.array([timbre(buf) for buf in buffers]).T-1 60 with Pool() as p: -1 61 timbres = numpy.array(p.map(timbre, buffers)).T 60 62 return librosa.segment.recurrence_matrix(timbres, width=4, mode='affinity') 61 63 62 64