Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
7fcd629
Fix bug where read index in digitaldelay causes out of range buffer read
abaga129 May 8, 2019
91110ac
add MovingFilter class to envelopes
abaga129 Jun 8, 2019
e6edb58
switch to log10 instead of ln for decibel conversions
abaga129 Jun 10, 2019
dc33499
update to dplug v9
abaga129 Sep 30, 2019
27cf908
Fix #20. ModDelay now uses template parameters correctly
abaga129 Oct 11, 2019
2811884
Add more unittests to test instantiation of various classes. Closes #21
abaga129 Oct 11, 2019
6e3c754
Merge pull request #22 from abaga129/master
abaga129 Oct 11, 2019
2c4f5d5
Merge branch 'master' of https://www.github.com/ctrecordings/ddsp int…
abaga129 Oct 11, 2019
5523141
Merge pull request #24 from abaga129/master
abaga129 Oct 11, 2019
65c5d6e
Fix failing CI build
abaga129 Oct 11, 2019
84edc3c
Merge pull request #26 from abaga129/master
abaga129 Oct 11, 2019
22ed255
removed time.d and wave.d
hernameisyin Oct 14, 2019
02b9c7b
Merge pull request #30 from kirschstern/master
abaga129 Oct 14, 2019
66dba8e
improve memory handling in digital delay to work with larger sample r…
abaga129 Oct 25, 2019
44edb81
Merge pull request #31 from abaga129/master
abaga129 Oct 25, 2019
45922ae
add reset function to envelope
Nov 15, 2019
41fe5c9
Merge branch 'master' of github.com:ctrecordings/Ddsp
Nov 15, 2019
942a33e
add onepole lowpass and highpass filters
abaga129 Jan 17, 2020
f66c26b
add onepole module to filter package
abaga129 Jan 17, 2020
6033c0f
begin implementing nth order butterworth
abaga129 Jan 17, 2020
c2cc821
finished Nth order butterworth filter
abaga129 Jan 18, 2020
cdcb056
Merge pull request #32 from ctrecordings/butterworth-nth-order
abaga129 Jan 25, 2020
e6f08f1
convert biquad to Direct Form II and make allpass inherit from biquad…
Jan 25, 2020
bcb8273
add functions to LR filters to check if they have been initialized al…
Feb 28, 2020
5f232c6
Add nth order butterworth and linkwitz-riley filters. #35
Oct 19, 2020
6167277
Merge pull request #37 from abaga129/master
abaga129 Oct 19, 2020
7aefb80
implement 1st order and nth order allpass filters. #36
Oct 19, 2020
5c1f895
Merge pull request #39 from abaga129/master
abaga129 Oct 19, 2020
446ab9d
Set up CI with Azure Pipelines
abaga129 Oct 20, 2020
af3fc82
Merge pull request #40 from ctrecordings/azure-pipelines
abaga129 Oct 20, 2020
88c1645
add status badge for azure pipelines
Oct 20, 2020
7190dfd
Merge pull request #41 from abaga129/master
abaga129 Oct 20, 2020
08baa6e
upgrade to use dplug v10
Jan 12, 2021
b6e40e8
Merge branch 'master' of github.com:ctrecordings/Ddsp
Jan 15, 2021
51b9330
fix very important error in envelope follower time calculations
abaga129 Mar 9, 2021
f6c935b
fixed nan error in RMS detector
abaga129 Mar 9, 2021
ffbc0fc
prevent negative delay amount in mod delay
abaga129 Mar 16, 2021
facdee0
Upgrade to work with dplug v12
Nov 20, 2021
af47d35
Fix #42
Nov 20, 2021
8d18ec9
Fix small issue when inheriting from Compressor
Dec 4, 2021
bd2ddde
upgrade to dplug v13
abaga129 Dec 11, 2022
64d1a91
upgraded to dplug 13
abaga129 Oct 7, 2023
24f73ae
Merge pull request #54 from abaga129/master
abaga129 Oct 7, 2023
81cb6bc
add disclaimer about no longer being used
abaga129 Oct 17, 2023
2a7ca85
Merge pull request #55 from abaga129/master
abaga129 Oct 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ os:

