# Nonlinear Propagation/Convection In Nyquist

Is it possible to simulate nonlinear propagation in Nyquist?
I’m wanting to run the “track” through nonlinear propagation.

It square wave is affected like so: https://www.thevisualroom.com/_images/non_linear_convection-1_01_00.png

Any help is appreciated!

i don’t know what the colors represent…

I’ve never used Nyquist but it should be able to ANYTHING you can express mathematically. (Just as long as it can be done in the digital domain. i.e. With quantized data.)

You can skew a square wave with an [u]All-pass filter[/u]. That changes the wave shape without changing the sound… Without changing the frequency domain components.

The colors represent the intensity of the nonlinearity.
The skew actually changes the sound, adding harmonics making it sound almost like a sawtooth.

Assuming that you only need to process a short bit of mono audio, probably the easiest way to do this sort of thing is to copy the sound data into an array, manipulate the array in whatever way you want, then convert the array back into a sound.

If the selection is more than a few hundred thousand samples, this code will probably crash, but it’s a good solution for short selections:

``````;type process

(setf ln (truncate len))  ; the number of samples as an int

;; Copy the entire selection into an array
(setf my-array (snd-fetch-array *track* ln ln))

;; Convert the array back into a sound
(snd-from-array 0 *sound-srate* my-array)
``````