home/ atoms/ nn-tilde-in-out-ratio

in_ratio and out_ratio in nn~ method registration define the temporal compression between audio and model outputs

When registering a method with nn_tilde.Module, in_ratio and out_ratio specify how many input/output audio samples correspond to a single model input/output frame. A ratio of 1 means sample-synchronous (one sample in, one sample out). A ratio of 1024 means the model produces one output value per 1024 input samples — suitable for feature extraction where you want a slow control signal, not audio. The out_ratio divides the buffer size to determine the output length: if buffer_size=8192 and out_ratio=1024, the output has 8 values. This ratio system is how the same API handles both audio-rate processing and control-rate features without separate mechanisms.

Examples

‘rms’ method: in_ratio=1, out_ratio=1024 — produces one RMS float per 1024 samples. ‘forward’ on RAVE: in_ratio=1, out_ratio=1 — sample-synchronous timbre transfer. ‘centroid’ in features.py uses out_ratio=hop_size (256) so output is at the STFT analysis rate.

Assessment

A method has in_ratio=1 and out_ratio=512 with a 4096-sample buffer. How many output samples does it produce per buffer? What type of signal is it appropriate for — audio or control? Explain why.

“in_ratio: temporal compression ratio of the input tensor in_channels: number of channels of the output tensor in_ratio: temporal compression ratio of the output tensor”
corpus · nn-nn-tilde-run-rave-neural-models-live-in-max-msp-and-pure · chunk 21