Skip to content

Commit 2ca051d

Browse files
Merge branch 'chow2'
2 parents 5fea79a + c529cf2 commit 2ca051d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3145
-63
lines changed

CMakeLists.txt

Lines changed: 166 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
cmake_minimum_required(VERSION 3.5)
1010
set(project_name "MKPlugins")
1111
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake_modules ${CMAKE_MODULE_PATH})
12-
set(CMAKE_CXX_STANDARD 14)
12+
13+
# Eigen seems to prefer 17
14+
set(CMAKE_CXX_STANDARD 17)
1315

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

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

73+
# Exclude / include certain experimental / work in progress plugins
74+
option(INCPULSE "Include AnalogPulseShaper plugin" OFF)
75+
option(INCWERNER "Include Werner plugin" OFF)
76+
option(INCPHASORMODAL "Include PhasorModal plugin" ON)
77+
7178
####################################################################################################
7279
# include libraries
7380

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

86+
####################################################################################################
87+
# DAISYSP LIBRARY
88+
####################################################################################################
89+
90+
# DaisySP library
91+
add_subdirectory(DaisySP)
92+
93+
# Link plugin with DaisySP library
94+
function(sc_link_with_daisy plugin_name)
95+
message(STATUS "Linking ${plugin_name} with DaisySP library")
96+
if(SCSYNTH)
97+
include_directories("${plugin_name}_scsynth" DaisySP/Source)
98+
target_link_libraries("${plugin_name}_scsynth" DaisySP )
99+
endif()
100+
101+
if(SUPERNOVA)
102+
include_directories("${plugin_name}_supernova" DaisySP/Source)
103+
target_link_libraries("${plugin_name}_supernova" DaisySP )
104+
endif()
105+
endfunction()
106+
107+
####################################################################################################
108+
# EIGEN LIBRARY
109+
####################################################################################################
110+
111+
if(INCWERNER)
112+
# Eigen library
113+
add_subdirectory(eigen)
114+
endif(INCWERNER)
115+
116+
# Link plugin with eigen library
117+
function(sc_link_with_eigen plugin_name)
118+
message(STATUS "Linking ${plugin_name} with eigen library")
119+
if(SCSYNTH)
120+
include_directories("${plugin_name}_scsynth" eigen/Eigen)
121+
target_link_libraries("${plugin_name}_scsynth" eigen )
122+
endif()
123+
124+
if(SUPERNOVA)
125+
include_directories("${plugin_name}_supernova" eigen/Eigen)
126+
target_link_libraries("${plugin_name}_supernova" eigen )
127+
endif()
128+
endfunction()
129+
130+
131+
79132
####################################################################################################
80133
# Plugins
81134
####################################################################################################
@@ -133,31 +186,6 @@ sc_add_server_plugin(
133186
"${Chen_sc_files}"
134187
"${Chen_schelp_files}"
135188
)
136-
137-
####################################################################################################
138-
# DAISYSP LIBRARY
139-
####################################################################################################
140-
141-
# DaisySP library
142-
add_subdirectory(DaisySP)
143-
144-
# Link plugin with DaisySP library
145-
function(sc_link_with_daisy plugin_name)
146-
message(STATUS "Linking ${plugin_name} with DaisySP library")
147-
if(SCSYNTH)
148-
include_directories("${plugin_name}_scsynth" DaisySP/Source)
149-
target_link_libraries("${plugin_name}_scsynth" DaisySP )
150-
endif()
151-
152-
if(SUPERNOVA)
153-
include_directories("${plugin_name}_supernova" DaisySP/Source)
154-
target_link_libraries("${plugin_name}_supernova" DaisySP )
155-
endif()
156-
endfunction()
157-
158-
####################################################################################################
159-
# END PLUGIN TARGET DEFINITION
160-
####################################################################################################
161189
# Rongs
162190
set(Rongs_cpp_files
163191
plugins/Rongs/Rongs.hpp
@@ -533,3 +561,115 @@ sc_add_server_plugin(
533561
"${AnalogPhaserMod_schelp_files}"
534562
)
535563

564+
if(INCPHASORMODAL)
565+
# PhasorModal
566+
set(PhasorModal_cpp_files
567+
plugins/ChowDSP/PhasorModal.hpp
568+
plugins/ChowDSP/PhasorModal.cpp
569+
)
570+
set(PhasorModal_sc_files
571+
plugins/ChowDSP/PhasorModal.sc
572+
)
573+
set(PhasorModal_schelp_files
574+
plugins/ChowDSP/PhasorModal.schelp
575+
)
576+
577+
sc_add_server_plugin(
578+
"${project_name}" # destination directory
579+
"PhasorModal" # target name
580+
"${PhasorModal_cpp_files}"
581+
"${PhasorModal_sc_files}"
582+
"${PhasorModal_schelp_files}"
583+
)
584+
endif(INCPHASORMODAL)
585+
586+
if(INCPULSE)
587+
# AnalogPulseShaper
588+
set(AnalogPulseShaper_cpp_files
589+
plugins/ChowDSP/AnalogPulseShaper.hpp
590+
plugins/ChowDSP/AnalogPulseShaper.cpp
591+
)
592+
set(AnalogPulseShaper_sc_files
593+
plugins/ChowDSP/AnalogPulseShaper.sc
594+
)
595+
set(AnalogPulseShaper_schelp_files
596+
plugins/ChowDSP/AnalogPulseShaper.schelp
597+
)
598+
599+
sc_add_server_plugin(
600+
"${project_name}" # destination directory
601+
"AnalogPulseShaper" # target name
602+
"${AnalogPulseShaper_cpp_files}"
603+
"${AnalogPulseShaper_sc_files}"
604+
"${AnalogPulseShaper_schelp_files}"
605+
)
606+
endif(INCPULSE)
607+
608+
# AnalogTape
609+
set(AnalogTape_cpp_files
610+
plugins/ChowDSP/AnalogTape.hpp
611+
plugins/ChowDSP/AnalogTape.cpp
612+
# plugins/ChowDSP/HysteresisProcessing.hpp
613+
# plugins/ChowDSP/HysteresisProcessing.cpp
614+
)
615+
set(AnalogTape_sc_files
616+
plugins/ChowDSP/AnalogTape.sc
617+
)
618+
set(AnalogTape_schelp_files
619+
plugins/ChowDSP/AnalogTape.schelp
620+
)
621+
622+
sc_add_server_plugin(
623+
"${project_name}" # destination directory
624+
"AnalogTape" # target name
625+
"${AnalogTape_cpp_files}"
626+
"${AnalogTape_sc_files}"
627+
"${AnalogTape_schelp_files}"
628+
)
629+
630+
# target_link_libraries("AnalogTape_scsynth" plugins/ChowDSP/HysteresisProcessing.hpp plugins/ChowDSP/HysteresisProcessing.cpp)
631+
# target_link_libraries("AnalogTape_supernova" plugins/ChowDSP/HysteresisProcessing.hpp plugins/ChowDSP/HysteresisProcessing.cpp)
632+
633+
if(INCWERNER)
634+
# Werner
635+
set(Werner_cpp_files
636+
plugins/ChowDSP/Werner.hpp
637+
plugins/ChowDSP/Werner.cpp
638+
)
639+
set(Werner_sc_files
640+
plugins/ChowDSP/Werner.sc
641+
)
642+
set(Werner_schelp_files
643+
plugins/ChowDSP/Werner.schelp
644+
)
645+
646+
sc_add_server_plugin(
647+
"${project_name}" # destination directory
648+
"Werner" # target name
649+
"${Werner_cpp_files}"
650+
"${Werner_sc_files}"
651+
"${Werner_schelp_files}"
652+
)
653+
sc_link_with_eigen("Werner")
654+
endif(INCWERNER)
655+
656+
# AnalogVintageDistortion
657+
set(AnalogVintageDistortion_cpp_files
658+
plugins/ChowDSP/AnalogVintageDistortion.hpp
659+
plugins/ChowDSP/AnalogVintageDistortion.cpp
660+
)
661+
set(AnalogVintageDistortion_sc_files
662+
plugins/ChowDSP/AnalogVintageDistortion.sc
663+
)
664+
set(AnalogVintageDistortion_schelp_files
665+
plugins/ChowDSP/AnalogVintageDistortion.schelp
666+
)
667+
668+
sc_add_server_plugin(
669+
"${project_name}" # destination directory
670+
"AnalogVintageDistortion" # target name
671+
"${AnalogVintageDistortion_cpp_files}"
672+
"${AnalogVintageDistortion_sc_files}"
673+
"${AnalogVintageDistortion_schelp_files}"
674+
)
675+

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,29 @@ Most of these are algorithms that I felt like exploring more in-depth at a C++ l
88

99
## Included plugins
1010

11+
12+
- **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).
13+
- **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).
14+
- **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).
15+
- **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).
16+
- **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).
17+
- **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).
18+
- **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).
19+
- **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).
20+
- **DCompressor** - Compressor from [DaisySP DSP library](https://github.com/electro-smith/DaisySP), ported from faust originally by shensley andAvAars originally.
21+
- **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).
22+
- **LPG** - Virtual analog Buchla Lowpass-gate based on the work of Julian Parker and Stefano D'angelo.
23+
- **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).
24+
- **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).
25+
- **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).
26+
- **PhasorModal** - Ported from [Jatin Chowdhury's ChowDSP-VCV-rack project](https://github.com/jatinchowdhury18/ChowDSP-VCV).
27+
- **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).
28+
- **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).
1129
See the overview helpfile [MKPlugins](/plugins/HelpSource/Overview/MKPlugins.schelp) for more information which plugins are included.
30+
- **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).
31+
- **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).
32+
- **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).
33+
- **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).
1234