d:
- ldc-1.8.0
- dmd-beta
- ldc-1.17.0
- dmd-2.075.0
- dmd-2.072.1

Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
# Ddsp [![Build Status](https://travis-ci.org/ctrecordings/Ddsp.svg?branch=master)](https://travis-ci.org/ctrecordings/Ddsp) [![Dub version](https://img.shields.io/dub/v/ddsp.svg)](https://code.dlang.org/packages/ddsp)
# Ddsp [![Build Status](https://travis-ci.org/ctrecordings/Ddsp.svg?branch=master)](https://travis-ci.org/ctrecordings/Ddsp) [![Build Status](https://cutthroughrecordings.visualstudio.com/Ddsp/_apis/build/status/ctrecordings.Ddsp?branchName=master)](https://cutthroughrecordings.visualstudio.com/Ddsp/_build/latest?definitionId=2&branchName=master) [![Dub version](https://img.shields.io/dub/v/ddsp.svg)](https://code.dlang.org/packages/ddsp)
A high level library for Digital Signal Processing in D with a focus on audio.

I am not an expert on DSP by any means. Most of the designs for these plugins are ones that I have found and compiled from various books and websites.
I have many people to thank for doing the math and work that makes it possible for someone like me to implement and use these complex equations.
Many of these effects are based on designs from [Designing Audio Effect Plug-Ins in C++](http://www.willpirkle.com/about/books/)
Another important source is [MusicDSP.org](http://www.musicdsp.org)

# Disclaimer
**This package is no longer actively maintained and should only be used as a reference.**

I've personally pivoted to using `Faust` as the backend for any plugins I develop and intend to eventually replace all of the Ddsp code I use with it. The main reason is that Faust has a massive library of functions that I could never hope to replicate. Faust is also highly efficient and quick to develop with since it is designed specifically for signal processing.

If you are interested in seeing how to use Faust as the backend for a Dplug plugin, see [Dplug Faust Example](https://github.com/ctrecordings/dplug-faust-example)

## Sub-Packages

### ddsp:util
Expand Down
44 changes: 44 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml

trigger:
- '*'

pool:
vmImage: 'ubuntu-latest'

jobs:
- job: Linux
pool:
vmImage: 'ubuntu-16.04'
steps:
- checkout: self
fetchDepth: 1

# Install libx11-dev package, ldc, dub, dplug-build
- script: |
# exit as soon as any line in the bash script fails
set -ex

# There is no permissions in default directory for system changes, so make sure to cd ..
cd ..

# Install libs
sudo apt-get -yq install libx11-dev

# Install compiler
curl -fsS https://dlang.org/install.sh | bash -s ldc-1.17.0 -a
~/dlang/install.sh list
source ~/dlang/ldc-1.17.0/activate
ldc2 --version
dub --version

displayName: Install

- script: |
source ~/dlang/ldc-1.17.0/activate
dub test
displayName: Build and Run unit tests

2 changes: 1 addition & 1 deletion dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@
}
],
"dependencies": {
"dplug:core": ">=8.0.0 <9.0.0"
"dplug:core": ">=13.0.0 <14.0.0"
}
}
12 changes: 11 additions & 1 deletion effect/ddsp/effect/compressor.d
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ nothrow:
return input * calcCompressorGain(detectorValue, _threshold, _ratio, _kneeWidth);
}

private:
protected:

/// If set to true, ratio will become infinite and result in limiting
bool _limit;
Expand Down Expand Up @@ -71,6 +71,11 @@ private:
}
}

unittest
{
Compressor!float compressor = new Compressor!float();
}

/// Basic look-ahead limiter that is based on the compressor from before.
class Limiter(T) : Compressor!T
{
Expand Down Expand Up @@ -113,3 +118,8 @@ private:
/// Current amount of lookahead being used in samples.
float _lookAheadAmount;
}

unittest
{
Limiter!float limiter = new Limiter!float();
}
15 changes: 12 additions & 3 deletions effect/ddsp/effect/digitaldelay.d
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ module ddsp.effect.digitaldelay;
import ddsp.effect.effect;
import ddsp.util.functions;

import dplug.core.nogc;

