Started some very initial work on a core C API for #sndkit. It is a thin layer on top of my #patchwerk audio graph library that allows one to build up patches in C in a similar fashion to how it has been previously done in higher level languages.
A little boring "hello world" sine wave:
https://git.sr.ht/~pbatch/sndkit/tree/master/item/examples/ex1.c
More info on the core API here:
Naturally, there are already plans to bring this into the #sndkit collection, and to create a #patchwerk node around it for #monolith.
valp1 is a VA one-pole lowpass filter implemented in ANSI C: https://pbat.ch/sndkit/valp1/ using #literateprogramming
It's based on the implementation found in the The Art of VA Filter design by Vadim Zavalishin, a #DSP engineer of native instruments and creator of Reaktor.
I've uploaded a sample of what it sounds like when you use it to filter noise. Because it's only 1-pole, it sounds an awful lot like gain control.
I've also ported it to a #patchwerk node in #monolith. Here's the #runt code used to generate the sound:
patchwerk nodes
0.5 noise
1 1 sine 100 1000 biscale
valp1
"valp1.wav" wavout bdrop
sr 20 * _compute rep
#runt #monolith #patchwerk #dsp #literateprogramming
Working on a linear feedback shift register noise generator based on the NES APU specs found here: https://wiki.nesdev.com/w/index.php/APU_Noise
I've wrapped it into a #patchwerk node called bitnoise, and made a little patch to test it out (audio attached).
Here is the #runt code that generated it:
patchwerk nodes
60 300 1 randi 5000
2 dmetro 0.5 0 maygate 0.1 port 1 20 scale
randi
1 dmetro 0.5 0 maygate bitnoise
0.1 mul
8000 butlp
"test.wav" wavout bdrop
sr 20 * _compute rep
Some impromptu textures using a processed crossfade-looped vocal sample I had laying around, and some just intonation ratios. Written using #runt and #patchwerk via #monolith, with some light processing in #sox for fades.
Code:
patchwerk nodes
"longpad.wav" loadwav 0 regset
2 0 phasor 0 regget trd
2 1.5 * 0 phasor 0 regget trd add
2 16 * 9 / 0 phasor 0 regget trd add
0.5 0 phasor 0 regget trd
0.25 0 phasor 0 regget trd add
1 0 phasor 0 regget trd add
1 5 / 1 sine 0 1 biscale mul
add
-3 ampdb mul
out
30 set_dur
write_wav
#sox #monolith #patchwerk #runt
This algorithm was implemented as a #patchwerk node, wrapped inside of a #runt word.
The entire example patch itself is written in runt code:
patchwerk nodes
"./hclock" load
0 110 4 clock bhold 0 cabset
0 cabget 8 0 tdiv
1 10 / 1 sine 0 0.03 biscale 8 110 4 hclock
0.005 0.005 0.01 tenvx
67 mtof 0.2 bltriangle mul
0 cabget 0.005 0.005 0.01 tenvx
60 mtof 0.2 bltriangle mul
add
0 cabget 8 0 tdiv
1 10 / 1 sine 0 0.03 biscale 8 110 4 hclock
0.005 0.005 0.01 tenvx
74 mtof 0.2 bltriangle mul
add
0 cabget bunhold
"test.wav" wavout bdrop
sr 30 * _compute rep