Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: State Variable Filter fast implementation #29

Merged
merged 6 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 25 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,37 @@
# synthlet

## 0.6.0

### Minor Changes

- d9ae8bf: State Variable Filter improvements:

- It uses a better algorithm (by Andrew Simper and Freq Anton Corvest)
- `frequency` is now a a-rate parameter suitable for modulation
- Renamed `resonance` to `Q` to match Web Audio API standard

### Patch Changes

- Updated dependencies [d9ae8bf]
- @synthlet/[email protected]

## 0.5.0

- New chorus @synthlet/chorus

- Updated dependencies
- @synthlet/[email protected]
- @synthlet/[email protected]

## 0.4.0

- New @synthlet/arp package
- New arpeggiator @synthlet/arp package

## 0.3.0

- New reverb @synthlet/dattorro-reverb
- Function `registerSynthlet` renamed to `registerAllWorklets`

- Initial release of:
- @synthlet/[email protected]

## 0.2.0

- Initial release of the following modules:
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Collection of synth modules implemented as AudioWorklets.
import {
registerAllWorklets,
AdsrAmp,
StateVariableFilter,
StateVariableFilterType,
Svf,
SvfType,
PolyblepOscillator
} from "synthlet";

Expand All @@ -18,8 +18,8 @@ await registerAllWorklets(ac);

// Simplest synth: Oscillator -> Filter -> Amplifier
const osc = PolyblepOscillator(ac, { frequency: 440 });
const filter = StateVariableFilter(ac, {
type: StateVariableFilterType.LowPass
const filter = Svf(ac, {
type: SvfType.LowPass
frequency: 4000,
});
const amp = AdsrAmp(ac, { attack: 0.1, release: 0.5 });
Expand Down Expand Up @@ -84,7 +84,6 @@ This library wouldn't be possible with all the people writing books, blog posts
- https://github.com/BillyDM/awesome-audio-dsp
- https://paulbatchelor.github.io/sndkit/algos/
- https://www.musicdsp.org/
- [Cytomic technical papers](https://cytomic.com/technical-papers/) specially famous for its [State Variable Filters](https://cytomic.com/files/dsp/SvfLinearTrapOptimised2.pdf)
- [Signalsmith Audio blog](https://signalsmith-audio.co.uk/writing/)
- [Valhalla DSP Blog](https://valhalladsp.com/category/learn/plugin-design-learn/)
- http://synthworks.eu/ - DIY Synthetizers
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"test": "jest --coverage",
"test:ci": "npm run api && npm run build && npm run test",
"processors": "find ./packages -name 'processor.ts' -exec wc -m {} +",
"bump": "changeset version && npm run publish:prepare",
"publish:prepare": "cp README.md packages/synthlet && cp packages/synthlet/CHANGELOG.md CHANGELOG.md"
},
"packageManager": "[email protected]"
Expand Down
8 changes: 8 additions & 0 deletions packages/state-variable-filter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @synthlet/state-variable-filter

## 0.2.0

- State Variable Filter improvements:

- It uses a better algorithm (by Andrew Simper and Freq Anton Corvest)
- `frequency` is now a a-rate parameter suitable for modulation
- Renamed `resonance` to `Q` to match Web Audio API standard

## 0.1.0

- Initial release
Expand Down
2 changes: 1 addition & 1 deletion packages/state-variable-filter/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@synthlet/state-variable-filter",
"version": "0.1.0",
"version": "0.2.0",
"description": "State Variable Filter module for synthlet",
"keywords": [
"modular",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,50 +27,50 @@ Float32Array [

exports[`SVFilter filters the signal 2`] = `
Float32Array [
-7.058988571166992,
-96.1963882446289,
-933.3245239257812,
-7950.83740234375,
-63193.6796875,
-481030.5,
-3555095.5,
-25716442,
-183016032,
-1285889280,
-8941918208,
-61654106112,
-422081658880,
-2872091344896,
-19441708433408,
-131008733118464,
-879299460595712,
-5880895244337152,
-39209108632502270,
-260680291251650560,
-1,
1,
-1,
1,
-1,
1,
-1,
1,
-1,
1,
-1,
1,
-1,
1,
-1,
1,
-1,
1,
-1,
1,
]
`;

exports[`SVFilter filters the signal 3`] = `
Float32Array [
-1728730658831859700,
-11437933590730506000,
-75519349223376030000,
-497665280641740050000,
-3.2738075880989456e+21,
-2.150135330517005e+22,
-1.4100311966854957e+23,
-9.233990443912205e+23,
-6.03935217634656e+24,
-3.9452060773814655e+25,
-2.574315262255496e+26,
-1.6780219466165328e+27,
-1.0927115680685831e+28,
-7.109042947525591e+28,
-4.621019964675439e+29,
-3.001284075478557e+30,
-1.9477740115635436e+31,
-1.263136567931854e+32,
-8.18576013175832e+32,
-5.3012721012231e+33,
29.75,
9.75,
3.608224830031759e-15,
8.326672684688674e-17,
2.7755575615628914e-17,
2.7755575615628914e-17,
2.7755575615628914e-17,
2.7755575615628914e-17,
2.7755575615628914e-17,
2.7755575615628914e-17,
2.7755575615628914e-17,
2.7755575615628914e-17,
2.7755575615628914e-17,
2.7755575615628914e-17,
2.7755575615628914e-17,
2.7755575615628914e-17,
2.7755575615628914e-17,
2.7755575615628914e-17,
2.7755575615628914e-17,
2.7755575615628914e-17,
]
`;
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ exports[`ProcessorNode has parameter descriptors 1`] = `
{
"automationRate": "k-rate",
"defaultValue": 1,
"maxValue": 3,
"maxValue": 10,
"minValue": 0,
"name": "type",
},
{
"automationRate": "k-rate",
"automationRate": "a-rate",
"defaultValue": 1000,
"maxValue": 20000,
"minValue": 20,
"name": "frequency",
},
{
"automationRate": "k-rate",
"defaultValue": 1,
"defaultValue": 0.5,
"maxValue": 40,
"minValue": 0,
"name": "resonance",
"minValue": 0.025,
"name": "Q",
},
]
`;
Loading
Loading