Skip to content

Commit

Permalink
Increase attack ramp up to 99 samples
Browse files Browse the repository at this point in the history
  • Loading branch information
KilledByAPixel authored May 8, 2020
1 parent 756be31 commit b178be3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions ZzFX.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ BuildSamples
const modPhase = sign(modulation) * PI2/4
let startFrequency = frequency *=
(1 + random(randomness)) * PI2 / sampleRate;
attack = 50 + attack * sampleRate | 0;
attack = 99 + attack * sampleRate | 0;
sustain = sustain * sampleRate | 0;
release = release * sampleRate | 0;
delay = delay * sampleRate | 0;
Expand Down Expand Up @@ -369,7 +369,7 @@ let zzfxP = // play a sound
) =>
{
// init parameters
attack = 50 + attack * sampleRate | 0;
attack = 99 + attack * sampleRate | 0;
sustain = sustain * sampleRate | 0;
release = release * sampleRate | 0;
delay = delay * sampleRate | 0;
Expand Down
2 changes: 1 addition & 1 deletion ZzFX.micro.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// ZzFXMicro - Zuper Zmall Zound Zynth
zzfxV=.3 // volume
zzfx= // play sound
(I=1,J=.05,g=220,f=0,h=0,m=.1,n=0,K=1,r=0,z=0,t=0,A=0,u=0,B=0,v=0,L=0,e=0,d=2*Math.PI,b=44100,w=p=>2*p*Math.random()-p,C=p=>0<p?1:-1,M=r*=500*d/b**2,D=g*=(1+w(J))*d/b,N=C(v)*d/4,q=[],E=0,F=0,c=0,k=1,G=0,H=0,a=0,O,l,x,y=zzfxX.createBufferSource())=>{f=50+f*b|0;h=h*b|0;m=m*b|0;e=e*b|0;z*=500*d/b**3;l=f+h+m+e;v*=d/b;t*=d/b;A*=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?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=C(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(B),F+=1+w(B),g+=r+=z,k&&++k>A&&(D+=t,g+=t,k=0),u&&++G>u&&(g=D,r=M,G=1,k=k||1);x=zzfxX.createBuffer(1,q.length,b);x.getChannelData(0).set(q);y.buffer=x;y.connect(zzfxX.destination);y.start()}
(I=1,J=.05,g=220,f=0,h=0,m=.1,n=0,K=1,r=0,z=0,t=0,A=0,u=0,B=0,v=0,L=0,e=0,d=2*Math.PI,b=44100,w=p=>2*p*Math.random()-p,C=p=>0<p?1:-1,M=r*=500*d/b**2,D=g*=(1+w(J))*d/b,N=C(v)*d/4,q=[],E=0,F=0,c=0,k=1,G=0,H=0,a=0,O,l,x,y=zzfxX.createBufferSource())=>{f=99+f*b|0;h=h*b|0;m=m*b|0;e=e*b|0;z*=500*d/b**3;l=f+h+m+e;v*=d/b;t*=d/b;A*=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?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=C(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(B),F+=1+w(B),g+=r+=z,k&&++k>A&&(D+=t,g+=t,k=0),u&&++G>u&&(g=D,r=M,G=1,k=k||1);x=zzfxX.createBuffer(1,q.length,b);x.getChannelData(0).set(q);y.buffer=x;y.connect(zzfxX.destination);y.start()}
zzfxX=new AudioContext

// fix compatibility issues with old web audio (optional)
Expand Down
2 changes: 1 addition & 1 deletion ZzFX.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
ZzFX © <a href=http://www.frankforce.com target=_blank>Frank Force</a> 2019 ☮♥☻␌
<a hidden id=a_downloadLink></a>
<input hidden id=input_importFile type=file accept=.txt>
<script src=ZzFX.js?895></script>
<script src=ZzFX.js?897></script>
<script>

'use strict'; // strict mode
Expand Down

0 comments on commit b178be3

Please sign in to comment.