/**
* A general purpose Digital Delay with support for external feedback,
fractional delay, and feedback path effects.
Expand All @@ -28,7 +30,7 @@ public:
_mix = 0.0f;
_useExternalFeedback = false;

_readIndex = 0;
_readIndex = 1;
_writeIndex = 0;

feedbackFX = makeVec!(AudioEffect!T);
Expand All @@ -42,12 +44,12 @@ public:
_sampleRate = sampleRate;
_feedback = 0;
_mix = 0;
_size = cast(uint)sampleRate * 2;
_size = cast(uint)sampleRate + 1;

if(buffer != null)
free(buffer);

buffer = cast(float*) malloc(_size * float.sizeof);
buffer = cast(float*) mallocSlice!float(_size);
reset();
}

Expand All @@ -57,6 +59,8 @@ public:
_delayInSamples = msToSamples(msDelay, _sampleRate);
if(_delayInSamples > _size)
{
_size = cast(size_t)_delayInSamples + 1;
resizeOnNextReset = true;
reset();
}
else
Expand Down Expand Up @@ -116,6 +120,10 @@ public:
//set all elements in the buffer to 0, and reset indices.
override void reset() nothrow @nogc
{
if(resizeOnNextReset) {
resizeOnNextReset = false;
buffer = cast(float*) mallocSlice!float(_size);
}
memset(buffer, 0, _size * float.sizeof);

resetIndices();
Expand Down Expand Up @@ -167,6 +175,7 @@ protected:
long _readIndex;

bool _useExternalFeedback;
bool resizeOnNextReset;
float _feedbackIn;

Vec!(AudioEffect!T) feedbackFX;
Expand Down
5 changes: 5 additions & 0 deletions effect/ddsp/effect/dynamics.d
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,9 @@ protected:
float[] x, y;

//DynamicsProcessor _linkedProcessor;
}

unittest
{
DynamicsProcessor!float dynamicsProcessor = new DynamicsProcessor!float();
}
10 changes: 10 additions & 0 deletions effect/ddsp/effect/expander.d
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ private:
}
}

unittest
{
Expander!float expander = new Expander!float();
}

class Gate(T) : Expander!T
{
public:
Expand All @@ -69,4 +74,9 @@ nothrow:
{
_gate = true;
}
}

unittest
{
Gate!float gate = new Gate!float();
}
44 changes: 33 additions & 11 deletions effect/ddsp/effect/moddelay.d
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import ddsp.util.memory;

import std.math;

import std.algorithm : max;

/// General purpose class for Modulated Delay effects. This class is used with
/// contraints on depth, offset, mix, and feedback to create other effects. (Flanger, Chorus, Tremolo, etc)
class ModDelay(T) : AudioEffect!T
Expand All @@ -22,8 +24,8 @@ nothrow:

this()
{
lfo = calloc!WTOscillator.init();
delay = calloc!DigitalDelay.init();
lfo = calloc!(WTOscillator!T).init();
delay = calloc!(DigitalDelay!T).init();
}

override void setSampleRate(float sampleRate)
Expand All @@ -37,7 +39,7 @@ nothrow:
{
float startDelay = _min_delay + _delay_offset;
float lfoOffset = _mod_depth * ((lfoValue + 1) / 2 * (_max_delay - _min_delay)) + _min_delay;
return lfoOffset + startDelay;
return max(lfoOffset + startDelay, 0);
}

/// Must be set before processing audio
Expand Down Expand Up @@ -89,8 +91,13 @@ private:
float _max_delay;
float _min_delay;

WTOscillator lfo;
DigitalDelay delay;
WTOscillator!T lfo;
DigitalDelay!T delay;
}

unittest
{
ModDelay!float modDelay = new ModDelay!float();
}

class Flanger(T) : AudioEffect!T
Expand All @@ -101,7 +108,7 @@ nothrow:

this()
{
_modDelay = calloc!ModDelay.init();
_modDelay = calloc!(ModDelay!T).init();
}

override void setSampleRate(float sampleRate)
Expand All @@ -127,7 +134,12 @@ nothrow:
}

private:
ModDelay _modDelay;
ModDelay!T _modDelay;
}

unittest
{
Flanger!float flanger = new Flanger!float();
}

class Vibrato(T) : AudioEffect!T
Expand All @@ -138,7 +150,7 @@ nothrow:

this()
{
_modDelay = calloc!ModDelay.init();
_modDelay = calloc!(ModDelay!T).init();
}

override void setSampleRate(float sampleRate)
Expand All @@ -164,7 +176,12 @@ nothrow:
}

private:
ModDelay _modDelay;
ModDelay!T _modDelay;
}

unittest
{
Vibrato!float vibrato = new Vibrato!float();
}

class Chorus(T) : AudioEffect!T
Expand All @@ -175,7 +192,7 @@ nothrow:

this()
{
_modDelay = calloc!ModDelay.init();
_modDelay = calloc!(ModDelay!T).init();
}

override void setSampleRate(float sampleRate)
Expand All @@ -201,5 +218,10 @@ nothrow:
}

private:
ModDelay _modDelay;
ModDelay!T _modDelay;
}

unittest
{
Chorus!float chorus = new Chorus!float();
}
Loading