1335
## Installation
1436

@@ -78,6 +100,13 @@ cmake --build . --config Release --target install
78100
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.
79101

80102

103+
# Contributing
104+
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).
105+
106+
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
107+
108+
Thank you!
109+
81110
# Credits
82111
Most of these plugins build on code, research and ideas of others, including:
83112

plugins/AnalogBassDrum/AnalogBassDrum.schelp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CLASS:: AnalogBassDrum
22
SUMMARY:: Virtual analog 808 bass drum model
33
RELATED::HelpSource/Overview/MKPlugins
4-
CATEGORIES::UGens>Drums
4+
CATEGORIES::UGens>VirtualAnalog, UGens>Drums
55

66
DESCRIPTION::
77

plugins/AnalogSnareDrum/AnalogSnareDrum.schelp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CLASS:: AnalogSnareDrum
22
SUMMARY:: Virtual analog 808 snare drum model.
33
RELATED::HelpSource/Overview/MKPlugins
4-
CATEGORIES::UGens>Drums
4+
CATEGORIES::UGens>VirtualAnalog, UGens>Drums
55

66
DESCRIPTION::
77

plugins/ChowDSP/AAFilter.hpp

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#pragma once
2+
3+
#include "iir.hpp"
4+
#include <vector>
5+
6+
/**
7+
High-order filter to be used for anti-aliasing or anti-imaging.
8+
The template parameter N should be 1/2 the desired filter order.
9+
10+
Currently uses an 2*N-th order Butterworth filter.
11+
@TODO: implement Chebyshev, Elliptic filter options.
12+
*/
13+
template<int N>
14+
class AAFilter
15+
{
16+
public:
17+
AAFilter() = default;
18+
19+
/** Calculate Q values for a Butterworth filter of a given order */
20+
static std::vector<float> calculateButterQs(int order) {
21+
const int lim = int (order / 2);
22+
std::vector<float> Qs;
23+
24+
for(int k = 1; k <= lim; ++k) {
25+
auto b = -2.0f * std::cos((2.0f * k + order - 1) * 3.14159 / (2.0f * order));
26+
Qs.push_back(1.0f / b);
27+
}
28+
29+
std::reverse(Qs.begin(), Qs.end());
30+
return Qs;
31+
}
32+
33+
/**
34+
* Resets the filter to process at a new sample rate.
35+
*
36+
* @param sampleRate: The base (i.e. pre-oversampling) sample rate of the audio being processed
37+
* @param osRatio: The oversampling ratio at which the filter is being used
38+
*/
39+
void reset(float sampleRate, int osRatio) {
40+
float fc = 0.98f * (sampleRate / 2.0f);
41+
auto Qs = calculateButterQs(2*N);
42+
43+
for(int i = 0; i < N; ++i)
44+
filters[i].setParameters(BiquadFilter::Type::LOWPASS, fc / (osRatio * sampleRate), Qs[i], 1.0f);
45+
}
46+
47+
inline float process(float x) noexcept {
48+
for(int i = 0; i < N; ++i)
49+
x = filters[i].process(x);
50+
51+
return x;
52+
}
53+
54+
private:
55+
BiquadFilter filters[N];
56+
};

0 commit comments

Comments
 (0)