Skip to content

sboukortt/intersect-lv2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

intersect-lv2

Intersect is an LV2 plugin which, given a stereo audio stream, “expands” it to three channels. Everything that is present in both input channels will be in the center channel of the output, and what is specific to each channel will be in the corresponding output channel.

This can be useful, for example, to rediscover some of your favorite music by hearing things that you had never noticed before. (With that said, note that it does not necessarily work equally well on all songs, depending on how they were mixed.)

Intersect has been developed on Linux, and tested on Linux and Windows. It would certainly be possible to port it to macOS, but no effort has been made toward that so far.

Being an LV2 plugin, Intersect also requires an LV2 host. Examples include LV2proc (recommended on Linux) and the famous Audacity editor.

The simplest option on Windows is to download the binaries on the release page. You should pick the win32 or win64 archive depending on whether your LV2 host is 32-bit (which Audacity currently is) or 64-bit.

Assuming that your Windows installation lives on drive C:, you can then drag and drop the intersect.lv2 folder from the archive to either C:\Users\<user name>\AppData\Roaming\LV2 to install it for your user only, or C:\Program Files\Common Files\LV2 to install it globally. Replace Program Files with Program Files (x86) if you have a 64-bit edition of Windows and a 32-bit LV2 host.

There is a PKGBUILD for Arch Linux which takes care of building an installable package.

No binaries are provided for Linux. Therefore, you should compile the plugin on your own machine.

To that effect, you need:

  • pkg-config
  • tup
  • a C compiler (the build files use Clang by default but they should be easy to change if you prefer to use GCC)
  • development files for FFTW and LV2

You can then run the following from Intersect’s source tree:

$ tup variant config/release.config
$ tup

Finally, you can then copy the build-release/intersect.lv2 folder to either $HOME/.lv2/ or /usr/lib/lv2/.

Basic usage looks as follows:

$ lv2proc --normalize -i input.flac -o output.flac 'https://sami.boukortt.com/plugins/intersect#Upmix'

--normalize is optional and results in lv2proc (you guessed it) normalizing the output to -0dB. It can prevent clipping if the input file is too loud.

You can also specify different values for the parameters using -c, for example: -c fft_window_size:8192. (See the section on parameters for more details.)

For your convenience, a script is provided at the root of the source tree. It is a very simple script (as you will see if you look at its source code) that allows you (requires you, actually) to leave out the URI of the plugin. Assuming that you put the script on your PATH, the example above becomes:

$ intersect --normalize -i input.flac -o output.flac

Unfortunately, at the moment, a bug in Audacity prevents effects from turning a 2-channel track into three channels. Consequently, two additional effects are provided, each producing part of Intersect’s full output:

  • “Channel Intersection” produces the center channel;
  • “Channel Symmetric Difference” produces the left and right channels.

After installing Intersect, you might need to enable the effects in Audacity using “Effects” → “Add / Remove Plug-ins…”. Those effects will then appear at the bottom of the “Effects” menu, under “Plug-ins 1 to 15” (or different numbers if you already have a lot of plugins).

Note:in case that bug is ever fixed, the full Intersect effect appears as “2.0 -> 3.0 Upmix”.

A few parameters can be set if desired, although they should have sensible defaults.

Default value:4096
LV2 port name:fft_window_size

Number of samples on which to perform a Fourier transform at a time. Higher values increase the frequency resolution, at the expense of temporal resolution (but you can increase the overlap factor to make up for it).

Default value:128
LV2 port name:overlap_factor

Intersect performs FFTs over overlapping windows. For example, with an overlap factor of 2, the following transforms will be computed:

Input:                [----------------------------]

Transforms: [--------]
                 [--------]
                      [--------]
                           [--------]
                                [--------]
                                     [--------]
                                          [--------]
                                               [--------]
                                                    [--------]

That is, at each step, the beginning position of the transform is increased by fft_window_size / overlap_factor, not by a full fft_window_size.

Thus, the overlap factor is the number of transforms that are applied to a given sample. The corresponding output sample is computed from the average of the result of processing each of those transforms.

Increasing this number improves temporal resolution but also increases the processing time required.