# How to create sinusoidal frequency modulation inside a selected track

Hi,
Two topics:

1. I would like to create frequency modulation sound (tone) inside the track. I selected from the menu “Generate” → “Tone” where you can input tone with a defined duration, waveform and frequency. After that, in the same track, I inputted the next tone with a different frequency and duration and same waveform. The problem is there is no “smooth” transition between these two pieces of tones. I would like to define a smooth transition within a defined time between these two frequencies. E.g. 10kHz for 1s then smooth transition to 15kHz within 0.2s then go back to 10kHz with 0.2s etc. All with the same amplitude. So it’s like a typical frequency modulation effect. But I cannot find anything like this inside the Audacity application. Could you please support me? Is it possible to do with this software or do I need more advanced software?

2. When I have finally created frequency modulation for 1st track, am I able to easily create the second track that will be a “reverse / mirror” track of the 1st one with the same timing but reverse frequency?
E.g. 1st track: 10kHz → smooth transition to 15kHz → smooth transition to 10kHz etc.
E.g. 2nd track: 15kHz → smooth transition to 10kHz → smooth transition to 15kHz etc.

Thank you for support in advance, Henryk

You can do that with “Nyquist” (see: Nyquist - Audacity Manual)

E.g. 10kHz for 1s then smooth transition to 15kHz within 0.2s then go back to 10kHz with 0.2s etc.

0 to 1 seconds = 10kHz
1 to 1.2 seconds = 10kHz to 15kHz
1.2 to 1.4 seconds = 15kHz to 10kHz
etc = ???

It should be like this:
0 to 1 seconds = 10kHz
1 to 1.2 seconds = 10kHz to 15kHz
1.2 to 2.2 seconds = 15kHz
2.2 to 2.4 seconds = 15kHz to 10kHz
2.4 to 3.4 seconds = 10kHz
etc = repeat the above in an endless loop keeping 0.2s frequency transitions

As regards the second track, it should be the “mirror” of the 1st one.
So, if for the 1st one is 10kHz at a specific moment of time, for the 2nd one should be 15kHz at the same time.
When for the 1st one is transition from 10kHz to 15kHz, there should be transition from 15kHz to 10kHz for the 2nd at the same time.

Try running this in the Nyquist Prompt (https://manual.audacityteam.org/man/nyquist_prompt.html)

;type generate

(setf hz1 10000)
(setf hz2 15000)
(setf dur1 1.0)   ;length of hz1
(setf dur2 1.0)
(setf durt 0.2)   ;length of transition
(setf amp 0.8)    ;amplitude on linear scale 0 to 1.

(setf total-dur 30) ;total length of generated sound (seconds)

(setf hz-ctrl (abs-env (pwlvr hz1 dur1 hz1 durt hz2 dur2 hz2 durt hz1)))
(setf hz-ctrl-table (maketable hz-ctrl))

(setf f0 (/ 1.0 (+ dur1 dur2 durt durt)))  ;frequency

(setf freq (osc (hz-to-step f0) total-dur hz-ctrl-table 0))
(mult amp (hzosc freq))

For the “mirror” version, change the values of hz1 and hz2 in lines 3 and 4.

Alternatively, change the phase by 180 degrees by changing:

(setf freq (osc (hz-to-step f0) total-dur hz-ctrl-table 0))

to:

(setf freq (osc (hz-to-step f0) total-dur hz-ctrl-table 180))

Thanks a lot for this piece of code and your support on this topic!