This commit is contained in:
Felix Roos
2022-05-29 00:52:48 +02:00
parent 8bcaa4496c
commit 89787e1820
90 changed files with 66 additions and 48 deletions
+16
View File
@@ -0,0 +1,16 @@
{
"bd": ["bd/Bassdrum-01.wav","bd/Bassdrum-02.wav","bd/Bassdrum-03.wav","bd/Bassdrum-04.wav","bd/Bassdrum-05.wav","bd/Bassdrum-06.wav","bd/Bassdrum-07.wav","bd/Bassdrum-08.wav","bd/Bassdrum-09.wav","bd/Bassdrum-10.wav","bd/Bassdrum-11.wav","bd/Bassdrum-12.wav","bd/Bassdrum-13.wav","bd/Bassdrum-14.wav"],
"cb": ["cb/Cowbell.wav"],
"cp": ["cp/Clap.wav"],
"cr": ["cr/Crash.wav"],
"hh": ["hh/Hat Closed-01.wav","hh/Hat Closed-02.wav"],
"ht": ["ht/Tom H-01.wav","ht/Tom H-02.wav","ht/Tom H-03.wav","ht/Tom H-04.wav","ht/Tom H-05.wav","ht/Tom H-06.wav"],
"lt": ["lt/Tom L-01.wav","lt/Tom L-02.wav","lt/Tom L-03.wav","lt/Tom L-04.wav","lt/Tom L-05.wav","lt/Tom L-06.wav"],
"misc": ["misc/Metal-01.wav","misc/Metal-02.wav","misc/Metal-03.wav","misc/Scratch.wav","misc/Shot-01.wav","misc/Shot-02.wav","misc/Shot-03.wav"],
"mt": ["mt/Tom M-01.wav","mt/Tom M-02.wav","mt/Tom M-03.wav","mt/Tom M-05.wav"],
"oh": ["oh/Hhopen1.wav"],
"perc": ["perc/Blow1.wav"],
"rd": ["rd/Ride.wav"],
"rim": ["rim/zRim Shot-01.wav","rim/zRim Shot-02.wav"],
"sd": ["sd/Snaredrum-01.wav","sd/Snaredrum-02.wav","sd/Snaredrum-03.wav","sd/Snaredrum-04.wav","sd/Snaredrum-05.wav","sd/Snaredrum-06.wav","sd/Snaredrum-07.wav","sd/Snaredrum-08.wav","sd/Snaredrum-09.wav","sd/Snaredrum-10.wav","sd/Snaredrum-11.wav","sd/Snaredrum-12.wav","sd/Snaredrum-13.wav","sd/Snaredrum-14.wav","sd/Snaredrum-15.wav","sd/Snaredrum-16.wav","sd/Snaredrum-17.wav","sd/Snaredrum-18.wav","sd/Snaredrum-19.wav","sd/Snaredrum-20.wav","sd/Snaredrum-21.wav"]
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
import{J as a}from"./index.00fa9ffe.js";export{a as loadWebDirt};
@@ -1 +1 @@
var x=Object.defineProperty,A=Object.defineProperties;var T=Object.getOwnPropertyDescriptors;var k=Object.getOwnPropertySymbols;var C=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable;var f=(e,t,r)=>t in e?x(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,h=(e,t)=>{for(var r in t||(t={}))C.call(t,r)&&f(e,r,t[r]);if(k)for(var r of k(t))b.call(t,r)&&f(e,r,t[r]);return e},w=(e,t)=>A(e,T(t));var u=(e,t,r)=>(f(e,typeof t!="symbol"?t+"":t,r),r);import{S as N,I as q,F as O}from"./index.cba71bcb.js";const F=e=>"("+e+")();",M=e=>URL.createObjectURL(new Blob([F(e)],{type:"text/javascript"})),R=e=>new Worker(M(e));class S{constructor(t,r,n=this.interval){u(this,"worker");u(this,"audioContext");u(this,"interval",.2);u(this,"lastEnd",0);this.audioContext=t,this.interval=n,this.worker=R(()=>{let i,o=null;const s=()=>{o&&(clearInterval(o),o=null)},a=()=>{if(s(),!i)throw new Error("no interval set! call worker.postMessage({interval}) before starting.");o=setInterval(()=>postMessage("tick"),i*1e3)};self.onmessage=function(l){l.data=="start"?a():l.data.interval?(i=l.data.interval,o&&a()):l.data=="stop"&&s()}}),this.worker.postMessage({interval:n}),this.worker.onmessage=i=>{if(i.data==="tick"){const o=this.lastEnd||this.audioContext.currentTime,s=this.audioContext.currentTime+this.interval;this.lastEnd=s,r(o,s)}}}start(){console.log("start..."),this.audioContext.resume(),this.worker.postMessage("start")}stop(){console.log("stop..."),this.worker.postMessage("stop")}}class j{constructor({audioContext:t,interval:r=.2,onEvent:n}){u(this,"worker");u(this,"pattern");this.worker=new S(t,(i,o)=>{this.pattern.query(new N(new q(i,o))).forEach(s=>{!s.part.begin.equals(s.whole.begin)||(n?n==null||n(s):console.warn("unplayable event: no audio node nor onEvent callback",s))})},r)}start(){if(!this.pattern)throw new Error("Scheduler: no pattern set! call .setPattern first.");this.worker.start()}stop(){this.worker.stop()}setPattern(t){this.pattern=t}}const{Pattern:c,getFrequency:V,patternify2:_}=O;let d;const p=()=>(d||(d=new AudioContext),d),g=.2,I=(e,t,r,n,i,o,s)=>{const a=p().createGain();return a.gain.setValueAtTime(0,o),a.gain.linearRampToValueAtTime(i,o+e),a.gain.linearRampToValueAtTime(r*i,o+e+t),a.gain.setValueAtTime(r*i,s),a.gain.linearRampToValueAtTime(0,s+n),a};c.prototype.withAudioNode=function(e){return this._withHap(t=>t.setContext(w(h({},t.context),{createAudioNode:(r,n)=>{var i,o;return e(r,n,(o=(i=t.context).createAudioNode)==null?void 0:o.call(i,r,t))}})))};c.prototype._wave=function(e){return this.withAudioNode((t,r)=>{const n=p().createOscillator();n.type=e;const i=V(r);n.frequency.value=i;const o=t!=null?t:r.whole.begin.valueOf()+g,s=o+r.duration.valueOf();return n.start(o),n.stop(s),n})};c.prototype.adsr=function(e=.01,t=.05,r=1,n=.01){return this.withAudioNode((i,o,s)=>{var v;const a=((v=o.context)==null?void 0:v.velocity)||1,l=i!=null?i:o.whole.begin.valueOf()+g,m=l+o.duration.valueOf()+g,y=I(e,t,r,n,a,l,m);return s==null||s.connect(y),y})};c.prototype._filter=function(e="lowpass",t=1e3){return this.withAudioNode((r,n,i)=>{const o=p().createBiquadFilter();return o.type=e,o.frequency.value=t,i==null||i.connect(o),o})};c.prototype.filter=function(e,t){return _(c.prototype._filter)(reify(e),reify(t),this)};c.prototype.out=function(){const e=p().createGain();return e.gain.value=.1,e.connect(p().destination),this.withAudioNode((t,r,n)=>{n||console.warn("out: no source! call .osc() first"),n==null||n.connect(e)})._withHap(t=>{const r=(n,i)=>{var o,s;return(s=(o=i.context)==null?void 0:o.createAudioNode)==null?void 0:s.call(o,n,i)};return t.setContext(w(h({},t.context),{onTrigger:r}))})};c.prototype.define("wave",(e,t)=>t.wave(e),{patternified:!0});export{S as ClockWorker,j as Scheduler,p as getAudioContext};
var x=Object.defineProperty,A=Object.defineProperties;var T=Object.getOwnPropertyDescriptors;var k=Object.getOwnPropertySymbols;var C=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable;var f=(e,t,r)=>t in e?x(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,h=(e,t)=>{for(var r in t||(t={}))C.call(t,r)&&f(e,r,t[r]);if(k)for(var r of k(t))b.call(t,r)&&f(e,r,t[r]);return e},w=(e,t)=>A(e,T(t));var u=(e,t,r)=>(f(e,typeof t!="symbol"?t+"":t,r),r);import{S as N,I as q,F as O}from"./index.00fa9ffe.js";const F=e=>"("+e+")();",M=e=>URL.createObjectURL(new Blob([F(e)],{type:"text/javascript"})),R=e=>new Worker(M(e));class S{constructor(t,r,n=this.interval){u(this,"worker");u(this,"audioContext");u(this,"interval",.2);u(this,"lastEnd",0);this.audioContext=t,this.interval=n,this.worker=R(()=>{let i,o=null;const s=()=>{o&&(clearInterval(o),o=null)},a=()=>{if(s(),!i)throw new Error("no interval set! call worker.postMessage({interval}) before starting.");o=setInterval(()=>postMessage("tick"),i*1e3)};self.onmessage=function(l){l.data=="start"?a():l.data.interval?(i=l.data.interval,o&&a()):l.data=="stop"&&s()}}),this.worker.postMessage({interval:n}),this.worker.onmessage=i=>{if(i.data==="tick"){const o=this.lastEnd||this.audioContext.currentTime,s=this.audioContext.currentTime+this.interval;this.lastEnd=s,r(o,s)}}}start(){console.log("start..."),this.audioContext.resume(),this.worker.postMessage("start")}stop(){console.log("stop..."),this.worker.postMessage("stop")}}class j{constructor({audioContext:t,interval:r=.2,onEvent:n}){u(this,"worker");u(this,"pattern");this.worker=new S(t,(i,o)=>{this.pattern.query(new N(new q(i,o))).forEach(s=>{!s.part.begin.equals(s.whole.begin)||(n?n==null||n(s):console.warn("unplayable event: no audio node nor onEvent callback",s))})},r)}start(){if(!this.pattern)throw new Error("Scheduler: no pattern set! call .setPattern first.");this.worker.start()}stop(){this.worker.stop()}setPattern(t){this.pattern=t}}const{Pattern:c,getFrequency:V,patternify2:_}=O;let d;const p=()=>(d||(d=new AudioContext),d),g=.2,I=(e,t,r,n,i,o,s)=>{const a=p().createGain();return a.gain.setValueAtTime(0,o),a.gain.linearRampToValueAtTime(i,o+e),a.gain.linearRampToValueAtTime(r*i,o+e+t),a.gain.setValueAtTime(r*i,s),a.gain.linearRampToValueAtTime(0,s+n),a};c.prototype.withAudioNode=function(e){return this._withHap(t=>t.setContext(w(h({},t.context),{createAudioNode:(r,n)=>{var i,o;return e(r,n,(o=(i=t.context).createAudioNode)==null?void 0:o.call(i,r,t))}})))};c.prototype._wave=function(e){return this.withAudioNode((t,r)=>{const n=p().createOscillator();n.type=e;const i=V(r);n.frequency.value=i;const o=t!=null?t:r.whole.begin.valueOf()+g,s=o+r.duration.valueOf();return n.start(o),n.stop(s),n})};c.prototype.adsr=function(e=.01,t=.05,r=1,n=.01){return this.withAudioNode((i,o,s)=>{var v;const a=((v=o.context)==null?void 0:v.velocity)||1,l=i!=null?i:o.whole.begin.valueOf()+g,m=l+o.duration.valueOf()+g,y=I(e,t,r,n,a,l,m);return s==null||s.connect(y),y})};c.prototype._filter=function(e="lowpass",t=1e3){return this.withAudioNode((r,n,i)=>{const o=p().createBiquadFilter();return o.type=e,o.frequency.value=t,i==null||i.connect(o),o})};c.prototype.filter=function(e,t){return _(c.prototype._filter)(reify(e),reify(t),this)};c.prototype.out=function(){const e=p().createGain();return e.gain.value=.1,e.connect(p().destination),this.withAudioNode((t,r,n)=>{n||console.warn("out: no source! call .osc() first"),n==null||n.connect(e)})._withHap(t=>{const r=(n,i)=>{var o,s;return(s=(o=i.context)==null?void 0:o.createAudioNode)==null?void 0:s.call(o,n,i)};return t.setContext(w(h({},t.context),{onTrigger:r}))})};c.prototype.define("wave",(e,t)=>t.wave(e),{patternified:!0});export{S as ClockWorker,j as Scheduler,p as getAudioContext};
+1
View File
@@ -0,0 +1 @@
import{W as a,G as b}from"./index.00fa9ffe.js";export{a as WebMidi,b as enableWebMidi};
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
var tt=Object.defineProperty,nt=Object.defineProperties;var at=Object.getOwnPropertyDescriptors;var M=Object.getOwnPropertySymbols;var Pe=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable;var Re=(a,f,r)=>f in a?tt(a,f,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[f]=r,H=(a,f)=>{for(var r in f||(f={}))Pe.call(f,r)&&Re(a,r,f[r]);if(M)for(var r of M(f))Oe.call(f,r)&&Re(a,r,f[r]);return a},J=(a,f)=>nt(a,at(f));var qe=(a,f)=>{var r={};for(var $ in a)Pe.call(a,$)&&f.indexOf($)<0&&(r[$]=a[$]);if(a!=null&&M)for(var $ of M(a))f.indexOf($)<0&&Oe.call(a,$)&&(r[$]=a[$]);return r};import{C as it}from"./index.e74aafcc.js";function ft(a,f){function r(){this.constructor=a}r.prototype=f.prototype,a.prototype=new r}function D(a,f,r,$){var l=Error.call(this,a);return Object.setPrototypeOf&&Object.setPrototypeOf(l,D.prototype),l.expected=f,l.found=r,l.location=$,l.name="SyntaxError",l}ft(D,Error);function K(a,f,r){return r=r||" ",a.length>f?a:(f-=a.length,r+=r.repeat(f),a+r.slice(0,f))}D.prototype.format=function(a){var f="Error: "+this.message;if(this.location){var r=null,$;for($=0;$<a.length;$++)if(a[$].source===this.location.source){r=a[$].text.split(/\r\n|\n|\r/g);break}var l=this.location.start,m=this.location.source+":"+l.line+":"+l.column;if(r){var A=this.location.end,w=K("",l.line.toString().length),E=r[l.line-1],d=l.line===A.line?A.column:E.length+1;f+=`
var tt=Object.defineProperty,nt=Object.defineProperties;var at=Object.getOwnPropertyDescriptors;var M=Object.getOwnPropertySymbols;var Pe=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable;var Re=(a,f,r)=>f in a?tt(a,f,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[f]=r,H=(a,f)=>{for(var r in f||(f={}))Pe.call(f,r)&&Re(a,r,f[r]);if(M)for(var r of M(f))Oe.call(f,r)&&Re(a,r,f[r]);return a},J=(a,f)=>nt(a,at(f));var qe=(a,f)=>{var r={};for(var $ in a)Pe.call(a,$)&&f.indexOf($)<0&&(r[$]=a[$]);if(a!=null&&M)for(var $ of M(a))f.indexOf($)<0&&Oe.call(a,$)&&(r[$]=a[$]);return r};import{F as it}from"./index.00fa9ffe.js";function ft(a,f){function r(){this.constructor=a}r.prototype=f.prototype,a.prototype=new r}function D(a,f,r,$){var l=Error.call(this,a);return Object.setPrototypeOf&&Object.setPrototypeOf(l,D.prototype),l.expected=f,l.found=r,l.location=$,l.name="SyntaxError",l}ft(D,Error);function K(a,f,r){return r=r||" ",a.length>f?a:(f-=a.length,r+=r.repeat(f),a+r.slice(0,f))}D.prototype.format=function(a){var f="Error: "+this.message;if(this.location){var r=null,$;for($=0;$<a.length;$++)if(a[$].source===this.location.source){r=a[$].text.split(/\r\n|\n|\r/g);break}var l=this.location.start,m=this.location.source+":"+l.line+":"+l.column;if(r){var A=this.location.end,w=K("",l.line.toString().length),E=r[l.line-1],d=l.line===A.line?A.column:E.length+1;f+=`
--> `+m+`
`+w+` |
`+l.line+" | "+E+`
@@ -1 +1 @@
import{T as e,o as n,a as o,x as t,u as h,y as l,d as p,f as r,g as m,t as y,w as u,k as c,l as d,m as g,b as i,c as f,n as w,q as b,r as k,j as x,h as D,p as v,e as T,s as j,i as q,v as C}from"./index.cba71bcb.js";export{e as Tone,n as adsr,o as amsynth,t as backgroundImage,h as cleanupDraw,l as cleanupUi,p as duosynth,r as fmsynth,m as getDefaultSynth,y as getDrawContext,u as hideHeader,c as highpass,d as lowpass,g as membrane,i as metal,f as monosynth,w as noise,b as osc,k as out,x as piano,D as players,v as pluck,T as polysynth,j as sampler,q as synth,C as vol};
import{T as e,o as n,a as o,x as t,u as h,y as l,d as p,f as r,g as m,t as y,w as u,k as c,l as d,m as g,b as i,c as f,n as w,q as b,r as k,j as x,h as D,p as v,e as T,s as j,i as q,v as C}from"./index.00fa9ffe.js";export{e as Tone,n as adsr,o as amsynth,t as backgroundImage,h as cleanupDraw,l as cleanupUi,p as duosynth,r as fmsynth,m as getDefaultSynth,y as getDrawContext,u as hideHeader,c as highpass,d as lowpass,g as membrane,i as metal,f as monosynth,w as noise,b as osc,k as out,x as piano,D as players,v as pluck,T as polysynth,j as sampler,q as synth,C as vol};
-1
View File
@@ -1 +0,0 @@
import{W as a,G as b}from"./index.cba71bcb.js";export{a as WebMidi,b as enableWebMidi};
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -9,7 +9,7 @@
<!-- TODO: add manifest images -->
<!-- <link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> -->
<title>Strudel REPL</title>
<script type="module" crossorigin src="/assets/index.cba71bcb.js"></script>
<script type="module" crossorigin src="/assets/index.00fa9ffe.js"></script>
<link rel="stylesheet" href="/assets/index.07b34a18.css">
</head>
<body>
@@ -1 +1 @@
import{T as d}from"./index.e74aafcc.js";import{T as A,o as T,a as k,u as E,d as N,f as O,g as I,t as j,k as q,l as x,m as B,b as D,c as F,n as _,q as v,r as C,j as z,h as H,p as S,e as U,s as G,i as J,v as K}from"./index.e74aafcc.js";const f=()=>{document.getElementById("header").style="display:none"};function u(s){window.strudelAnimation&&cancelAnimationFrame(window.strudelAnimation);const a=e=>{const o=d.getTransport().seconds;s(e,o),window.strudelAnimation=requestAnimationFrame(a)};requestAnimationFrame(a)}const g=function(s,a={}){const e=document.getElementById("code"),o="background-image:url("+s+");background-size:contain;";e.style=o;const{className:c}=e,i=(t,n)=>{({style:()=>e.style=o+";"+n,className:()=>e.className=n+" "+c})[t]()},r=Object.entries(a).filter(([t,n])=>typeof n=="function");Object.entries(a).filter(([t,n])=>typeof n=="string").forEach(([t,n])=>i(t,n)),r.length!==0&&u((t,n)=>r.forEach(([l,m])=>{i(l,m(n))}))},h=()=>{const s=document.getElementById("code");s&&(s.style="",s.className="grow relative")};export{A as Tone,T as adsr,k as amsynth,g as backgroundImage,E as cleanupDraw,h as cleanupUi,N as duosynth,O as fmsynth,I as getDefaultSynth,j as getDrawContext,f as hideHeader,q as highpass,x as lowpass,B as membrane,D as metal,F as monosynth,_ as noise,v as osc,C as out,z as piano,H as players,S as pluck,U as polysynth,G as sampler,J as synth,K as vol};
import{T as d}from"./index.d97d3995.js";import{T as A,o as T,a as k,u as E,d as N,f as O,g as I,t as j,k as q,l as x,m as B,b as D,c as F,n as _,q as v,r as C,j as z,h as H,p as S,e as U,s as G,i as J,v as K}from"./index.d97d3995.js";const f=()=>{document.getElementById("header").style="display:none"};function u(s){window.strudelAnimation&&cancelAnimationFrame(window.strudelAnimation);const a=e=>{const o=d.getTransport().seconds;s(e,o),window.strudelAnimation=requestAnimationFrame(a)};requestAnimationFrame(a)}const g=function(s,a={}){const e=document.getElementById("code"),o="background-image:url("+s+");background-size:contain;";e.style=o;const{className:c}=e,i=(t,n)=>{({style:()=>e.style=o+";"+n,className:()=>e.className=n+" "+c})[t]()},r=Object.entries(a).filter(([t,n])=>typeof n=="function");Object.entries(a).filter(([t,n])=>typeof n=="string").forEach(([t,n])=>i(t,n)),r.length!==0&&u((t,n)=>r.forEach(([l,m])=>{i(l,m(n))}))},h=()=>{const s=document.getElementById("code");s&&(s.style="",s.className="grow relative")};export{A as Tone,T as adsr,k as amsynth,g as backgroundImage,E as cleanupDraw,h as cleanupUi,N as duosynth,O as fmsynth,I as getDefaultSynth,j as getDrawContext,f as hideHeader,q as highpass,x as lowpass,B as membrane,D as metal,F as monosynth,_ as noise,v as osc,C as out,z as piano,H as players,S as pluck,U as polysynth,G as sampler,J as synth,K as vol};
@@ -1,4 +1,4 @@
var tt=Object.defineProperty,nt=Object.defineProperties;var at=Object.getOwnPropertyDescriptors;var M=Object.getOwnPropertySymbols;var Pe=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable;var Re=(a,f,r)=>f in a?tt(a,f,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[f]=r,H=(a,f)=>{for(var r in f||(f={}))Pe.call(f,r)&&Re(a,r,f[r]);if(M)for(var r of M(f))Oe.call(f,r)&&Re(a,r,f[r]);return a},J=(a,f)=>nt(a,at(f));var qe=(a,f)=>{var r={};for(var $ in a)Pe.call(a,$)&&f.indexOf($)<0&&(r[$]=a[$]);if(a!=null&&M)for(var $ of M(a))f.indexOf($)<0&&Oe.call(a,$)&&(r[$]=a[$]);return r};import{F as it}from"./index.cba71bcb.js";function ft(a,f){function r(){this.constructor=a}r.prototype=f.prototype,a.prototype=new r}function D(a,f,r,$){var l=Error.call(this,a);return Object.setPrototypeOf&&Object.setPrototypeOf(l,D.prototype),l.expected=f,l.found=r,l.location=$,l.name="SyntaxError",l}ft(D,Error);function K(a,f,r){return r=r||" ",a.length>f?a:(f-=a.length,r+=r.repeat(f),a+r.slice(0,f))}D.prototype.format=function(a){var f="Error: "+this.message;if(this.location){var r=null,$;for($=0;$<a.length;$++)if(a[$].source===this.location.source){r=a[$].text.split(/\r\n|\n|\r/g);break}var l=this.location.start,m=this.location.source+":"+l.line+":"+l.column;if(r){var A=this.location.end,w=K("",l.line.toString().length),E=r[l.line-1],d=l.line===A.line?A.column:E.length+1;f+=`
var tt=Object.defineProperty,nt=Object.defineProperties;var at=Object.getOwnPropertyDescriptors;var M=Object.getOwnPropertySymbols;var Pe=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable;var Re=(a,f,r)=>f in a?tt(a,f,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[f]=r,H=(a,f)=>{for(var r in f||(f={}))Pe.call(f,r)&&Re(a,r,f[r]);if(M)for(var r of M(f))Oe.call(f,r)&&Re(a,r,f[r]);return a},J=(a,f)=>nt(a,at(f));var qe=(a,f)=>{var r={};for(var $ in a)Pe.call(a,$)&&f.indexOf($)<0&&(r[$]=a[$]);if(a!=null&&M)for(var $ of M(a))f.indexOf($)<0&&Oe.call(a,$)&&(r[$]=a[$]);return r};import{C as it}from"./index.d97d3995.js";function ft(a,f){function r(){this.constructor=a}r.prototype=f.prototype,a.prototype=new r}function D(a,f,r,$){var l=Error.call(this,a);return Object.setPrototypeOf&&Object.setPrototypeOf(l,D.prototype),l.expected=f,l.found=r,l.location=$,l.name="SyntaxError",l}ft(D,Error);function K(a,f,r){return r=r||" ",a.length>f?a:(f-=a.length,r+=r.repeat(f),a+r.slice(0,f))}D.prototype.format=function(a){var f="Error: "+this.message;if(this.location){var r=null,$;for($=0;$<a.length;$++)if(a[$].source===this.location.source){r=a[$].text.split(/\r\n|\n|\r/g);break}var l=this.location.start,m=this.location.source+":"+l.line+":"+l.column;if(r){var A=this.location.end,w=K("",l.line.toString().length),E=r[l.line-1],d=l.line===A.line?A.column:E.length+1;f+=`
--> `+m+`
`+w+` |
`+l.line+" | "+E+`
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
import{W as a,D as b}from"./index.d97d3995.js";export{a as WebMidi,b as enableWebMidi};
-1
View File
@@ -1 +0,0 @@
import{W as a,D as b}from"./index.e74aafcc.js";export{a as WebMidi,b as enableWebMidi};
@@ -1 +1 @@
var x=Object.defineProperty,A=Object.defineProperties;var C=Object.getOwnPropertyDescriptors;var k=Object.getOwnPropertySymbols;var T=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable;var f=(e,t,r)=>t in e?x(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,h=(e,t)=>{for(var r in t||(t={}))T.call(t,r)&&f(e,r,t[r]);if(k)for(var r of k(t))b.call(t,r)&&f(e,r,t[r]);return e},w=(e,t)=>A(e,C(t));var u=(e,t,r)=>(f(e,typeof t!="symbol"?t+"":t,r),r);import{S as N,E as q,C as O}from"./index.e74aafcc.js";const M=e=>"("+e+")();",R=e=>URL.createObjectURL(new Blob([M(e)],{type:"text/javascript"})),S=e=>new Worker(R(e));class V{constructor(t,r,n=this.interval){u(this,"worker");u(this,"audioContext");u(this,"interval",.2);u(this,"lastEnd",0);this.audioContext=t,this.interval=n,this.worker=S(()=>{let i,o=null;const s=()=>{o&&(clearInterval(o),o=null)},a=()=>{if(s(),!i)throw new Error("no interval set! call worker.postMessage({interval}) before starting.");o=setInterval(()=>postMessage("tick"),i*1e3)};self.onmessage=function(l){l.data=="start"?a():l.data.interval?(i=l.data.interval,o&&a()):l.data=="stop"&&s()}}),this.worker.postMessage({interval:n}),this.worker.onmessage=i=>{if(i.data==="tick"){const o=this.lastEnd||this.audioContext.currentTime,s=this.audioContext.currentTime+this.interval;this.lastEnd=s,r(o,s)}}}start(){console.log("start..."),this.audioContext.resume(),this.worker.postMessage("start")}stop(){console.log("stop..."),this.worker.postMessage("stop")}}class W{constructor({audioContext:t,interval:r=.2,onEvent:n}){u(this,"worker");u(this,"pattern");this.worker=new V(t,(i,o)=>{this.pattern.query(new N(new q(i,o))).forEach(s=>{!s.part.begin.equals(s.whole.begin)||(n?n==null||n(s):console.warn("unplayable event: no audio node nor onEvent callback",s))})},r)}start(){if(!this.pattern)throw new Error("Scheduler: no pattern set! call .setPattern first.");this.worker.start()}stop(){this.worker.stop()}setPattern(t){this.pattern=t}}const{Pattern:c,getFrequency:_,patternify2:F}=O;let d;const p=()=>(d||(d=new AudioContext),d),g=.2,E=(e,t,r,n,i,o,s)=>{const a=p().createGain();return a.gain.setValueAtTime(0,o),a.gain.linearRampToValueAtTime(i,o+e),a.gain.linearRampToValueAtTime(r*i,o+e+t),a.gain.setValueAtTime(r*i,s),a.gain.linearRampToValueAtTime(0,s+n),a};c.prototype.withAudioNode=function(e){return this._withHap(t=>t.setContext(w(h({},t.context),{createAudioNode:(r,n)=>{var i,o;return e(r,n,(o=(i=t.context).createAudioNode)==null?void 0:o.call(i,r,t))}})))};c.prototype._wave=function(e){return this.withAudioNode((t,r)=>{const n=p().createOscillator();n.type=e;const i=_(r);n.frequency.value=i;const o=t!=null?t:r.whole.begin.valueOf()+g,s=o+r.duration.valueOf();return n.start(o),n.stop(s),n})};c.prototype.adsr=function(e=.01,t=.05,r=1,n=.01){return this.withAudioNode((i,o,s)=>{var v;const a=((v=o.context)==null?void 0:v.velocity)||1,l=i!=null?i:o.whole.begin.valueOf()+g,m=l+o.duration.valueOf()+g,y=E(e,t,r,n,a,l,m);return s==null||s.connect(y),y})};c.prototype._filter=function(e="lowpass",t=1e3){return this.withAudioNode((r,n,i)=>{const o=p().createBiquadFilter();return o.type=e,o.frequency.value=t,i==null||i.connect(o),o})};c.prototype.filter=function(e,t){return F(c.prototype._filter)(reify(e),reify(t),this)};c.prototype.out=function(){const e=p().createGain();return e.gain.value=.1,e.connect(p().destination),this.withAudioNode((t,r,n)=>{n||console.warn("out: no source! call .osc() first"),n==null||n.connect(e)})._withHap(t=>{const r=(n,i)=>{var o,s;return(s=(o=i.context)==null?void 0:o.createAudioNode)==null?void 0:s.call(o,n,i)};return t.setContext(w(h({},t.context),{onTrigger:r}))})};c.prototype.define("wave",(e,t)=>t.wave(e),{patternified:!0});export{V as ClockWorker,W as Scheduler,p as getAudioContext};
var x=Object.defineProperty,A=Object.defineProperties;var C=Object.getOwnPropertyDescriptors;var k=Object.getOwnPropertySymbols;var T=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable;var f=(e,t,r)=>t in e?x(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,h=(e,t)=>{for(var r in t||(t={}))T.call(t,r)&&f(e,r,t[r]);if(k)for(var r of k(t))b.call(t,r)&&f(e,r,t[r]);return e},w=(e,t)=>A(e,C(t));var u=(e,t,r)=>(f(e,typeof t!="symbol"?t+"":t,r),r);import{S as N,E as q,C as O}from"./index.d97d3995.js";const M=e=>"("+e+")();",R=e=>URL.createObjectURL(new Blob([M(e)],{type:"text/javascript"})),S=e=>new Worker(R(e));class V{constructor(t,r,n=this.interval){u(this,"worker");u(this,"audioContext");u(this,"interval",.2);u(this,"lastEnd",0);this.audioContext=t,this.interval=n,this.worker=S(()=>{let i,o=null;const s=()=>{o&&(clearInterval(o),o=null)},a=()=>{if(s(),!i)throw new Error("no interval set! call worker.postMessage({interval}) before starting.");o=setInterval(()=>postMessage("tick"),i*1e3)};self.onmessage=function(l){l.data=="start"?a():l.data.interval?(i=l.data.interval,o&&a()):l.data=="stop"&&s()}}),this.worker.postMessage({interval:n}),this.worker.onmessage=i=>{if(i.data==="tick"){const o=this.lastEnd||this.audioContext.currentTime,s=this.audioContext.currentTime+this.interval;this.lastEnd=s,r(o,s)}}}start(){console.log("start..."),this.audioContext.resume(),this.worker.postMessage("start")}stop(){console.log("stop..."),this.worker.postMessage("stop")}}class W{constructor({audioContext:t,interval:r=.2,onEvent:n}){u(this,"worker");u(this,"pattern");this.worker=new V(t,(i,o)=>{this.pattern.query(new N(new q(i,o))).forEach(s=>{!s.part.begin.equals(s.whole.begin)||(n?n==null||n(s):console.warn("unplayable event: no audio node nor onEvent callback",s))})},r)}start(){if(!this.pattern)throw new Error("Scheduler: no pattern set! call .setPattern first.");this.worker.start()}stop(){this.worker.stop()}setPattern(t){this.pattern=t}}const{Pattern:c,getFrequency:_,patternify2:F}=O;let d;const p=()=>(d||(d=new AudioContext),d),g=.2,E=(e,t,r,n,i,o,s)=>{const a=p().createGain();return a.gain.setValueAtTime(0,o),a.gain.linearRampToValueAtTime(i,o+e),a.gain.linearRampToValueAtTime(r*i,o+e+t),a.gain.setValueAtTime(r*i,s),a.gain.linearRampToValueAtTime(0,s+n),a};c.prototype.withAudioNode=function(e){return this._withHap(t=>t.setContext(w(h({},t.context),{createAudioNode:(r,n)=>{var i,o;return e(r,n,(o=(i=t.context).createAudioNode)==null?void 0:o.call(i,r,t))}})))};c.prototype._wave=function(e){return this.withAudioNode((t,r)=>{const n=p().createOscillator();n.type=e;const i=_(r);n.frequency.value=i;const o=t!=null?t:r.whole.begin.valueOf()+g,s=o+r.duration.valueOf();return n.start(o),n.stop(s),n})};c.prototype.adsr=function(e=.01,t=.05,r=1,n=.01){return this.withAudioNode((i,o,s)=>{var v;const a=((v=o.context)==null?void 0:v.velocity)||1,l=i!=null?i:o.whole.begin.valueOf()+g,m=l+o.duration.valueOf()+g,y=E(e,t,r,n,a,l,m);return s==null||s.connect(y),y})};c.prototype._filter=function(e="lowpass",t=1e3){return this.withAudioNode((r,n,i)=>{const o=p().createBiquadFilter();return o.type=e,o.frequency.value=t,i==null||i.connect(o),o})};c.prototype.filter=function(e,t){return F(c.prototype._filter)(reify(e),reify(t),this)};c.prototype.out=function(){const e=p().createGain();return e.gain.value=.1,e.connect(p().destination),this.withAudioNode((t,r,n)=>{n||console.warn("out: no source! call .osc() first"),n==null||n.connect(e)})._withHap(t=>{const r=(n,i)=>{var o,s;return(s=(o=i.context)==null?void 0:o.createAudioNode)==null?void 0:s.call(o,n,i)};return t.setContext(w(h({},t.context),{onTrigger:r}))})};c.prototype.define("wave",(e,t)=>t.wave(e),{patternified:!0});export{V as ClockWorker,W as Scheduler,p as getAudioContext};
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -9,7 +9,7 @@
<!-- TODO: add manifest images -->
<!-- <link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> -->
<title>Strudel Tutorial</title>
<script type="module" crossorigin src="/tutorial/assets/index.e74aafcc.js"></script>
<script type="module" crossorigin src="/tutorial/assets/index.d97d3995.js"></script>
<link rel="stylesheet" href="/tutorial/assets/index.7cd4ac61.css">
</head>
<body>