resample
Sample-rate conversion and channel layout, on the vendored soxr resampler.
specux.audio.resample(y, orig_sr, target_sr, quality="high")y, sr = specux.audio.load("take.wav")y16 = specux.audio.resample(y, sr, 16000)y16 = specux.audio.resample(y, sr, 16000, quality="very_high")quality selects the recipe: "quick", "low", "medium", "high"
(default), "very_high". Loading at a target rate fuses the conversion
into the decode instead: specux.audio.load("take.wav", sr=16000).
Channel layout
m = specux.audio.to_mono(y) # mean over channels, shape (frames,)s = specux.audio.to_stereo(y) # duplicate mono / pass stereo through