home/ atoms/ nn-tilde-waveform-to-waveform

Waveform-to-waveform nn~ models have equal in_ratio and out_ratio and pass audio through uncompressed

The simplest class of nn~ model processes audio sample-synchronously: one input audio buffer produces one output audio buffer of the same length. Effects like gain, saturation, inversion, and mid/side encoding all follow this pattern. In_ratio=1 and out_ratio=1 throughout. The model can apply complex non-linear DSP using PyTorch tensors, but the I/O contract is the same as a classic audio effect: audio in, audio out, same length. This is the entry point for scripting because it requires no understanding of temporal compression, and the shape contract is trivially verified.

Examples

See scripting/effects.py: the ‘saturate’ method applies tanh(x * gain_factor) to the input tensor and returns the same shape. The ‘add’ method mixes two stereo channels. All have in_ratio=out_ratio=1.

Assessment

Implement a simple ‘ring_mod’ method body that multiplies the input by a 440 Hz sine wave using PyTorch. Verify that the output tensor has the same shape as the input.

“effects.py : Intermediate scripting example for waveform-to-waveform case.”
corpus · nn-nn-tilde-run-rave-neural-models-live-in-max-msp-and-pure · chunk 32