Skip to content

Instantly share code, notes, and snippets.

View jpcima's full-sized avatar

JP Cimalando jpcima

View GitHub Profile
@jpcima
jpcima / response.py
Created January 31, 2021 10:42
Tool for drawing frequency response of various interpolators, windowed sinc and polynomial
#!/usr/bin/env python
import numpy as np
from scipy.signal import *
from scipy.fft import *
import matplotlib.pyplot as plt
import matplotlib.ticker as plticker
import matplotlib.figure as plfigure
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk
import sys
import("stdfaust.lib");
//--- for tabulating intervals ---//
// calculate a tabulated function of normalized range [0;1] with interpolation
lookup(fn, start, end, size) = lut(0, fn, start, end, size).lookup_itp;
// calculate a tabulated function of normalized range [0;1] without interpolation
fastlookup(fn, start, end, size) = lut(0, fn, start, end, size).lookup_direct;
// calculate a tabulated function of range [start;end] with interpolation
eval(fn, start, end, size) = lut(0, fn, start, end, size).eval_itp;
import("stdfaust.lib");
numkeys = 88;
depth = hslider("[1] Depth", 1, 0, 1, 0.01);
pitches(i) = hslider("[%n] Resonance frequency %j [unit:Hz]", 1, 0, 22000, 1) with { n = i*10+100; j = i+1; };
feedbacks(i) = hslider("[%n] Resonance feedback %j", 0, 0, 1, 0.001) with { n = i*10+101; j = i+1; };
bandwidths(i) = hslider("[%n] Bandwidth %j [unit:Hz]", 1, 0, 10, 0.01) with { n = i*10+102; j = i+1; };
gains(i) = hslider("[%n] Gain %j", 0, 0, 1, 0.01) with { n = i*10+103; j = i+1; };
diff --git a/src/sfizz/Messaging.h b/src/sfizz/Messaging.h
index 737fa1d4..7e5fc082 100644
--- a/src/sfizz/Messaging.h
+++ b/src/sfizz/Messaging.h
@@ -28,4 +28,29 @@ inline void Client::receive(int delay, const char* path, const char* sig, const
receive_(data_, delay, path, sig, args);
}
+///
+template <unsigned MaxArguments = 16> class BasicMessageBuffer;
@jpcima
jpcima / xfade.gp
Last active October 1, 2020 12:54
Parametric crossfade curves
set mxtics 2
set mytics 2
set grid mxtics mytics
set key top center
set xrange [0:1]
set yrange [0:1]
fadePowS(k, x) = (x<0.5) ? ((1-(2*x)**k)/2+.5) : (((1-2*(x-.5))**k)/2)
k=3
@jpcima
jpcima / drops.diff
Last active September 29, 2020 17:19
diff --git a/Makefile b/Makefile
index 4de8329..ebd06bb 100644
--- a/Makefile
+++ b/Makefile
@@ -7,6 +7,10 @@
include dpf/Makefile.base.mk
all: dgl plugins gen
+clean: sfizz-clean
+plugins: sfizz-lib
diff --git a/plugins/MIDICCMapX4/PluginMIDICCMapX4.cpp b/plugins/MIDICCMapX4/PluginMIDICCMapX4.cpp
index 6dbe08f..545e8bb 100644
--- a/plugins/MIDICCMapX4/PluginMIDICCMapX4.cpp
+++ b/plugins/MIDICCMapX4/PluginMIDICCMapX4.cpp
@@ -25,6 +25,7 @@
*/
#include "PluginMIDICCMapX4.hpp"
+#include <algorithm>
// Figure 3.18: 1-pole TPT lowpass filter with resolved zero-delay feedback
g = hslider("Parameter g", 0., 0., 1., 0.01);
process(x) = out with {
G = g/(1+g); // gain term
/* the signal that enters the recursive structure (after multiplier)
as a function of z1 the output of the delay box */
xIn(memZ1) = (x-memZ1)*G;
import("stdfaust.lib");
disto(depth, tone, x) = x : toneLpf(toneCutoff) : dist : fi.dcblockerat(5.0) with {
// low pass filter
toneCutoff = 21+tone*1.08;
toneLpf(f) = fi.iir((1.-p), (0.-p)) with { p = exp(-2.*ma.PI*f/ma.SR) : si.smoo; };
// distortion
dist(x) = shs*hh(x)+(1.0-shs)*lh(x);
diff --git a/ir.cc b/ir.cc
index b279af7..7ef8b19 100644
--- a/ir.cc
+++ b/ir.cc
@@ -231,6 +231,7 @@ static int load_sndfile(IR * ir) {
int length = 0;
int offset = 0;
+ int start = 0;
float * buff;