Skip to content

Commit

Permalink
Merge branch 'chow2'
Browse files Browse the repository at this point in the history
  • Loading branch information
madskjeldgaard committed Mar 25, 2021
2 parents 5fea79a + c529cf2 commit 2ca051d
Show file tree
Hide file tree
Showing 43 changed files with 3,145 additions and 63 deletions.
192 changes: 166 additions & 26 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
cmake_minimum_required(VERSION 3.5)
set(project_name "MKPlugins")
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake_modules ${CMAKE_MODULE_PATH})
set(CMAKE_CXX_STANDARD 14)

# Eigen seems to prefer 17
set(CMAKE_CXX_STANDARD 17)

message(STATUS "Cmake build type: " ${CMAKE_BUILD_TYPE})

Expand Down Expand Up @@ -68,6 +70,11 @@ option(NATIVE "Optimize for native architecture" OFF)
option(STRICT "Use strict warning flags" OFF)
option(NOVA_SIMD "Build plugins with nova-simd support." ON)

# Exclude / include certain experimental / work in progress plugins
option(INCPULSE "Include AnalogPulseShaper plugin" OFF)
option(INCWERNER "Include Werner plugin" OFF)
option(INCPHASORMODAL "Include PhasorModal plugin" ON)

####################################################################################################
# include libraries

Expand All @@ -76,6 +83,52 @@ if(NOVA_SIMD)
include_directories(${SC_PATH}/external_libraries/nova-simd)
endif()

####################################################################################################
# DAISYSP LIBRARY
####################################################################################################

# DaisySP library
add_subdirectory(DaisySP)

# Link plugin with DaisySP library
function(sc_link_with_daisy plugin_name)
message(STATUS "Linking ${plugin_name} with DaisySP library")
if(SCSYNTH)
include_directories("${plugin_name}_scsynth" DaisySP/Source)
target_link_libraries("${plugin_name}_scsynth" DaisySP )
endif()

if(SUPERNOVA)
include_directories("${plugin_name}_supernova" DaisySP/Source)
target_link_libraries("${plugin_name}_supernova" DaisySP )
endif()
endfunction()

####################################################################################################
# EIGEN LIBRARY
####################################################################################################

if(INCWERNER)
# Eigen library
add_subdirectory(eigen)
endif(INCWERNER)

# Link plugin with eigen library
function(sc_link_with_eigen plugin_name)
message(STATUS "Linking ${plugin_name} with eigen library")
if(SCSYNTH)
include_directories("${plugin_name}_scsynth" eigen/Eigen)
target_link_libraries("${plugin_name}_scsynth" eigen )
endif()

if(SUPERNOVA)
include_directories("${plugin_name}_supernova" eigen/Eigen)
target_link_libraries("${plugin_name}_supernova" eigen )
endif()
endfunction()



####################################################################################################
# Plugins
####################################################################################################
Expand Down Expand Up @@ -133,31 +186,6 @@ sc_add_server_plugin(
"${Chen_sc_files}"
"${Chen_schelp_files}"
)

####################################################################################################
# DAISYSP LIBRARY
####################################################################################################

# DaisySP library
add_subdirectory(DaisySP)

# Link plugin with DaisySP library
function(sc_link_with_daisy plugin_name)
message(STATUS "Linking ${plugin_name} with DaisySP library")
if(SCSYNTH)
include_directories("${plugin_name}_scsynth" DaisySP/Source)
target_link_libraries("${plugin_name}_scsynth" DaisySP )
endif()

if(SUPERNOVA)
include_directories("${plugin_name}_supernova" DaisySP/Source)
target_link_libraries("${plugin_name}_supernova" DaisySP )
endif()
endfunction()

