From 46983ec4c6bd1ea883af34d9aa193525ae70b348 Mon Sep 17 00:00:00 2001 From: Frank Force Date: Wed, 17 Jun 2020 11:46:20 -0500 Subject: [PATCH] fix micro --- ZzFX.js | 4 ++-- ZzFX.micro.js | 3 +-- index.html | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ZzFX.js b/ZzFX.js index aa1cc6d..aa7c60c 100644 --- a/ZzFX.js +++ b/ZzFX.js @@ -357,7 +357,8 @@ const zzfxP = // play a sound repeatTime = repeatTimeIn * sampleRate, length = attack + decay + sustain + release + delay, b=[], t=0, tm=0, i=0, j=1, r=0, c=0, s=0, d=.5, - source = zzfxX.createBufferSource() + source = zzfxX.createBufferSource(), + buffer = zzfxX.createBuffer(1, length, sampleRate) )=> { // generate waveform @@ -414,7 +415,6 @@ const zzfxP = // play a sound } } - buffer = zzfxX.createBuffer(1, b.length, sampleRate); buffer.getChannelData(0).set(b); source.buffer = buffer; source.connect(zzfxX.destination); diff --git a/ZzFX.micro.js b/ZzFX.micro.js index 2e49009..3a808f2 100644 --- a/ZzFX.micro.js +++ b/ZzFX.micro.js @@ -12,8 +12,7 @@ // ZzFXMicro - Zuper Zmall Zound Zynth zzfxV=.3 // volume zzfx= // play sound -(H=1,I=.05,g=220,J=0,K=0,L=.1,l=0,M=1,q=0,N=0,O=0,P=0,Q=0,v=0,w=0,R=0,S=0,r=1,T=0,d=2*Math.PI,b=44100,t=m=>2*m*Math.random()-m,x=m=>0{for(;c100*R&&(G=0,a=D*g*Math.sin(E*X-V),a=l?1c?0:(cY&&(g+=B,y+=B,k=0),C&&++F>C&&(g=y,q=U,F=1,k=k||1);buffer=zzfxX.createBuffer(1,p.length,b);buffer.getChannelData(0).set(p);u.buffer=buffer;u.connect(zzfxX.destination);u.start()} -zzfxX=new AudioContext +(t=1,a=.05,n=220,e=0,f=0,z=.1,h=0,M=1,r=0,o=0,s=0,x=0,i=0,c=0,u=0,d=0,X=0,b=1,m=0,B=2*Math.PI,C=44100,P=t=>2*t*Math.random()-t,V=t=>0{for(;J100*d&&(N=0,O=G*n*Math.sin(H*p-l),O=V(O=h?1J?0:(Jv&&(n+=q,w+=q,K=0),y&&++L>y&&(n=w,r=g,L=1,K=K||1);T.getChannelData(0).set(F),R.buffer=T,R.connect(zzfxX.destination),R.start()},zzfxX=new AudioContext // fix compatibility issues with old web audio (optional) // if this is used, you must remove the zzfxX=new AudioContext line above! diff --git a/index.html b/index.html index f655457..b9489d8 100644 --- a/index.html +++ b/index.html @@ -138,7 +138,7 @@ ZzFX © Frank Force 2019 ☮♥☻␌ - +