Comparing version 1.2.0 to 1.2.1
{ | ||
"name": "zzfx", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "A Tiny JavaScript Sound FX System", | ||
@@ -5,0 +5,0 @@ "main": "ZzFX.js", |
@@ -54,3 +54,3 @@ # ZzFX - Zuper Zmall Zound Zynth | ||
```javascript | ||
// ZzFXMicro - Zuper Zmall Zound Zynth - v1.2.0 by Frank Force ~ 880 bytes | ||
// ZzFXMicro - Zuper Zmall Zound Zynth - v1.2.1 by Frank Force ~ 880 bytes | ||
zzfxV=.3 // volume | ||
@@ -66,3 +66,3 @@ zzfx= // play sound | ||
(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||=1);p=zzfxX. | ||
(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. | ||
@@ -129,2 +129,2 @@ buffer=p;b.connect(zzfxX.destination);b.start();return b};zzfxX=new AudioContext; | ||
![ZzFX Image](/favicon.png) | ||
![ZzFX Image](/icon.png) |
27
wav.js
@@ -5,3 +5,2 @@ // wav.js by Frank Force - https://github.com/KilledByAPixel/ZzFX | ||
{ | ||
// adapted from https://gist.github.com/asanoboy/3979747 | ||
const channelCount = sampleChannels.length; | ||
@@ -14,3 +13,3 @@ const sampleCount = sampleChannels[0].length; | ||
// wave header | ||
// wave header adapted from https://gist.github.com/asanoboy/3979747 | ||
buffer[ 0] = 0x4952; // RI | ||
@@ -41,25 +40,11 @@ buffer[ 1] = 0x4646; // FF | ||
// copy samples to buffer | ||
for (let i = 0; i < sampleCount; i++) | ||
for (let j = 0; j < channelCount; j++) | ||
for (let j = channelCount; j--;) | ||
for (let i = sampleCount; i--;) | ||
{ | ||
const s = sampleChannels[j][i]; | ||
buffer[i*channelCount + j + 23] = s>=1 ? (1<<15) - 1 : (s * (1<<15) | 0); | ||
buffer[i*channelCount + j + 23] = s<1 ? (s * (1<<15) | 0) : (1<<15) - 1; | ||
} | ||
// build the blob | ||
let end = 0; | ||
let bufferNeedle = 0; | ||
const blobData = []; | ||
const GetBuffer = (length) => | ||
{ | ||
end = bufferNeedle + length >= buffer.length; | ||
const rt = new Int16Array(end? buffer.length - bufferNeedle : length); | ||
for(let i = 0; i < rt.length; i++) | ||
rt[i] = buffer[i + bufferNeedle]; | ||
bufferNeedle += rt.length; | ||
return rt.buffer; | ||
} | ||
while ( !end ) blobData.push(GetBuffer(1e3)); | ||
return new Blob(blobData, {type:'audio/wav'}); | ||
// return the blob | ||
return new Blob([buffer], {type:'audio/wav'}); | ||
} |
/* | ||
ZzFX - Zuper Zmall Zound Zynth v1.2.0 by Frank Force | ||
ZzFX - Zuper Zmall Zound Zynth v1.2.1 by Frank Force | ||
https://github.com/KilledByAPixel/ZzFX | ||
@@ -175,3 +175,3 @@ | ||
slide = startSlide; // reset slide | ||
j ||= 1; // reset pitch jump time | ||
j = j || 1; // reset pitch jump time | ||
} | ||
@@ -178,0 +178,0 @@ } |
@@ -13,3 +13,3 @@ // ZzFX - Zuper Zmall Zound Zynth - Micro Edition | ||
// ZzFXMicro - Zuper Zmall Zound Zynth - v1.2.0 by Frank Force | ||
// ZzFXMicro - Zuper Zmall Zound Zynth - v1.2.1 by Frank Force | ||
@@ -114,3 +114,3 @@ // ==ClosureCompiler== | ||
slide = startSlide; // reset slide | ||
j ||= 1; // reset pitch jump time | ||
j = j || 1; // reset pitch jump time | ||
} | ||
@@ -117,0 +117,0 @@ } |
@@ -11,3 +11,3 @@ // ZzFX - Zuper Zmall Zound Zynth - Micro Edition | ||
// ZzFXMicro - Zuper Zmall Zound Zynth - v1.2.0 by Frank Force ~ 880 bytes | ||
// ZzFXMicro - Zuper Zmall Zound Zynth - v1.2.1 by Frank Force ~ 880 bytes | ||
zzfxV=.3 // volume | ||
@@ -23,8 +23,4 @@ zzfx= // play sound | ||
(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||=1);p=zzfxX. | ||
(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 AudioContext; | ||
// fix compatibility issues with old web audio (optional) | ||
// if this is used, you must remove the zzfxX=new AudioContext line above! | ||
//zzfxX=new(AudioContext||webkitAudioContext);zzfxX.z=zzfxX.createBufferSource;zzfxX.createBufferSource=(s=zzfxX.z())=>(s.start=s.start||s.noteOn,s) | ||
buffer=p;b.connect(zzfxX.destination);b.start();return b};zzfxX=new AudioContext; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
92986
321