[Fons Adriaensen]
>On Sun, Jun 14, 2026 at 01:04:16PM +0200, 
>[email protected] wrote:
>
>> To make the plugin operate at any framebuffer without having to retrain
>> the model for different buffersizes the idea is just to buffer the
>> audio in an internal 256 sample buffer, should the host buffersize be
>> smaller than 256,
>
>Will work, but introduce an uneven CPU load. For example if the 
>host size is 128 samples, most of the algorithm will run only
>in every second period. Thus peak CPU load (which is what matters)
>will appear to double.

alternatively, perhaps one might run the model in every audio cycle in
overlapping mode (first cycle[s] would be on zero-padded signal data),
gaining extra temporal resolution in detection and possibly smoother
results in exchange for a higher but consistent computing load
(basically windowed overlap-add).

>> The question is how should I handle samplerates other than 48khz?
>> I could implement simple interpolation schemes for samplerates lower
>> than 48khz and subsampling for higher samplerates. What are the
>> potholes? Are there libraries out there that can do this in real time
>> in the audio thread?
>
>Zita-resampler can easily do this in real time. Simpler solutions are
>possible, with some loss of quality.

there's a simplistic but fast 2x/4x realtime oversampler in caps* that
i wrote in c++ for handling 96 and 192kHz sample rates with a filter
designed for 48k (44.1 and multiples not covered though) -- not a
library but should be relatively easy to rip out if one is versed in
old-style oo c++.  zita-resampler certainly provides better
antialiasing though, and less programming headache :)

the filter is a guitar cabinet emulation so it's not critically
sensitive towards high frequency content, but then i'd imagine the
pitch detection model might have been trained on low-passed input
anyway?

come to think of it, how well might running the unchanged model on
44.1 data and then simply shifting the output pitches by the 441/480
ratio work?  it's not that far off, though i do not know how dependent
the model is on particular formants/resonances in the training data.

* https://quitte.de/dsp/caps.html -- CabinetIV, GPLv3

Reply via email to