Skip to content

Instantly share code, notes, and snippets.

View jpcima's full-sized avatar

JP Cimalando jpcima

View GitHub Profile
@jpcima
jpcima / filter1PoleResonant.dsp
Last active May 15, 2021 11:00
Filters 1-pole with faked resonance
import("stdfaust.lib");
///
lp1Reson(cutoff, dbGain, cfSmooth) = lp : peak with {
lp = fi.iir((1-p),(0-p)) with {
p = exp(-2.*ma.PI*cutoff/ma.SR) : cfSmooth;
};
peak = fi.tf22t(b0/a0,b1/a0,b2/a0,a1/a0,a2/a0) with {
w = max(0,cutoff)*(2*ma.PI/ma.SR);
A = 10^(dbGain/40);
@jpcima
jpcima / resonantFilters.dsp
Created May 14, 2021 15:52
Resonant filter 6dB/oct
import("stdfaust.lib");
// modified W. Pirkle half-ladder filter
// extracts LPF1 and LPF2 output to produce resonant 6dB/oct and 12dB/oct
declare modifiedHalfLadder author "Jean Pierre Cimalando, Eric Tarr";
declare modifiedHalfLadder license "MIT-style STK-4.3 license";
modifiedHalfLadder(freq/*normFreq*/,Q) = _ <: (s1,s2,s3,/*y*/lpf1, lpf2) : !,!,!,_,_
letrec{
's1 = -(s3*B3*k):-(s2*B2*k):-(s1*B1*k):*(alpha0):-(s1):*(alpha*2):+(s1);
's2 = -(s3*B3*k):-(s2*B2*k):-(s1*B1*k):*(alpha0):-(s1):*(alpha):+(s1):-(s2):*(alpha*2):+(s2);
#define STB_IMAGE_WRITE_IMPLEMENTATION 1
#include "stb_image_write.h"
#include <algorithm>
#include <random>
#include <cmath>
#include <cstdio>
#include <cstdint>
class BristolPRNG;
class fast_rand;
## convert audio to data points
## > sox file.wav file.dat
set term svg size 1200,400 ## output to SVG with given size
set output "file.svg" ## set output file
set multiplot layout 2,1 ## set a layout in 2 rows
unset xtics ## removes the X-axis
unset ytics ## removes the Y-axis
unset key ## removes the legend
@jpcima
jpcima / example.sfz
Created May 2, 2021 10:48
Generated sfz sequences
//----------------------------------------------------------------------------//
// Kinwie 1st example
<global>
loop_mode=one_shot
key=60
seq_length=2
//human voice count
<group> seq_position=1
diff --git a/plugins/vst/SfizzVstEvents.h b/plugins/vst/SfizzVstEvents.h
new file mode 100644
index 00000000..1c915e70
--- /dev/null
+++ b/plugins/vst/SfizzVstEvents.h
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: BSD-2-Clause
+
+// This code is part of the sfizz library and is licensed under a BSD 2-clause
+// license. You should have receive a LICENSE.md file along with the code.
import("stdfaust.lib");
snes_fir(x) = sum(i, 8, in(i) * tap(i)) with {
refSR = 32000; // sample rate of SNES
// the filter inputs
in(0) = x; // at 0 it's the undelayed input sample
// at I, it's the sample at I frames back based on SNES reference rate
EXS file
========
offset type description
----------------------------------------------
0 Header chunk See 'EXS header chunk'
[next] Data chunks Sequence of chunks of any kind except header
EXS header chunk
================
diff --git a/BambooTracker/chip/nuked/ym3438.c b/BambooTracker/chip/nuked/ym3438.c
index d1507ca..cd3d87c 100644
--- a/BambooTracker/chip/nuked/ym3438.c
+++ b/BambooTracker/chip/nuked/ym3438.c
@@ -39,7 +39,7 @@
#include "ym3438.h"
/*OPN-MOD: define the quantization in bits at which channels clip*/
-static const unsigned channel_clipbits = 11; /*YM2612 has 9 bits*/
+static const unsigned channel_clipbits = 13; /*YM2612 has 9 bits*/
@jpcima
jpcima / Bt1-nuked.diff
Created February 17, 2021 21:07
BambooTracker Nuked
diff --git a/BambooTracker/chip/nuked/ym3438.c b/BambooTracker/chip/nuked/ym3438.c
index d1507ca..c2e8b64 100644
--- a/BambooTracker/chip/nuked/ym3438.c
+++ b/BambooTracker/chip/nuked/ym3438.c
@@ -39,7 +39,7 @@
#include "ym3438.h"
/*OPN-MOD: define the quantization in bits at which channels clip*/
-static const unsigned channel_clipbits = 11; /*YM2612 has 9 bits*/
+static const unsigned channel_clipbits = 13; /*YM2612 has 9 bits*/