Search code examples
audiocommand-line-interfacesox

Sound - SOX: How can I make a 180 degrees phase shifted version of an audio file/ stream?


I'm trying to get a 180 degrees phase shifted waves that effectively cancels the sound if mixed with or played in sync with?

Please limit the answers to sox, the 'Swiss Army knife of sound processing programs'.


Solution

  • You can use the -v option combined with a negative value. Using -1 you'll get a new signal you are looking for.

    As an example, you could synthesize a cosine signal:

    sox -n cos.wav synth 3 sine 500
    

    and then change its phase using the -v option:

    sox -v -1 cos.wav sin.wav
    

    If you then combine the 2 signal together

    sox -m cos.wav sin.wav sum.wav
    

    you'll see you have obtained a null signal