-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
764 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
{ | ||
"name": "synthlet-workspace", | ||
"private": true, | ||
"workspaces": [ | ||
"packages/*" | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export const PROCESSOR = `"use strict";(()=>{function $(){let u=!1;return a=>{if(u===!1&&a>=.9)return u=!0,!0;if(u===!0&&a<.1)return u=!1,!1}}function F(u){let a=Math.exp(-1.5),c=Math.exp(-4.95),i=0,n=0,l=0,f=0,y=0,h=1,g={b:0,c:0},d={b:0,c:0},p={b:0,c:0},P=$(),b=0,t=0;return x(.01,.1,.5,.3),{agen:k,amod:M};function M(e,r,o){k(r,o);for(let s=0;s<r.length;s++)r[s]*=e[s]}function k(e,r){D(r);for(let o=0;o<e.length;o++){switch(b){case 1:t=g.b+t*g.c,(t>=1||i<=0)&&(t=1,b=2);break;case 2:t=d.b+t*d.c,(t<=f||n<=0)&&(t=f,b=3);break;case 3:t=f;break;case 4:t=p.b+t*p.c,(t<=0||l<=0)&&(t=0,b=0)}e[o]=t*h+y}}function D(e){let r=P(e.gate[0]);r===!0?b=1:r===!1&&(b=4),x(e.attack[0],e.decay[0],e.sustain[0],e.release[0]),y=e.offset[0],h=e.gain[0]}function x(e,r,o,s){f!==o&&(f=o,n=r,m(d,n,f,c)),i!==e&&(i=e,m(g,i,1+2*a,a)),n!==r&&(n=r,m(d,n,f,c)),l!==s&&(l=s,m(p,l,0,c))}function m(e,r,o,s){let R=r*u;e.c=Math.exp(-Math.log((1+s)/s)/R),e.b=(o-s)*(1-e.c)}}var A=class extends AudioWorkletProcessor{p;g;r=!0;constructor(a){super(),this.g=a?.processorOptions?.mode!=="Modifier",this.p=F(sampleRate),this.port.onmessage=c=>{switch(c.data.type){case"STOP":this.r=!1;break}}}process(a,c,i){let n=c[0][0],l=a[0][0];return this.g?this.p.agen(n,i):l&&this.p.amod(l,n,i),this.r}static get parameterDescriptors(){return[["gate",0,0,1],["attack",.01,0,1],["decay",.1,0,1],["sustain",.5,0,1],["release",.3,0,1],["offset",0,0,2e4],["gain",1,-2e4,2e4]].map(([a,c,i,n])=>({name:a,defaultValue:c,minValue:i,maxValue:n,automationRate:"k-rate"}))}};registerProcessor("AdsrWorkletProcessor",A);})();`; | ||
export const PROCESSOR = `"use strict";(()=>{function C(){let i=!1;return a=>{if(i===!1&&a>=.9)return i=!0,!0;if(i===!0&&a<.1)return i=!1,!1}}function x(i){let a=Math.exp(-1.5),c=Math.exp(-4.95),u=0,n=0,l=0,f=0,h=0,y=1,g={b:0,c:0},m={b:0,c:0},p={b:0,c:0},D=C(),b=0,t=0;return F(.01,.1,.5,.3),{agen:k,amod:P};function P(e,r,o){k(r,o);for(let s=0;s<r.length;s++)r[s]*=e[s]}function k(e,r){R(r);for(let o=0;o<e.length;o++){switch(b){case 1:t=g.b+t*g.c,(t>=1||u<=0)&&(t=1,b=2);break;case 2:t=m.b+t*m.c,(t<=f||n<=0)&&(t=f,b=3);break;case 3:t=f;break;case 4:t=p.b+t*p.c,(t<=0||l<=0)&&(t=0,b=0)}e[o]=t*y+h}}function R(e){let r=D(e.gate[0]);r===!0?b=1:r===!1&&(b=4),F(e.attack[0],e.decay[0],e.sustain[0],e.release[0]),h=e.offset[0],y=e.gain[0]}function F(e,r,o,s){f!==o&&(f=o,n=r,d(m,n,f,c)),u!==e&&(u=e,d(g,u,1+2*a,a)),n!==r&&(n=r,d(m,n,f,c)),l!==s&&(l=s,d(p,l,0,c))}function d(e,r,o,s){let $=r*i;e.c=Math.exp(-Math.log((1+s)/s)/$),e.b=(o-s)*(1-e.c)}}var A=class extends AudioWorkletProcessor{p;g;r=!0;constructor(a){super(),this.g=a?.processorOptions?.mode!=="modulator",this.p=x(sampleRate),this.port.onmessage=c=>{switch(c.data.type){case"DISCONNECT":this.r=!1;break}}}process(a,c,u){let n=c[0][0],l=a[0][0];return this.g?this.p.agen(n,u):l&&this.p.amod(l,n,u),this.r}static get parameterDescriptors(){return[["gate",0,0,1],["attack",.01,0,1],["decay",.1,0,1],["sustain",.5,0,1],["release",.3,0,1],["offset",0,0,2e4],["gain",1,-2e4,2e4]].map(([a,c,u,n])=>({name:a,defaultValue:c,minValue:u,maxValue:n,automationRate:"k-rate"}))}};registerProcessor("AdsrWorkletProcessor",A);})();`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export const PROCESSOR = `"use strict";(()=>{var e=class extends AudioWorkletProcessor{static parameterDescriptors=[];r;constructor(){super(),this.r=!0,this.port.onmessage=s=>{switch(s.data.type){case"STOP":this.r=!1;break}}}process(s,t,o){for(let r=0;r<t[0][0].length;r++)t[0][0][r]=Math.random()*2-1;return this.r}};registerProcessor("NoiseProcessor",e);})();`; | ||
export const PROCESSOR = `"use strict";(()=>{var e=class extends AudioWorkletProcessor{static parameterDescriptors=[];r;constructor(){super(),this.r=!0,this.port.onmessage=s=>{switch(s.data.type){case"DISCONNECT":this.r=!1;break}}}process(s,t,o){for(let r=0;r<t[0][0].length;r++)t[0][0][r]=Math.random()*2-1;return this.r}};registerProcessor("NoiseWorkletProcessor",e);})();`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,18 @@ | ||
import {} from "@synthlet/adsr"; | ||
import { registerAdsrWorkletOnce } from "@synthlet/adsr"; | ||
import { registerNoiseWorkletOnce } from "@synthlet/noise"; | ||
import { registerWavetableOscillatorWorkletOnce } from "@synthlet/wavetable-oscillator"; | ||
|
||
export { createAdsr, createVca, registerAdsrWorkletOnce } from "@synthlet/adsr"; | ||
export { createWhiteNoise, registerNoiseWorkletOnce } from "@synthlet/noise"; | ||
export { | ||
createWavetableOscillatorNode, | ||
registerWavetableOscillatorWorkletOnce, | ||
} from "@synthlet/wavetable-oscillator"; | ||
|
||
export function registerSynthletOnce(context: AudioContext) { | ||
return Promise.all([ | ||
registerAdsrWorkletOnce(context), | ||
registerNoiseWorkletOnce(context), | ||
registerWavetableOscillatorWorkletOnce(context), | ||
]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# @synthlet/wavetable-oscillator | ||
|
||
## 0.1.0 | ||
|
||
- Initial implementation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# @synthlet/wavetable-oscillator | ||
|
||
> A morphing wavetable oscillator module for [synthlet](https://github.com/danigb/synthlet) | ||
Wavetables are from [WaveEdit Online](https://waveeditonline.com/) | ||
|
||
## Install | ||
|
||
```bash | ||
npm i @synthlet/wavetable-oscillator | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"name": "@synthlet/wavetable-oscillator", | ||
"version": "0.1.0", | ||
"description": "Wavetable Oscillator module for synthlet", | ||
"keywords": [ | ||
"modular", | ||
"synthesizer", | ||
"wavetable", | ||
"oscillator", | ||
"synthlet" | ||
], | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"dist" | ||
], | ||
"author": "[email protected]", | ||
"license": "MIT", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^29.5.11", | ||
"jest": "^29.7.0", | ||
"ts-jest": "^29.1.1" | ||
}, | ||
"jest": { | ||
"preset": "ts-jest" | ||
}, | ||
"scripts": { | ||
"worklet": "esbuild src/worklet.ts --bundle --minify | sed -e 's/^/export const PROCESSOR = \\`/' -e 's/$/\\`;/' > src/processor.ts", | ||
"lib": "tsup src/index.ts --sourcemap --dts --format esm,cjs", | ||
"build": "npm run worklet && npm run lib" | ||
} | ||
} |
Oops, something went wrong.