out of phase tones

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.

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/part8.html#index381

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

``````(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/part8.html#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:

``````(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:

``````(osc (hz-to-step 440) 1 *sine-table* 120)
``````

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

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.

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

(osc (hz-to-step 440) 1 sine-table 120)

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

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.

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…

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

regards Chris

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

Yes, but why? The result is a simply sine wave (or a flat line). Are you trying to demonstrate something mathematically? Or do you have “plans” for the resulting sine wave?

As Steve pointed-out (and maybe as you’ve discovered), if they are equal in amplitude you’ll get silence/nothing. …I’d forgotten that.

If they are unequal in amplitude you’ll get a sine wave at the same frequency but at a different amplitude. It’s easier to simply amplify/attenuate, or to generate the sine wave you want to begin with?

What I thought was if the 3 tones where out of phase with each other they would not cancel each other out but seems they do so to do what I wanted it seems I have to have 3 separate speakers. At least I know how to out phase the tones now so thank you for that. All the Best.

What’s that? If you tell us what you are trying to do, we may be able to help you.

it seems I have to have 3 separate speakers.

At low (bass) frequencies you’ll get partial cancellation when the sound waves mix in the air. In theory you could get perfect cancelation (at any frequency) but the acoustic waves won’t match perfectly, especially if you are in a “normal room” where sound bounces-around.

…If you have a normal stereo set-up and reverse the connections to one speaker (180 degree phase inversion), you’ll get a LOT of bass cancellation but you’ll still hear some bass.* And, you’ll get enough cancellation at other frequencies to make music “sound weird”, especially as you move around.

At higher frequencies it will be more-dependent on your location, the location of the speakers, and reflections in the room. At 10kHz the wavelength is a little less than 1.5 inches, so 1.5 inches is 360 degrees and there’s a phase-difference between your 2-ears and simply moving your head will make a difference.

…If you have 3 speakers, it might be easier to calculate the wavelength and set the distance (between you and the speakers) for 1/3rd of the wavelength.

\

• I’ve never tried it outdoors. With no room reflections you can probably get 100% cancellation at low frequencies. At higher frequencies the phase-difference (time delay) between your ears would mean you’d only get cancellation in one ear at a time.