Coder Social home page Coder Social logo

x42 / phaserotate.lv2 Goto Github PK

View Code? Open in Web Editor NEW
16.0 4.0 2.0 294 KB

Phase Rotation LV2 plugin

Home Page: https://x42-plugins.com/x42/x42-phaserotate

License: GNU General Public License v2.0

Makefile 11.59% C 63.26% Roff 3.56% C++ 21.58%
lv2-plugin phase-rotation audio

phaserotate.lv2's Introduction

phaserotate.lv2

phaserotate.lv2 is an audio phase rotation plugin.

Phase shift vs. time shift

Time shifting delays a signal by an absolute value in seconds (or samples). While phase shift uses a relative value, a fraction of the wave-length.

When phase shifting a signal, different components of the signal are delayed differently depending on their frequency.

The following figure shows an oscilloscope display of two sine-waves with different frequencies that play concurrently (green and blue) and respective shifted versions of each signal (red, violet).

The left images shows a phase shift by 90deg (1/4 wave-length). Note that the time-delay differs: The sine-wave with the lower frequency (top, red) is delayed further compared to the higher pitched sine-wave (bottom, violet).

In the right image both sine-waves are delayed by the same time. Note how this results in a different phase shift, as both waves differ in their wavelength.

Due to the periodic nature of the signal, a phase shift of +180 deg is equivalent to a shift of -180 deg. The signal is rotated around the unit circle on the complex plane.

Phase rotation

The interesting aspect is that phase rotation does not alter the sound of the signal nor the loudness. However changing the phase vs. frequency relationship between lower and upper harmonics changes the waveform and can affect where the digital peak occurs.

For this reason phase rotation is commonly used by radio stations to reduce the signal peak and make the signal more symmetrical. Phase rotation circuits are also used during mastering to increase headroom. This allows to increase gain and further compress the signal.

Caveat

By nature of the process phase-rotation affects transient response. Similar to a linear-phase EQ, there is also pre-ringing. Use this effect with caution because you are about to become a casualty in the loudness-war against quality. You have been warned.

CLI

In addition to the plugin, there is a command-line tool that can analyze an audio file, and find the phase shift which will result in a minimum peak.

This is for offline analysis and offline processing only, and not installed by default.

Install

Compiling phaserotate.lv2 requires the LV2 SDK, fftw, gnu-make, and a c-compiler.

git clone https://github.com/x42/phaserotate.lv2.git
cd phaserotate.lv2
make

ln -s `pwd`/build ~/.lv2/phaserotate.lv2
#sudo make install PREFIX=/usr

cd cli
make
#sudo make install PREFIX=/usr
./phase-rotate --help

Note to packagers: The Makefile honors PREFIX and DESTDIR variables as well as CFLAGS, LDFLAGS and OPTIMIZATIONS (additions to CFLAGS), also see the first 10 lines of the Makefile.

phaserotate.lv2's People

Contributors

dvzrv avatar x42 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

asdlei99 dvzrv

phaserotate.lv2's Issues

Man page not being built leads to failing install of x42-plugins 20220913

Hi! When trying to install x42-plugins 20220913 I ran into an issue where the man page of this project is not built and therefore fails the installation of the plugins.

install -d /build/x42-plugins/pkg/x42-plugins/
make[1]: [Makefile:233: submodule_check] Error 1 (ignored)
install -d /build/x42-plugins/pkg/x42-plugins//usr/share/man/man1
install -m644 x42-spectr.1 /build/x42-plugins/pkg/x42-plugins//usr/share/man/man1
install -d /build/x42-plugins/pkg/x42-plugins//usr/lib/lv2/mixtri.lv2
make[1]: [Makefile:244: submodule_check] Error 1 (ignored)
install -d /build/x42-plugins/pkg/x42-plugins//usr/lib/lv2/fil4.lv2
install -d /build/x42-plugins/pkg/x42-plugins//usr/share/man/man1
install -d /build/x42-plugins/pkg/x42-plugins//usr/bin
install -m755 build/matrixmixerUI_gl.so /build/x42-plugins/pkg/x42-plugins//usr/lib/lv2/matrixmixer.lv2
install -m644 x42-phaserotate.1 /build/x42-plugins/pkg/x42-plugins/
install -m644 x42-fat1.1 /build/x42-plugins/pkg/x42-plugins//usr/share/man/man1
install -m755 build/sisco.so /build/x42-plugins/pkg/x42-plugins//usr/lib/lv2/sisco.lv2
install -d /build/x42-plugins/pkg/x42-plugins//usr/lib/lv2/spectra.lv2
install -m644 build/manifest.ttl build/mixtri.ttl /build/x42-plugins/pkg/x42-plugins//usr/lib/lv2/mixtri.lv2
install -m644 x42-tuna.1 /build/x42-plugins/pkg/x42-plugins//usr/share/man/man1
install: cannot stat 'x42-phaserotate.1': No such file or directory
install -m755 x42/x42-darc /build/x42-plugins/pkg/x42-plugins//usr/bin
install -m644 build/manifest.ttl build/fil4.ttl /build/x42-plugins/pkg/x42-plugins//usr/lib/lv2/fil4.lv2
make[1]: *** [Makefile:290: install-man] Error 1
make[1]: Leaving directory '/build/x42-plugins/src/x42-plugins-20220913/phaserotate.lv2'
install -d /build/x42-plugins/pkg/x42-plugins//usr/bin
install -m644 build/manifest.ttl build/spectra.ttl /build/x42-plugins/pkg/x42-plugins//usr/lib/lv2/spectra.lv2
install -d /build/x42-plugins/pkg/x42-plugins//usr/lib/lv2/fat1.lv2
make: *** [Makefile:40: phaserotate.lv2] Error 2
make: *** Waiting for unfinished jobs....

How to build for Windows

Hi, thank you for your great work in x42 plugins.

I need some help in how to build the static binaries to be used on Windows (specially the CLI). I am using Windows 11, with Arch Linux via WSL2 and mingw64 for crosscompile. But with the instructions provided I can only build for Linux.

I am trying to use this code:
git clone https://github.com/x42/phaserotate.lv2.git
cd phaserotate.lv2
make submodules
make XWIN=x86_64-w64-mingw32

But it never compiles the Windows static binaries. Any help on how I could do it would be very appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.