Lesson 4 of 6 · 2 min
Use real files
# run locally: load.py
import subprocess, numpy as np
def load(path, rate=8000):
raw = subprocess.run(["ffmpeg", "-loglevel", "error", "-i", path, "-ac", "1", "-ar", str(rate), "-f", "s16le", "-"], capture_output=True, check=True).stdout
return np.frombuffer(raw, np.int16).astype(np.float32) / 32768Store hashes in SQLite with an index on the hash column once memory runs out.
