|
NtPlugin
Fast and easy audio plugin prototyping.
|
A framework for fast and easy audio plugin development. Includes a number of plugins that can be used as is or as examples.
The target audience of this project fall in two groups. One is musicians and producers who want high quality plugins free of charge and with a consistent UI look and feel. The other is hobbyists, students and professionals who needs to try out an idea quickly, without having to build a custom GUI for it. Users will be able to focus on the algorithms and not all the details of using JUCE or another framework.

The autogenerated UI is devided into six sections. The main grid displays the user defined primary knobs in the order they are defined. The grid is automatically laid out for minimal empty space in the UI. Maximum rows and columns are user customizable and defaults to 6 and 3. Only the main grid is not optional. The remaining areas can be disabled by the user. The secondary knobs are for fine control or less important parameters. The toggles/dropdowns area is at the bottom of the UI for boolean paramters and drop downs. To the left is the meters area, which displays peak and RMS level. Both normal and inverted (gain reduction) meters are available. RMS is only available for the first two meters, which are assumed to measure in- and output. To the right, the radio buttons area displays all the sets of radio buttons that the user defines. Finally, the title bar at the top contains the default options such as colour theme, oversampling setting and UI scaling. This can be disabled by the user, but the parameters are still there in the background.
Run the following command to install dependencies on Linux.
in the terminal. This should build and install the simple gain knob example plugin.
If you just want to install the included plugins, this can be done from source. The included ntPlugin.sh script will do this for Mac and Linux once the needed software is installed. ntPlugin.bat is available for build on Windows. At the time of writing, it does not install anything because of Windows security features. The easiest way to use the plugins after this build is to add [repo dir]\artifacts\VST3 to you DAW's plugin search path. Alternatively, you can copy and paste the contents of that folder to your plugin install folder. I order to perform the build type:
Have fun coding.
As with all code projects, there are secrets to know.
All of these things are specific to JUCE and not the NtPlugin framework, and they should work on and JUCE plugin project.
NOTE: VsCode on ARM Windows is an absolute mess. Not only does it not work, it also breaks your tools some magical way. Debugging works, but don't try to use Cmake.
In order to automate a number of general workflows, a CLI tool name ntPlugin.py is available. This will build all available plugins, run tests and create new plugins. Results of this program are stored in artifacts, separate from build so that the build dir can be cleaned out without deleting any artifacts. Files in artifacts are sorted according to plugin type and a text file named pluginIds.txt contains the ID and category of each plugin so that those persist across builds. Type python ntPlugin.py -h for more info.
Collaborators are most welcome. Feel free to make bug reports, feature requests and pull requests. If you manage to make a nice plugin, add wish to share with the world, it can become part of the repo through a pull request. A wrapper for the JUCE framework is available, but since plugins are written in platform-agnostic code, targeting more platforms in the future is possible. If anyone wishes to colaborate, adding a wrapper for eg. ESP32 or an ADI device would be an option for a project.
The testWrapper can be used to test plugins. The individual tests are stored in testWrapper/tests and are inidvidual C++ programs. A Python script is used to run the tests. It will generate test input files, build the test program, run it and plot the results. Plots are placed in testWrapper/img. If the results are accepted, the script can approve them so that the test will succeed on next run. Type python ntPlugin.py test -h for more information.
First, we need the normal python envirement stuff:
Now run the existing tests:
This should run all existing tests, which should all succeed. testWrapper/img should now contain a number of plots.
In order to test a plugin you must create a file named [plugin name]_test.cpp, include lib/ComponentTest.h and implement a main function, where you instantiate you plugin, make some settings, and add the object to the test class using NTFX_ADD_TEST. Then you retrun runAllTests(). Example:
NTFX_ADD_TEST takes a string argument that selects the stimulus to test against. The options are "impulse", "syncSweep", "linearSweep" and "dynamic_matched" and "dynamic_alternating". Different plots are made based on the selected stimulus.
Save as test/[plugin name]_test.cpp and run
Alternativly, the path of the test cpp file can be used as argument.
This should generate plots of frequency and phase response ("impulse"), spectrogram ("linearSweep") and dynamic response using a stimulus of a 10 kHz sine stepping between -12 dB and 0 dB level ("dynamic_matched" for the same on both channels, "dynamic_alternating" for alternating so the left is at 0 dB when right is at -12 dB and vice versa.) . "syncSweep" does not generate a plot at the time of writing. Both left and right channels are displayed in all plots to make differences or interactions visible. If the plots are good and the plugin is seen as passing test, the results are approved with the command:
Note that the argument is not the name of the class, but the name of the object instance in the test program. This is so some tests can be approved, while others may not.
If you want to use pluginval you will need to do the following:
The difference in strictness levels can be read inside the folder JuceWrapper/pluginval/README.md, but by default it is set to 10, which will test everything on the plugin for both AU and VST. You are able to add another test in JuceWrapper/tests/CMakeLists.txt, if you were to make a plugin as Standalone.
Once you have set the cmake configuration to Debug in VSC, and called:
You can then do the following commands to call the pluginval test in order to validate your plugins:
After calling ctest it will then start the validation of your plugin, and this will then prompt in the terminal:
The lib directory contains a library with a number of audio components, that can be used for plugins. This is not dependant on any JUCE code, and only uses the GCEM library for comiletime math. This ensures that the various features in the library can be used in any wrapper that might get added to this framework in the future. All the components in the library are templates and takes typename signal_t as template paramters. This is so that we can swap the underlying signal datatype if need be. We might want to implement a fractional datatype in the future for use on platforms without an FPU, or just switch to double precision for JUCE plugins.
signal_t is the underlying auto datatype. It is typedeffed i Audio.h. For JUCE plugins, this is float as default, and can be changed if double is needed.
The Audio class wraps two signal_t values in a single object and allows the user to write the dsp code once for both channels.
The NtFx::Component class sits at the heart of the framework. This is not to be confused with the juce::Component class, which is for UI components. It is a true virtual base class, which enforces the interface for audio components in the system. All stateful audio components in the library inherits this class, including the NtFx::NtPlugin class, with either signal_t or Audio<signal_t> as template parameter denoting whether the component process stereo or mono signals.
As stated earlier, NtFx::Component has the following true virtual methods. These must be implemented by all components in order to adhere to the interface.
The only member of the Component class is float fs, which is the oversampled (high) sample rate.
Each plugin design is controlled by settings in uiSpec and a number of vectors, which are all members inherited from the NtPlugin class. Most of the vectors are empty, and can be populated in order to add features to the UI.
The member uiSpec of NtPlugin contains a number of settings that can be set by the user in the constructor for the plugin. This is where the user sets things like window width, number of rows and columns and default sizes of emelments in the UI. Some sizes are dynamic and use the set size as a max.
UI elemments are added by pushing objects to the vectors that the user plugin enhirets from the NtPlugin base plugin. The available vectors are:
Knobs can be added to the vectors primaryKnobs or secondaryKnobs like this:
The remaining parameters types follow a similar patterns with a pointer to a value, a name and some members specific to the type of parameter.
The side chain input is a mono input, which is updated for each sample at the base sample rate and stored as the member xSc in the NtPlugin bae class. This can the be used in the process method of the user plugin.
tempo is another member of the NtPlugin base class that can be used for coefficient calculation in the user plugin. It is updated per buffer if the host supports it. If not, the tempo is 0, so the user should always check it before using it.
Under some circumstances, changing parameters will cause clicks and pops in audio output. In order to mitigate this, gLiders can be user to glide changes in parameters into place slowly. The value facing the UI side of the plugin is called ui and this should be set when the paramter changes, and the processing facing value is named pr. This is what you use in the processing code. Both linear and exponential gliders are available, and both follow the same pattern. The exponential glider is asymptotic and reaches 90% of the target value as the glide time expires, whereas the linear glider will reach the target exactly when the time expires. The Glider class does follow the Component interface, since process doesn't take an input and there is no reset method. Instead is sample rate and the main setting, the glide time, set in the call to update. Glider::process should only be called once per call to process in the user plugin. The ntTapeEcho plugin in plugins contains an example of usage.
The FirstOrder class enhirets the Component class and thus follows that pattern. It delivers a first order high filter and low pass filters, with and without zero at the Nyquist frequency. The version with a zero at the Nyquist frequency performs better in the high frequencies but the one without sums perfectly when the filter is used for crossovers. The shape of first order filters is set as a template parameter and thus is fixed at runtime.
Second order filters are encapsuled in the Biquad namespace. Both five and six coefficient versions are available along with coefficient calculation for both. An EqBand class pairs two five-coefficient biquads for left and right channel with settings and can be used to add second order filters to a plugin. The Shape enum holds the possible shapes and none can be used to bypass the filter without branching if needed.
The peak sensor can be used to detect the peak level of a signal with a user controllable release. This is used for dynamics side chains and peak level meters.
Rms sensor with variable averaging time in milliseconds. Used for RMS dynamics and metering.
The sample rate converter is a part of the plugin by default and the user doesn't need to do anything in order to utilize it. It's a syncornios converter that takes a reference to an NtPlugin, who's process-method will be called per sample at the upsampled rate.
The Comp namespace contains a number of compressor side chains, including peak- and RMS-sensing in dB and linear domains.
SoftClip is a stateless polynominal algorithm. The coefficients are calculated compile time and used in free functions for third, fifth and seventh order soft clipping.
The Transformer class is an experiment to make a simplified transformer model. It's only modelling the low frequency part of the transformer behavior.