Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
brummer10 committed Aug 28, 2023
0 parents commit 30cb41c
Show file tree
Hide file tree
Showing 13 changed files with 976 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
*.a
*.d
*.o

*.exe
*.dll
*.dylib
*.so
*.zip

.kdev_include_paths
.kdev4/
.DS_Store

bin/neuralcapture
bin/neuralcapture.exe
bin/neuralcapture-ladspa.*
bin/neuralcapture-dssi.*
bin/neuralcapture-vst.*
bin/neuralcapture.lv2/
build/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "dpf"]
path = dpf
url = https://github.com/DISTRHO/DPF.git
14 changes: 14 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Neural Capture audio effect based on DISTRHO Plugin Framework (DPF)
Copyright (C) 2023 brummer <brummer@web.de>

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
125 changes: 125 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
#!/usr/bin/make -f
# Makefile for DISTRHO Plugins #
# ---------------------------- #
# Created by falkTX, Christopher Arndt, and Patrick Desaulniers
#

# error out if DPF is missing, unless the current rule is 'submodules'
define MISSING_SUBMODULES_ERROR
=============================================================================
DPF library not found in directory 'dpf'.
Please run "make submodules" to clone the missing Git submodules, then retry.
=============================================================================
endef

ifneq ($(MAKECMDGOALS), submodules)
ifeq (,$(wildcard dpf/Makefile.base.mk))
$(info $(MISSING_SUBMODULES_ERROR))
$(error Unable to continue)
else
include dpf/Makefile.base.mk
endif
endif

# --------------------------------------------------------------
# Installation directories

PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
LIBDIR ?= $(PREFIX)/lib
DSSI_DIR ?= $(LIBDIR)/dssi
LADSPA_DIR ?= $(LIBDIR)/ladspa
ifneq ($(MACOS_OR_WINDOWS),true)
LV2_DIR ?= $(LIBDIR)/lv2
VST2_DIR ?= $(LIBDIR)/vst
VST3_DIR ?= $(LIBDIR)/vst3
CLAP_DIR ?= $(LIBDIR)/clap
endif
ifeq ($(MACOS),true)
LV2_DIR ?= /Library/Audio/Plug-Ins/LV2
VST2_DIR ?= /Library/Audio/Plug-Ins/VST
VST3_DIR ?= /Library/Audio/Plug-Ins/VST3
CLAP_DIR ?= /Library/Audio/Plug-Ins/CLAP
endif
ifeq ($(WINDOWS),true)
LV2_DIR ?= $(COMMONPROGRAMFILES)/LV2
VST2_DIR ?= $(COMMONPROGRAMFILES)/VST2
VST3_DIR ?= $(COMMONPROGRAMFILES)/VST3
CLAP_DIR ?= $(COMMONPROGRAMFILES)/CLAP
endif

USER_DSSI_DIR ?= $(HOME)/.dssi
USER_LADSPA_DIR ?= $(HOME)/.ladspa
ifneq ($(MACOS_OR_WINDOWS),true)
USER_LV2_DIR ?= $(HOME)/.lv2
USER_VST2_DIR ?= $(HOME)/.vst
USER_VST3_DIR ?= $(HOME)/.vst3
USER_CLAP_DIR ?= $(HOME)/.clap
endif
ifeq ($(MACOS),true)
USER_LV2_DIR ?= $(HOME)/Library/Audio/Plug-Ins/LV2
USER_VST2_DIR ?= $(HOME)/Library/Audio/Plug-Ins/VST
USER_VST3_DIR ?= $(HOME)/Library/Audio/Plug-Ins/VST3
USER_CLAP_DIR ?= $(HOME)/Library/Audio/Plug-Ins/CLAP
endif
ifeq ($(WINDOWS),true)
USER_LV2_DIR ?= $(APPDATA)/LV2
USER_VST2_DIR ?= $(APPDATA)/VST
USER_VST3_DIR ?= $(APPDATA)/VST3
USER_CLAP_DIR ?= $(APPDATA)/CLAP
endif

export DESTDIR PREFIX BINDIR LIBDIR
export DSSI_DIR LADSPA_DIR LV2_DIR VST2_DIR VST3_DIR CLAP_DIR
export USER_DSSI_DIR USER_LADSPA_DIR USER_LV2_DIR USER_VST2_DIR USER_VST3_DIR USER_CLAP_DIR

# --------------------------------------------------------------
# Targets

all: libs plugins gen

# --------------------------------------------------------------

submodules:
git submodule update --init --recursive

libs:
$(MAKE) -C dpf/dgl ../build/libdgl-cairo.a

plugins: libs
$(MAKE) all -C plugins/NeuralCapture

ifneq ($(CROSS_COMPILING),true)
gen: plugins dpf/utils/lv2_ttl_generator
@dpf/utils/generate-ttl.sh
ifeq ($(MACOS),true)
@dpf/utils/generate-vst-bundles.sh
endif

dpf/utils/lv2_ttl_generator:
$(MAKE) -C dpf/utils/lv2-ttl-generator
else
gen: plugins dpf/utils/lv2_ttl_generator.exe
@dpf/utils/generate-ttl.sh

dpf/utils/lv2_ttl_generator.exe:
$(MAKE) -C dpf/utils/lv2-ttl-generator WINDOWS=true
endif

# --------------------------------------------------------------

clean:
$(MAKE) clean -C dpf/dgl
$(MAKE) clean -C dpf/utils/lv2-ttl-generator
$(MAKE) clean -C plugins/NeuralCapture
rm -rf bin build

install: all
$(MAKE) install -C plugins/NeuralCapture

install-user: all
$(MAKE) install-user -C plugins/NeuralCapture

# --------------------------------------------------------------

.PHONY: all clean install install-user submodules libs plugins gen
106 changes: 106 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Neural Capture

A Neural Capture plug to make the process of cloning external soft/hardware a bit more comfortable

## Formats

All plugins in this collection come in the following plug-in formats:

* [LV2]
* [VST2]
* [VST3]
* [CLAP]

## Compiling

Make sure you have installed the required build tools and libraries (see
section "Prerequisites" below) and then clone this repository (including
sub-modules) and simply run `make` in the project's root directory:

```con
git clone --recursive https://github.com:brummer10/neuralcapture
cd neuralcapture
make
```

## Installation

To install all plugin formats to their appropriate system-wide location, run
the following command (root priviledges may be required):

```con
make install
```

The makefiles support the usual `PREFIX` and `DESTDIR` variables to change the
installation prefix and set an installation root directory (defaulty: empty).
`PREFIX` defaults to `/usr/local`, but on macOS and Windows it is not used,
since the system-wide installation directories for plugins are fixed.

Use make's `-n` option to see where the plugins would be installed without
actually installing them.

You can also set the installation directory for each plugin format with a
dedicated makefile variable.

* LV2: `LV2_DIR` (`<prefix>/lib/lv2`)
* VST2: `VST2_DIR` (`<prefix>/lib/vst`)
* VST3: `VST3_DIR` (`<prefix>/lib/vst3`)
* CLAP: `CLAP_DIR` (`<prefix>/lib/clap`)

Example:

```con
make DESTDIR=/tmp/build-root PREFIX=/usr VST2_DIR=/usr/lib/lxvst install
```

To install the plugins only for your current user account, run:

```con
make install-user
```

Again, you can also set the installation directory for each plugin format with
a dedicated makefile variable.

* LV2: `USER_LV2_DIR` (`$HOME/.lv2`)
* VST2: `USER_VST2_DIR` (`$HOME/.vst`)
* VST3: `USER_VST3_DIR` (`$HOME/.vst3`)
* CLAP: `USER_CLAP_DIR` (`$HOME/.clap`)

*Note: The given default values for all of the above listed environment
variables differ depending on the target OS.*


## Prerequisites

* The GCC C++ compiler, library and the usual associated software build tools
(GNU `make`, etc.).

