out of phase tones

Help for Audacity on Windows.
Forum rules
ImageThis forum is for Audacity on Windows.
Please state which version of Windows you are using,
and the exact three-section version number of Audacity from "Help menu > About Audacity".


Audacity 1.2.x and 1.3.x are obsolete and no longer supported. If you still have those versions, please upgrade at https://www.audacityteam.org/download/.
The old forums for those versions are now closed, but you can still read the archives of the 1.2.x and 1.3.x forums.
bunny94
Posts: 18
Joined: Fri Mar 02, 2018 4:53 pm
Operating System: Windows 10

out of phase tones

Post by bunny94 » Mon Jul 02, 2018 4:45 pm

I want to create three of the same same frequency sine wave tones which are 120 degrees out of phase with each other. I know how to produce the tones but its the rest I cant get my head round. Any advice much appreciated.

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: out of phase tones

Post by steve » Mon Jul 02, 2018 5:01 pm

Probably the easiest way is to use the Nyquist Prompt effect: https://manual.audacityteam.org/man/nyquist_prompt.html
The command "OSC" can generate a variety of simple tones, the default being a sine tone: http://www.cs.cmu.edu/~rbd/doc/nyquist/ ... l#index381

By default the Nyquist Prompt uses LISP syntax, so the command is:

Code: Select all

(osc pitch [duration table phase])
where "duration", "table" and "phase" are optional parameters.
"pitch" can be thought of as the note number, and there is a simple way to convert from "frequency" (in Hz) to "pitch", using the "HZ-TO-STEP" function: http://www.cs.cmu.edu/~rbd/doc/nyquist/ ... l#index315
By default the Nyquist prompt treats the selection as a duration of "1".

So, for example, to generate a sine tone at 440 Hz, that has the same duration as the selection, with a starting phase of zero:

Code: Select all

(osc (hz-to-step 440) 1 *sine-table* 0)
To generate a sine tone at 440 Hz, that has the same duration as the selection, with a starting phase of 120 degrees:

Code: Select all

(osc (hz-to-step 440) 1 *sine-table* 120)
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

bunny94
Posts: 18
Joined: Fri Mar 02, 2018 4:53 pm
Operating System: Windows 10

Re: out of phase tones

Post by bunny94 » Mon Jul 09, 2018 5:34 pm

Thanks Steve,

I will have a go at that, if I add a third tone , would I have to put in the value 240 for it to be 120 degrees different to the other two. I have downloaded the plug in which folder do I put it in. sorry to be a pain , bit of a learning curve for me.

regards Chris

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: out of phase tones

Post by steve » Mon Jul 09, 2018 5:43 pm

You don't need any plug-ins to do this. Just use the Nyquist Prompt effect and type (or copy & paste) the command into the Nyquist Prompt effect.

You can enter any numeric value for the "phase" parameter. 360 degrees phase is identical to 0 degrees phase, and identical to -360 degrees.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

bunny94
Posts: 18
Joined: Fri Mar 02, 2018 4:53 pm
Operating System: Windows 10

Re: out of phase tones

Post by bunny94 » Fri Jul 13, 2018 5:54 pm

Hi Steve,

I tried cutting and pasting your code. I got an error, I'm not sure if I am doing it right.

It said , your code looks like SAL syntax, but there is no return statement. Either use a return statement such as return s*0.1 for SAL or begin with an open parethesis such as (Mult s o.1) for LISP.

Can you advise on the code again please. sorry to be a pain. regards Chris

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: out of phase tones

Post by steve » Sat Jul 14, 2018 11:44 pm

bunny94 wrote:
Fri Jul 13, 2018 5:54 pm
Can you advise on the code again please.
(osc (hz-to-step 440) 1 *sine-table* 120)
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

bunny94
Posts: 18
Joined: Fri Mar 02, 2018 4:53 pm
Operating System: Windows 10

Re: out of phase tones

Post by bunny94 » Mon Jul 16, 2018 6:12 pm

thanks again Steve,

I have managed to out phase 3 tones , but i'm getting no sound. I am generating a tone which sounds fine then use the code you give me , changing the number (440) to match the tone. to understand this, is the 440 in your code the output frequency or would it be the frequency of the tone. I'm nearly there and appreciate your patience. regards Chris

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: out of phase tones

Post by steve » Mon Jul 16, 2018 6:31 pm

The number 440 is the frequency in Hz (same as the default frequency of Audacity's "Tone" generator).

Note that if you play two tones at the same time that are 180 degrees out of phase, or three tones that are all 120 degrees out of phase, they will cancel each other out and the result will be silence.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

DVDdoug
Forum Crew
Posts: 9416
Joined: Fri Sep 10, 2010 11:30 pm
Operating System: Windows 10

Re: out of phase tones

Post by DVDdoug » Mon Jul 16, 2018 7:04 pm

bunny94,

What are you trying to accomplish?

If you combine (mix or sum) phase-shifted waves of the same frequency they either add or subtract and you get the same frequency at a different amplitude. (Unless they sum to zero and completely cancel, then there's no wave and no frequency.) Also, be careful of clipping (distortion) if they add-up to over 1.0 (0dB).

If you are not combining the waves, then phase is pretty much meaningless since phase has to be relative to something.

You can get "interesting results" by shifting the phase (or flipping the polarity) of one channel in a stereo file, but I don't know what you'd do with 3 files/waves...

bunny94
Posts: 18
Joined: Fri Mar 02, 2018 4:53 pm
Operating System: Windows 10

Re: out of phase tones

Post by bunny94 » Tue Jul 17, 2018 10:56 am

Basically its the same tone ( frequency ) x 3 . All 120 degrees apart ( 3phase) and then combine them into one wave.

regards Chris

Post Reply