####################################################################################################
# END PLUGIN TARGET DEFINITION
####################################################################################################
# Rongs
set(Rongs_cpp_files
plugins/Rongs/Rongs.hpp
Expand Down Expand Up @@ -533,3 +561,115 @@ sc_add_server_plugin(
"${AnalogPhaserMod_schelp_files}"
)

if(INCPHASORMODAL)
# PhasorModal
set(PhasorModal_cpp_files
plugins/ChowDSP/PhasorModal.hpp
plugins/ChowDSP/PhasorModal.cpp
)
set(PhasorModal_sc_files
plugins/ChowDSP/PhasorModal.sc
)
set(PhasorModal_schelp_files
plugins/ChowDSP/PhasorModal.schelp
)

sc_add_server_plugin(
"${project_name}" # destination directory
"PhasorModal" # target name
"${PhasorModal_cpp_files}"
"${PhasorModal_sc_files}"
"${PhasorModal_schelp_files}"
)
endif(INCPHASORMODAL)

if(INCPULSE)
# AnalogPulseShaper
set(AnalogPulseShaper_cpp_files
plugins/ChowDSP/AnalogPulseShaper.hpp
plugins/ChowDSP/AnalogPulseShaper.cpp
)
set(AnalogPulseShaper_sc_files
plugins/ChowDSP/AnalogPulseShaper.sc
)
set(AnalogPulseShaper_schelp_files
plugins/ChowDSP/AnalogPulseShaper.schelp
)

sc_add_server_plugin(
"${project_name}" # destination directory
"AnalogPulseShaper" # target name
"${AnalogPulseShaper_cpp_files}"
"${AnalogPulseShaper_sc_files}"
"${AnalogPulseShaper_schelp_files}"
)
endif(INCPULSE)

# AnalogTape
set(AnalogTape_cpp_files
plugins/ChowDSP/AnalogTape.hpp
plugins/ChowDSP/AnalogTape.cpp
# plugins/ChowDSP/HysteresisProcessing.hpp
# plugins/ChowDSP/HysteresisProcessing.cpp
)
set(AnalogTape_sc_files
plugins/ChowDSP/AnalogTape.sc
)
set(AnalogTape_schelp_files
plugins/ChowDSP/AnalogTape.schelp
)

sc_add_server_plugin(
"${project_name}" # destination directory
"AnalogTape" # target name
"${AnalogTape_cpp_files}"
"${AnalogTape_sc_files}"
"${AnalogTape_schelp_files}"
)

# target_link_libraries("AnalogTape_scsynth" plugins/ChowDSP/HysteresisProcessing.hpp plugins/ChowDSP/HysteresisProcessing.cpp)
# target_link_libraries("AnalogTape_supernova" plugins/ChowDSP/HysteresisProcessing.hpp plugins/ChowDSP/HysteresisProcessing.cpp)

if(INCWERNER)
# Werner
set(Werner_cpp_files
plugins/ChowDSP/Werner.hpp
plugins/ChowDSP/Werner.cpp
)
set(Werner_sc_files
plugins/ChowDSP/Werner.sc
)
set(Werner_schelp_files
plugins/ChowDSP/Werner.schelp
)

sc_add_server_plugin(
"${project_name}" # destination directory
"Werner" # target name
"${Werner_cpp_files}"
"${Werner_sc_files}"
"${Werner_schelp_files}"
)
sc_link_with_eigen("Werner")
endif(INCWERNER)

# AnalogVintageDistortion
set(AnalogVintageDistortion_cpp_files
plugins/ChowDSP/AnalogVintageDistortion.hpp
plugins/ChowDSP/AnalogVintageDistortion.cpp
)
set(AnalogVintageDistortion_sc_files
plugins/ChowDSP/AnalogVintageDistortion.sc
)
set(AnalogVintageDistortion_schelp_files
plugins/ChowDSP/AnalogVintageDistortion.schelp
)

sc_add_server_plugin(
"${project_name}" # destination directory
"AnalogVintageDistortion" # target name
"${AnalogVintageDistortion_cpp_files}"
"${AnalogVintageDistortion_sc_files}"
"${AnalogVintageDistortion_schelp_files}"
)

29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,29 @@ Most of these are algorithms that I felt like exploring more in-depth at a C++ l

## Included plugins


- **AnalogBassDrum** - Virtual analog 808 bass drum model. Original code by [Èmilie Gillet / Mutable Instruments](https://github.com/pichenettes/eurorack). Revisited by Ben Sergentanis for the [DaisySP DSP library](https://github.com/electro-smith/DaisySP).
- **AnalogPhaserMod** - The modulation section of a phaser based on/inspired by classic krautrock phasers. Ported from [Jatin Chowdhury's ChowDSP-VCV-rack project](https://github.com/jatinchowdhury18/ChowDSP-VCV).
- **AnalogPhaser** - Virtual analog feedback phaser based on/inspired by classic krautrock phasers. Ported from [Jatin Chowdhury's ChowDSP-VCV-rack project](https://github.com/jatinchowdhury18/ChowDSP-VCV).
- **AnalogSnareDrum** - Virtual analog 808 snare drum model. Original code by [Èmilie Gillet / Mutable Instruments](https://github.com/pichenettes/eurorack). Revisited by Ben Sergentanis for the [DaisySP DSP library](https://github.com/electro-smith/DaisySP).
- **AnalogTape** - Virtual analog tape model with variable oversampling and anti aliasing. Ported from [Jatin Chowdhury's ChowDSP-VCV-rack project](https://github.com/jatinchowdhury18/ChowDSP-VCV).
- **AnalogVintageDistortion** - A virtual analog vintage EQ and distortion by Jatin Chowdhury. Features oversampling. Ported from [Jatin Chowdhury's ChowDSP-VCV-rack project](https://github.com/jatinchowdhury18/ChowDSP-VCV).
- **BLOsc** - Band limited oscillator. Original Author(s): Paul Batchelor, saw2 Faust by Julius Smith. Revisited by Ben Sergentanis for the [DaisySP DSP library](https://github.com/electro-smith/DaisySP).
- **Chen** - Chen's chaotic double scroll attractor, based on code from [Bryan Head's alternative Mutable Instruments firmware](https://github.com/qiemem/eurorack/releases/tag/v1.1.0).
- **DCompressor** - Compressor from [DaisySP DSP library](https://github.com/electro-smith/DaisySP), ported from faust originally by shensley andAvAars originally.
- **HarmonicOsc** - 16 voice harmonic oscillator. Original code by [Èmilie Gillet / Mutable Instruments](https://github.com/pichenettes/eurorack). Revisited by Ben Sergentanis for the [DaisySP DSP library](https://github.com/electro-smith/DaisySP).
- **LPG** - Virtual analog Buchla Lowpass-gate based on the work of Julian Parker and Stefano D'angelo.
- **NeoFormant** - Formant oscillator with aliasing-free phase reset. Original code by [Èmilie Gillet / Mutable Instruments](https://github.com/pichenettes/eurorack). Revisited by Ben Sergentanis for the [DaisySP DSP library](https://github.com/electro-smith/DaisySP).
- **NeoVarSawOsc** - Variable saw oscillator. Original code by [Èmilie Gillet / Mutable Instruments](https://github.com/pichenettes/eurorack). Revisited by Ben Sergentanis for the [DaisySP DSP library](https://github.com/electro-smith/DaisySP).
- **OscBank** - A mixture of 7 sawtooth and square waveforms in the style of divide-down organs. Original code by [Èmilie Gillet / Mutable Instruments](https://github.com/pichenettes/eurorack). Revisited by Ben Sergentanis for the [DaisySP DSP library](https://github.com/electro-smith/DaisySP).
- **PhasorModal** - Ported from [Jatin Chowdhury's ChowDSP-VCV-rack project](https://github.com/jatinchowdhury18/ChowDSP-VCV).
- **Resonator** - A resonant body simulation (originally found in the Mutable Instruments Rings synthesizer module). Original code by [Èmilie Gillet / Mutable Instruments](https://github.com/pichenettes/eurorack). Revisited by Ben Sergentanis for the [DaisySP DSP library](https://github.com/electro-smith/DaisySP).
- **Rongs** - A modal synthesis voice. This is a remix of the Mutable Instruments Rings algorithm allowing unrealistic sounds of sloppy gongs and 100km long strings. Original code by [Èmilie Gillet / Mutable Instruments](https://github.com/pichenettes/eurorack).
See the overview helpfile [MKPlugins](/plugins/HelpSource/Overview/MKPlugins.schelp) for more information which plugins are included.
- **StringVoice** - Extended Karplus-Strong. Original code by [Èmilie Gillet / Mutable Instruments](https://github.com/pichenettes/eurorack). Revisited by Ben Sergentanis for the [DaisySP DSP library](https://github.com/electro-smith/DaisySP).
- **VarShapeOsc** - Variable Waveshape Oscillator. Original code by [Èmilie Gillet / Mutable Instruments](https://github.com/pichenettes/eurorack). Revisited by Ben Sergentanis for the [DaisySP DSP library](https://github.com/electro-smith/DaisySP).
- **VosimOsc** - Vosim oscillator (Two sinewaves multiplied by and sync'ed to a carrier). Original code by [Èmilie Gillet / Mutable Instruments](https://github.com/pichenettes/eurorack). Revisited by Ben Sergentanis for the [DaisySP DSP library](https://github.com/electro-smith/DaisySP).
- **ZOsc** - Sinewave multiplied by and sync'ed to a carrier. Original code by [Èmilie Gillet / Mutable Instruments](https://github.com/pichenettes/eurorack). Revisited by Ben Sergentanis for the [DaisySP DSP library](https://github.com/electro-smith/DaisySP).

## Installation

Expand Down Expand Up @@ -78,6 +100,13 @@ cmake --build . --config Release --target install
This repository includes a script for the Raspberry Pi users (Raspberry Pi OS based) that installs the prerequisites for building (cmake), downloads all of the source code needed and compiles and installs it.


# Contributing
Contributions are welcome! If you experience any problems, post it as an issue or if you have the skills to fix it yourself you may open up a PR with a suggested change. If you see any problems in documentation, feel free to do the same here (please submit a PR if you can - it makes it a lot easier for me).

If you have cool examples of these plugins in use, feel free to send me a code example that I can include in the documentation: mail [a] madskjeldgaard.dk

Thank you!

# Credits
Most of these plugins build on code, research and ideas of others, including:

Expand Down
2 changes: 1 addition & 1 deletion plugins/AnalogBassDrum/AnalogBassDrum.schelp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CLASS:: AnalogBassDrum
SUMMARY:: Virtual analog 808 bass drum model
RELATED::HelpSource/Overview/MKPlugins
CATEGORIES::UGens>Drums
CATEGORIES::UGens>VirtualAnalog, UGens>Drums

DESCRIPTION::

Expand Down
2 changes: 1 addition & 1 deletion plugins/AnalogSnareDrum/AnalogSnareDrum.schelp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CLASS:: AnalogSnareDrum
SUMMARY:: Virtual analog 808 snare drum model.
RELATED::HelpSource/Overview/MKPlugins
CATEGORIES::UGens>Drums
CATEGORIES::UGens>VirtualAnalog, UGens>Drums

DESCRIPTION::

Expand Down
56 changes: 56 additions & 0 deletions plugins/ChowDSP/AAFilter.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#pragma once

#include "iir.hpp"
#include <vector>

/**
High-order filter to be used for anti-aliasing or anti-imaging.
The template parameter N should be 1/2 the desired filter order.
Currently uses an 2*N-th order Butterworth filter.
@TODO: implement Chebyshev, Elliptic filter options.
*/
template<int N>
class AAFilter
{
public:
AAFilter() = default;

/** Calculate Q values for a Butterworth filter of a given order */
static std::vector<float> calculateButterQs(int order) {
const int lim = int (order / 2);
std::vector<float> Qs;

for(int k = 1; k <= lim; ++k) {
auto b = -2.0f * std::cos((2.0f * k + order - 1) * 3.14159 / (2.0f * order));
Qs.push_back(1.0f / b);
}

std::reverse(Qs.begin(), Qs.end());
return Qs;
}

/**
* Resets the filter to process at a new sample rate.
*
* @param sampleRate: The base (i.e. pre-oversampling) sample rate of the audio being processed
* @param osRatio: The oversampling ratio at which the filter is being used
*/
void reset(float sampleRate, int osRatio) {
float fc = 0.98f * (sampleRate / 2.0f);
auto Qs = calculateButterQs(2*N);

for(int i = 0; i < N; ++i)
filters[i].setParameters(BiquadFilter::Type::LOWPASS, fc / (osRatio * sampleRate), Qs[i], 1.0f);
}

inline float process(float x) noexcept {
for(int i = 0; i < N; ++i)
x = filters[i].process(x);

return x;
}

private:
BiquadFilter filters[N];
};
Loading

0 comments on commit 2ca051d

Please sign in to comment.