Debian / Ubuntu users should install the `build-essential` package
to get these, Arch users the `base-devel` package group.

* [pkgconf]

The [LV2] and [VST2] (vestige) headers are included in the
[DPF] framework, which is integrated as a Git sub-module. These need not be
installed separately to build the software in the respective plug-in formats.


## Author

This software was created by *brummer*.


## Acknowledgements

This project is built using the DISTRHO Plugin Framework ([DPF]) and set up
with the [cookiecutter-dpf-effect] project template.


[cookiecutter-dpf-effect]: https://github.com/SpotlightKid/cookiecutter-dpf-effect
[DPF]: https://github.com/DISTRHO/DPF
[LV2]: http://lv2plug.in/
[pkgconf]: https://github.com/pkgconf/pkgconf
[VST2/3]: https://en.wikipedia.org/wiki/Virtual_Studio_Technology
[CLAP]: https://cleveraudio.org/
1 change: 1 addition & 0 deletions dpf
Submodule dpf added at 224133
41 changes: 41 additions & 0 deletions plugins/NeuralCapture/CParamSmooth.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* One-pole LPF for smooth parameter changes
*
* https://www.musicdsp.org/en/latest/Filters/257-1-pole-lpf-for-smooth-parameter-changes.html
*/

#ifndef C_PARAM_SMOOTH_H
#define C_PARAM_SMOOTH_H

#include <math.h>

#define TWO_PI 6.283185307179586476925286766559f

class CParamSmooth {
public:
CParamSmooth(float smoothingTimeMs, float samplingRate)
: t(smoothingTimeMs)
{
setSampleRate(samplingRate);
}

~CParamSmooth() { }

void setSampleRate(float samplingRate) {
if (samplingRate != fs) {
fs = samplingRate;
a = exp(-TWO_PI / (t * 0.001f * samplingRate));
b = 1.0f - a;
z = 0.0f;
}
}

inline float process(float in) {
return z = (in * b) + (z * a);
}
private:
float a, b, t, z;
double fs = 0.0;
};

#endif // #ifndef C_PARAM_SMOOTH_H
32 changes: 32 additions & 0 deletions plugins/NeuralCapture/DistrhoPluginInfo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Neural Capture audio effect based on DISTRHO Plugin Framework (DPF)
*
* SPDX-License-Identifier: GPL-2.0 license
*
* Copyright (C) 2023 brummer <brummer@web.de>
*/

#ifndef DISTRHO_PLUGIN_INFO_H
#define DISTRHO_PLUGIN_INFO_H

#define DISTRHO_PLUGIN_BRAND "MOD"
#define DISTRHO_PLUGIN_NAME "NeuralCapture"
#define DISTRHO_PLUGIN_URI "https://github.com/brummer10/neuralcapture"
#define DISTRHO_PLUGIN_CLAP_ID "com.github.brummer10.neuralcapture"

#define DISTRHO_PLUGIN_HAS_UI 1
#define DISTRHO_UI_USE_NANOVG 0

#define DISTRHO_PLUGIN_IS_RT_SAFE 1
#define DISTRHO_PLUGIN_NUM_INPUTS 2
#define DISTRHO_PLUGIN_NUM_OUTPUTS 2
#define DISTRHO_PLUGIN_WANT_TIMEPOS 0
#define DISTRHO_PLUGIN_WANT_PROGRAMS 1
#define DISTRHO_PLUGIN_WANT_MIDI_INPUT 0
#define DISTRHO_PLUGIN_WANT_MIDI_OUTPUT 0

#define DISTRHO_PLUGIN_LV2_CATEGORY "lv2:AmplifierPlugin"
#define DISTRHO_PLUGIN_VST3_CATEGORIES "Fx|Tools|Stereo"
#define DISTRHO_PLUGIN_CLAP_FEATURES "audio-effect", "utility", "stereo"

#endif // DISTRHO_PLUGIN_INFO_H
Loading

0 comments on commit 30cb41c

Please sign in to comment.