# Does anyone know how to do this? Does anyone know a plugin or software where I can make or morph a shape and then have it converted it into a wave like this gif I found?

The circle is usually just a teaching tool to illustrate how a sine wave is created from an even, cyclical event. There is no natural connection between the two since the circle is missing time or duration information.

You can draw your own waves with the pencil tool in the standard tool box at the top of the screen.

No, Audacity has no provision to follow an animated GIF.

Koz

As Koz said, Audacity has no provision to follow an animated GIF. Is that what you are asking?
A “sine wave” can be described in a number if ways, one is:
y = sin t

The fundamental relationship between this and a circle is illustrated in this animation: If you can define the relationship between a “shape” and that shape transferred to a time-line then it will be possible to generate that waveform using Nyquist.
For example,

if you consider drawing a square, starting from the bottom left corner and going up…
When mapped to a time line, that will correspond to the waveform rising as a straight line slope from the bottom of the track to the top of the track.

When you then draw the top of the square from top left to top right, the “amplitude” (height) remains constant, so the waveform will need to remain at the top of the track for that next period.

When you draw from the top right corner of the square to the bottom right corner, the waveform will fall in a straight line to the bottom of the track.

Finally completing the square, the waveform remains at the bottom of the track until the square is completed.

So for the square, there are 4 important coordinates, with linear extrapolation between them:
x=-1, y= -1
x=+1, y=-1
x=+1 y+1
x=-1, y=+1

When transposed to a time-line we get:
A=-1, t= 0
A=+1, t=1
A=+1 t+2
A=-1, t=3
where “A” is the amplitude and “t” is the time.

This can be drawn using the pwl function in Nyquist:
pwl takes its parameters in pairs of “time / amplitude”, so we need to reverse the parameters listed above:
0 / -1
1 / +1
2 / +1
3 / -1
4 / -1 (to bring us back to the bottom left corner of the square)
These can be put into the pwl function as:

``````(pwl 0 -1 1 1 2 1 3 -1 4 -1)
``````

If we want to “draw” this with absolute co-ordinates (“t” in seconds) and apply it as an “effect”, then there’s a couple of other bits that we need to do:

pwl is normally used as a control signal rather than a sound, so it usually has a low sample rate. If we want to use it as a sound we need to change the “control rate” (the sample rate for control signals) so that it is the same as the “sound rate” (the sample rate for sounds). We can do this using control-rate-abs

``````(control-srate-abs *sound-srate*
(pwl 0 -1 1 1 2 1 3 -1 4 -1))
``````

where sound-srate is a built-in constant representing the “sound rate”.

The other thing that we need to do is to tell Nyquist to use “absolute time”. Effects normally take “1 unit” of time as being the selection length - so that when we apply an effect it is applied to the whole selection and not just to the first 1 second. In this case we want our time units in seconds so we use the function abs-env.

``````(abs-env
(control-srate-abs *sound-srate*
(pwl 0 -1 1 1 2 1 3 -1 4 -1)))
``````

and that is it. If you apply this final piece of code using the Nyquist Prompt effect it will draw 1 period (cycle) of our waveform with each “side of the square” represented as 1 second on the time line.

Here I have amplified the track down a little so that the top and bottom are more easily visible: Other linear “shapes” can be transformed into waveforms in similar fashion.

Following on from our last post, we can make our “transformed square” into a practical waveform generator by using it in an “oscillator”.
To do this we need to convert our generated single cycle into a “lookup table” for the oscillator.
We no longer need to generate that single cycle using the (high) sample rate of sounds, so let’s take that part out:
This is our single cycle, and I have assigned it to “mywav”, so when we use “mywav” Nyquist knows that we mean this bit of code:

``````(setf mywav
(abs-env
(pwl 0 -1 1 1 2 1 3 -1 4 -1)))
``````

To create a “wave table” there is a convenient function: maketable
So now we will create a wavetable and give it a name (assign it to a variable, so that we can use it later):

``````(setf mytable (maketable mywav))
``````

The oscillator function that we will use is: osc
This oscillator is used like this:
(osc note [duration table phase])

note is the MIDI note value for the tone that we want to create. “Middle C” is note number 60. Each note on a piano keyboard has a MIDI note number with a semitone being equal to a step of 1, so that C# above middle C is note number 61 and the B below middle C is note number 59. (see here for more details: http://www.phys.unsw.edu.au/jw/notes.html)

In this case we will generate MIDI note number 69, which is 440 Hz, (“A” above “middle C”).
“duration, table and phase” are optional and if not defined the default values will be used. We want to specify the “table” so that we can use “mytable”, therefore we must use the first three arguments, (note, duration and table).

The “duration” parameter, when used in an “effect” is relative to the duration of the selection (as described previously), so if we want to generate a tone of the same duration as the selection we just set this to “1”.

So our oscillator function is:

``````(osc 69 1 mytable)
``````

Putting this altogether, our Nyquist script (which you can copy and paste into the Nyquist Prompt effect) is:

``````(setf mywav
(abs-env
(pwl 0 -1 1 1 2 1 3 -1 4 -1)))

(setf mytable (maketable mywav))

(osc 69 1 mytable)
``````

Woh woh. This is all WAY over my head lol. I was just wondering if there is an audio plugin where you can Model a 2D shape with vertices and have it instantly converted into an audio wave. The gif you posted in illustrates it perfectly. It would just be interesting if you made a shape and as the audio was playing you could morph it or rotate it ect to effect audio.
Thanks.

Oh, in that case I think the answer is no, or at least there are no plug-ins that I know of that do that. However, the built-in generators provide 3 pre-defined “shapes”. The Sine generator is equivalent to a circle transposed to the time-line, the square wave is equivalent to a vertical line transposed in similar fashion, and the sawtooth wave is equivalent to a right angle triangle transposed in similar fashion.

You can now also do a square by copy/pasting the last piece of code into the Nyquist Prompt effect:

``````(setf mywav
(abs-env
(pwl 0 -1 1 1 2 1 3 -1 4 -1)))

(setf mytable (maketable mywav))

(osc 69 1 mytable)
``````