xem / ZzFX

Zuper Zmall Zound Zynth

Home Page:https://zzfx.3d2k.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ZzFX - Zuper Zmall Zound Zynth

ZzFX is a JavaScript sound effect engine and creation tool supported by most modern broswers.

Sound effects can be generated or manually created using the web based sound effect creation tool.

Include ZzFX.min.js to load ZzFX, it does not need to be italized.

Or you can use ZzFX.micro.js a tiny version that has only the ability to play sounds.

To play a sound in code, just call a simple function! Here are some examples...

zzfx(...[,,537,.02,.02,.22,1,1.59,-6.98,4.97]); // Heart
zzfx(...[,,925,.04,.3,.6,1,.3,,6.27,-184,.09,.17]); // Game Over
zzfx(...[,,539,,.04,.29,1,1.92,,,567,.02,.02,,,,.04]); // Twinkle
zzfx(...[,0,1600,.13,.52,.61,1,1.1,,,,,,.1,,.14]); // Phone Ring
zzfx(...[,,709,,,.07,,,,3.7,,,,3.6,,,.11]); // Echo Click
zzfx(...[1.5,.8,270,,.1,,1,1.5,,,,,,,,.1,.01]); // Piano
zzfx(...[,,129,.01,,.15,,,,,,,,5]); // Drum

Here's the code for the ZzFXmicro, this all you need to play ZzFX sounds!

zzfxV=.3 // volume
zzfx=    // play sound
(I=1,J=.05,g=220,f=0,h=0,m=.1,n=0,K=1,r=0,A=0,t=0,B=0,u=0,C=0,v=0,L=0,e=0,d=2*Math.PI,b=44100,w=p=>2*p*Math.random()-p,x=p=>0<p?1:-1,M=r*=500*d/b**2,D=g*=(1+w(J))*d/b,N=x(v)*d/4,q=[],E=0,F=0,c=0,k=1,G=0,H=0,a=0,l,y,z=zzfxX.createBufferSource())=>{f=50+f*b|0;h=h*b|0;m=m*b|0;e=e*b|0;A*=500*d/b**3;l=f+h+m+e;v*=d/b;t*=d/b;B*=b;for(u*=b;c<l;q[c++]=a)++H>100*L&&(H=0,a=E*g*Math.sin(F*v-N),a=n?1<n?2<n?3<n?x(Math.sin((a%d)**3)):Math.max(Math.min(Math.tan(a),1),-1):1-(2*a/d%2+2)%2:1-4*Math.abs(Math.round(a/d)-a/d):Math.sin(a),a=x(a)*Math.abs(a)**K,a*=I*zzfxV*(c<f?c/f:c<f+h?1:c<l-e?1-(c-f-h)/m:0),a=e?a/2+(e>c?0:(c<l-e?1:(c-l)/e)*q[c-e]/2):a),E+=1+w(C),F+=1+w(C),g+=r+=A,k&&++k>B&&(D+=t,g+=t,k=0),u&&++G>u&&(g=D,r=M,G=1,k=k||1);y=zzfxX.createBuffer(1,q.length,b);y.getChannelData(0).set(q);z.buffer=y;z.connect(zzfxX.destination);z.start()};zzfxX=new AudioContext

ZzFX Features

  • Tiny synth engine with 17 controllable parameters.
  • Play sounds via code, no need for wave files!
  • Compatible with nearly all web browsers.
  • Small code footprint, the micro version is under 1 kilobyte!
  • Can produce a huge variety of sound effect types.
  • Sounds can be played with a short call. zzfx(...[,,,,.1,,,,9])
  • Sounds can be played with a short function call.
  • Use ZZFX.GetNote to get frequencies on a standard diatonic scale.
  • Sounds can be saved out as wav files for offline playback.
  • Both ZzFX and ZzFXMicro run in strict mode.
  • No additional libraries or dependencies are required.
  • Open source with MIT license, you can use this for anything!

ZzFX UI Features

  • Generates random sounds from presets.
  • Sound list is saved automatically.
  • Each parameter can be modified with constraints.
  • Lock and mutate buttons for each parameter.
  • Sound name can be changed for easier workflow.
  • Shortens code for zzfx sound calls.
  • Displays image of sound wave when played.
  • Sounds can be download as a wave file.
  • Sounds can be marked as favorites to prevent removal.
  • Sounds can be loaded by pasting zzfx code for easy sharing.
  • List of sounds can be exported and imported.
  • Supports drag-and-drop of exported files into sound list.

Games Using ZzFX

ZzFX Image

About

Zuper Zmall Zound Zynth

https://zzfx.3d2k.com

License:Other


Languages

Language:JavaScript 100.0%