Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

zzfx

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zzfx - npm Package Compare versions

Comparing version 1.1.5 to 1.1.6

3

package.json
{
"name": "zzfx",
"version": "1.1.5",
"version": "1.1.6",
"description": "A Tiny JavaScript Sound FX System",

@@ -18,2 +18,3 @@ "main": "ZzFX.js",

"soundsynth",
"synth",
"audio",

@@ -20,0 +21,0 @@ "tinycode",

# ZzFX - Zuper Zmall Zound Zynth
# [ZzFX Sound Designer](https://killedbyapixel.github.io/ZzFX)
# [ZzFX Music](https://keithclark.github.io/ZzFXM/)
# [ZzFX Sound Board Demo](https://codepen.io/KilledByAPixel/full/BaowKzv)
## [ZzFX Sound Designer](https://killedbyapixel.github.io/ZzFX) / [ZzFX Music](https://keithclark.github.io/ZzFXM/) / [ZzFX Sound Board Demo](https://codepen.io/KilledByAPixel/full/BaowKzv)
### ZzFX is a JavaScript sound effect engine and creation tool
## ZzFX Features
- Sound effects can be generated or manually created using the web based sound designer.
- Just include ZzFX.js to load ZzFX, it does not need to be initialized.
- Or you can use ZzFX.micro.js a tiny (<1k) version that has only the ability to play sounds.
- Tiny synth engine with 20 controllable parameters.
- Play sounds via code, no need for sound asset files.
- Compatible with nearly all web browsers.
- Small code footprint, the micro version is under 1 kilobyte uncompressed.
- Can produce a large variety of sound effect types.
- Sounds can be played with a short function call. zzfx(...[,,,,.1,,,,9])
- No additional libraries or dependencies are required.
- Open source with MIT license, you can use this for anything!
To play a sound in code, just call a simple function! Here are some examples...
# How to Use
* Download from github or use `npm install zzfx`
* Import ZZFX as a module with using `import {ZZFX, zzfx} from './ZzFX.js'` or paste the code from [ZzFXMicro.min.js](https://github.com/KilledByAPixel/ZzFX/blob/master/ZzFXMicro.min.js)
* To play a sound just call zzfx(), something like `zzfx(...[,,,,.1,,,,9])`
* Use [the ZzFX sound designer web app](https://killedbyapixel.github.io/ZzFX) to create new sounds.
Here are a few more examples examples...
```

@@ -22,24 +32,4 @@ zzfx(...[,,925,.04,.3,.6,1,.3,,6.27,-184,.09,.17]); // Game Over

### Here is all the code you need to play ZzFX sounds!
```
zzfxV=.3 // volume
zzfx= // play sound - ZzFXMicro - Zuper Zmall Zound Zynth - v1.1.3
(p=1,k=.05,b=220,e=0,r=0,t=.1,q=0,D=1,u=0,y=0,v=0,z=0,l=0,E=0,A=0,F=0,c=0,w=1,m=0,B=0)=>{let M=Math,R=44100,d=2*M.PI,G=u*=500*d/R/R,C=b*=(1-k+2*k*M.random(k=[]))*d/R,g=0,H=0,a=0,n=1,I=0,J=0,f=0,x,h;e=R*e+9;m*=R;r*=R;t*=R;c*=R;y*=500*d/R**3;A*=d/R;v*=d/R;z*=R;l=R*l|0;for(h=e+m+r+t+c|0;a<h;k[a++]=f)++J%(100*F|0)||(f=q?1<q?2<q?3<q?M.sin((g%d)**3):M.max(M.min(M.tan(g),1),-1):1-(2*g/d%2+2)%2:1-4*M.abs(M.round(g/d)-g/d):M.sin(g),f=(l?1-B+B*M.sin(d*a/l):1)*(0<f?1:-1)*M.abs(f)**D*p*zzfxV*(a<e?a/e:a<e+m?1-(a-e)/m*(1-w):a<e+m+r?w:a<h-c?(h-a-c)/t*w:0),f=c?f/2+(c>a?0:(a<h-c?1:(h-a)/c)*k[a-c|0]/2):f),x=(b+=u+=y)*M.cos(A*H++),g+=x-x*E*(1-1E9*(M.sin(a)+1)%2),n&&++n>z&&(b+=v,C+=v,n=0),!l||++I%l||(b=C,u=G,n=n||1);p=zzfxX.createBuffer(1,h,R);p.getChannelData(0).set(k);b=zzfxX.createBufferSource();b.buffer=p;b.connect(zzfxX.destination);b.start();return b}
zzfxX=new(window.AudioContext||webkitAudioContext) // audio context
```
![ZzFX Image](/screenshot.jpg)
## ZzFX Features
- Tiny synth engine with 20 controllable parameters.
- Play sounds via code, no need for sound asset files.
- Compatible with nearly all web browsers.
- Small code footprint, the micro version is under 1 kilobyte uncompressed.
- Can produce a large variety of sound effect types.
- Sounds can be played with a short function call. zzfx(...[,,,,.1,,,,9])
- No additional libraries or dependencies are required.
- Open source with MIT license, you can use this for anything!
## ZzFX Music

@@ -46,0 +36,0 @@

// wav.js by Frank Force 2020 - https://github.com/KilledByAPixel/ZzFX
export function GetWavBlob(sampleChannels, sampleRate = 44100)
export function buildWavBlob(sampleChannels, sampleRate = 44100)
{

@@ -5,0 +5,0 @@ // adapted from https://gist.github.com/asanoboy/3979747

/*
ZzFX - Zuper Zmall Zound Zynth v1.1.5
ZzFX - Zuper Zmall Zound Zynth v1.1.6
By Frank Force 2019

@@ -50,3 +50,3 @@ https://github.com/KilledByAPixel/ZzFX

// play a zzfx sound
export function zzfx(...parameters) { return ZZFX.Play(...parameters) }
export function zzfx(...parameters) { return ZZFX.play(...parameters) }

@@ -66,10 +66,10 @@ // zzfx object with some extra functionalty

// play a sound from zzfx paramerters
Play: function(...parameters)
play: function(...parameters)
{
// build samples and start sound
return this.PlaySamples(this.BuildSamples(...parameters));
return this.playSamples(this.buildSamples(...parameters));
},
// play an array of samples
PlaySamples: function(samples)
playSamples: function(samples)
{

@@ -88,3 +88,3 @@ // play an array of audio samples

// build an array of samples
BuildSamples: function
buildSamples: function
(

@@ -190,3 +190,3 @@ volume = 1,

// get frequency of a musical note on a diatonic scale
GetNote: function(semitoneOffset=0, rootNoteFrequency=440)
getNote: function(semitoneOffset=0, rootNoteFrequency=440)
{

@@ -193,0 +193,0 @@ return rootNoteFrequency * 2**(semitoneOffset/12);

@@ -14,3 +14,3 @@ // ZzFX - Zuper Zmall Zound Zynth - Micro Edition

// ZzFXMicro - Zuper Zmall Zound Zynth - v1.1.5
// ZzFXMicro - Zuper Zmall Zound Zynth - v1.1.6

@@ -17,0 +17,0 @@ // ==ClosureCompiler==

@@ -12,3 +12,3 @@ // ZzFX - Zuper Zmall Zound Zynth - Micro Edition

// ZzFXMicro - Zuper Zmall Zound Zynth - v1.1.5
// ZzFXMicro - Zuper Zmall Zound Zynth - v1.1.6
zzfxV=.3 // volume

@@ -15,0 +15,0 @@ zzfx= // play sound

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc