nn~ can output audio-analysis features as control-rate signals by using a large out_ratio
By setting out_ratio equal to the STFT hop size, a nn~ method produces one feature value per analysis frame — a control-rate signal rather than audio. The features.py scripting example demonstrates this for spectral centroid, flatness, and bandwidth, all derived from a running STFT. The model maintains an audio_buffer (registered as a PyTorch buffer) to handle frame overlap across nn~ buffer boundaries, ensuring continuity. Feature outputs are single-channel control signals that can drive visual mappings, filters, or generative parameters in the same Max/Pd patch alongside the audio processing.
Examples
The ‘centroid’ method in features.py uses out_ratio=hop_size (256): for a 4096-sample buffer, it outputs 16 spectral centroid values. Wire this outlet to a curve~ or jit.matrix to drive a visual parameter.
Assessment
Describe what out_ratio=256 means in terms of the relationship between input audio samples and output feature values. Explain why a running buffer is needed inside the model to compute STFT features correctly across buffer boundaries.