cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              function SNDshoot0(i) {
	var n=2e4;
	if (i > n) return null;
	var q = t(i,n);
	return (P(i*50,0.7)&93)?q:-q;
}

function SNDshoot1(i) {
	var n=2e4;
	if (i > n) return null;
	var q = t(i,n);
	return (P(i*50,0.7)&33)?q:-q;
}

function SNDshoot2(i) {
	var n=2e4;
	if (i > n) return null;
	var q = t(i,n);
	return (P(i*50,0.8)&34)?q:-q;
}

function SNDshoot3(i) {
	var n=2e4;
	if (i > n) return null;
	var q = t(i,n);
	return (P(i*500000,0.3)&33)?q:-q;
}

function SNDwhat0(i) {
	var n=1e4;
	if (i > n) return null;
	var q = t(i,n);
	return S(i*0.01*S(i*0.4)+S(i/100));
}

function SNDwhat1(i) {
	var n=2e4;
	if (i > n) return null;
	var q = t(i,n);
	return S(i*0.1*P(0.9,i*0.01)+S(i/10));
}

function SNDwhatportal2(i) {
	var n=1e4;
	if (i > n) return null;
	var q = t(i,n);
	return S(i/55*S(i/99)+S(i/100))*q;
}

function mkaudio(fn) {
	var data = [];
	for (var i = 0;;i++) {
		var smp = fn(i);
		if (smp===null) break;
		data.push(smp);
	}
	var l = data.length;
	var l2=l*2;

	var b32 = function (v) {
		var s = 0;
		var b = "";
		for (var i=0; i<4; i++,s+=8) b+=String.fromCharCode((v>>s)&255);
		return b;
	};
	var b16 = function (v) {
		var b = b32(v);
		return b[0]+b[1];
	};;

	var SR=48e3;
	var b = "RIFF"+b32(l2+36)+"WAVEfmt "+b32(16)+b16(1)+b16(1)+b32(SR)+b32(SR*2)+b16(2)+b16(16)+"data"+b32(l2);
	for (var i in data) b+=b16(data[i]*10e3);
	return new Audio("data:audio/wav;base64,"+btoa(b));
}

P=Math.pow;S=Math.sin;

function t(i,n) {
	return (n-i)/n;
}
function SNDjump0(i) {
	var n = 1e4;
	if (i>n) return null;
	return ((P(i,1.055)&128)?1:-1)*P(t(i,n),2);
}

function SNDjump1(i) {
	var n=1.3e4;
	var c=n/3;
	if (i > n) return null;
	var q=P(t(i,n),3.1);
	return (P(i,1.08)&(i<c?98:99))?q:-q;
}

function SNDjump2(i) {
	i=i*1.5;
	var n = 2e4;
	if (i>n) return null;
	return ((P(i,1.075)&128)?1:-1)*P(t(i,n),2);
}

function SNDjump3(i) {
	i=i*1.5;
	var n = 2e4;
	if (i>n) return null;
	return ((P(i,1.055)&128)?1:-1)*P(t(i,n),2);
}

function SNDjump4(i) {
	i=i*1.4;
	var n = 2e4;
	if (i>n) return null;
	return ((P(i,1.055)&130)?1:-1)*P(t(i,n),2);
}

function SNDjump5(i) {
	i=i*0.75;
	var n=1.3e4;
	var c=n/3;
	if (i > n) return null;
	var q=P(t(i,n),3.1);
	return (P(i,1.08)&(i<c?98:99))?q:-q;
}

function SNDdie0(i) {
	var n=5e4;
	if (i > n) return null;
	return ((P(i,0.9)&200)?1:-1)*P(t(i,n),3);
}

function SNDdie1(i) {
	i=P(i,0.96)*1.3;
	var n=9e4;
	if (i > n) return null;
	return (((i+S(i/1900)*80)&64)?1:-1)*P(t(i,n),3);
}

function SNDdie2(i) {
	var n=5e4;
	var n1=1e5;
	if (i > n) return null;
	i=P(i,1-S(i/n1))*5.3;
	var x=S(i/30+S(i/1500));
	return P(x,9)*t(i,n);
}

function SNDdie3(i) {
	var n=5e4;
	var n1=1e5;
	if (i > n) return null;
	i=P(i,1.2-S(i/n1))*7;
	var x=S(i/30+S(i/1500));
	return P(x,9)*t(i,n);
}

function SNDdie3(i) {
	var n=6e4;
	var n1=1e5;
	if (i > n) return null;
	i=P(i,1.2-S(i/n1))*7;
	var x=S(i/30+S(i/1500));
	return P(x,9)*t(i,n);
}

function SNDdie4(i) {
	var n=5e4;
	var n1=1e5;
	if (i > n) return null;
	i=P(i,1.2-S(i*2/n1))*6;
	var x=S(i/30+S(i/1500));
	return P(x,9)*t(i,n);
}

function SNDglitch0(i) {
	var n=5e4;
	if (i > n) return null;
	return ((P(i+S(i*0.01)*1000,0.9)&200)?1:-1)*P(t(i,n),1);
}

function SNDglitch1(i) {
	var n=5e4;
	if (i > n) return null;
	return ((P(i+S(i*0.01)*1000,0.8)&200)?0.5:-0.5)*P(t(i,n),1);
}

function SNDglitch2(i) {
	var n=1e5;
	if (i > n) return null;
	return ((P(P(i,0.9)+S(i*1.06)*1000,0.8)&200)?0.5:-0.5)*P(t(i,n),1);
}

function SNDcoin0(i) {
	var n=1e4;
	var c=n/3;
	if (i > n) return null;
	var q=P(t(i,n),2.1);
	return (P(i,3)&(i<c?16:99))?q:-q;
}

function SNDcoin1(i) {
	var n=1.6e4;
	var c=n/7;
	if (i > n) return null;
	var q=P(t(i,n),2.1);
	return (i<c ? ((i+S(-i/900)*10)&16) : i&13) ?q:-q;
}

function SNDwin0(i) {
	var notes = [0,4,7,12,undefined,7,12];
	var n=3.5e4;
	if (i > n) return null;
	var idx = ((notes.length*i)/n)|0;
	var note = notes[idx];
	if (note === undefined) return 0;
	var r = P(2,note/12)*0.8;
	var q = t((i*notes.length)%n,n);
	return ((i*r)&64)?q:-q
}

function SND0(i) {
	var n=25000;
	if (i > n) return null;
	return ((((i^(i>>3))^(i*i*7.3)^(i<<4))&65535)/65536)*t(i,n);
}


window.onload = function () {
	for (var k in window) {
		if (/^SND/.exec(k)) {
			(function (k) {
				var a = mkaudio(window[k]);
				var e = document.createElement("button");
				e.onclick = function () { a.play(); };
				e.innerHTML = k.substring(3);
				document.body.appendChild(e);
			})(k);
		}
	}
}
function SNDwhat3(i) {
	var n=2e4;
	if (i > n) return null;
	var q = t(i,n);
	return S(i*0.001*S(0.009*i)+S(i/100));
}

function SNDwhat4(i) {
	var n=1e4;
	if (i > n) return null;
	var q = t(i,n);
	return S(i*0.01*S(0.009*i+S(i/200))+S(i/100))*q*q;
}

function SNDwhat5(i) {
	var n=2e4;
	if (i > n) return null;
	var q = t(i,n);
	return S(i*0.001*S(0.009*i+S(i/200))+S(i/100))*q*q;
}

function SNDwhat6(i) {
	var n=11e4;
	if (i > n) return null;
	var q = t(i,n);
	return S(i*0.001*S(0.009*i+S(i/200))+S(i/100))*q*q;
}

function SNDwhat7(i) {
	var n=2e4;
	if (i > n) return null;
	var q = t(i,n);
	return S(-i*0.003*S(0.09*i+S(i/200))+S(i/100))*q*q;
}

function SNDwhat8(i) {
	var n=2e4;
	if (i > n) return null;
	var q = t(i,n);
	return S(-i*0.03*S(0.09*i+S(i/200))+S(i/100))*q*q;
}

function SNDwhat9(i) {
	var n=2e4;
	if (i > n) return null;
	var q = t(i,n);
	i=i*0.04;
	return S(-i*0.03*S(0.09*i+S(i/200))+S(i/100))*q;
}

function SNDwhat10(i) {
	var n=2e4;
	if (i > n) return null;
	var q = t(i,n);
	i=i*0.7;
	return S(P(i,0.9)*0.03*S(0.09*P(i,1.1)+S(i/200))+S(i/100))*q*q;
}

function SNDwhat11(i) {
	var n=2e4;
	if (i > n) return null;
	var q = t(i,n);
	i=i*0.1;
	return S(P(i,0.9)*0.03*S(0.09*P(i,1.1)+S(i/200))+S(i/100))*q*q;
}

function SNDshoot4(i) {
	var n=2e4;
	if (i > n) return null;
	var q = t(i,n);
	i=i*0.7;
	return (P(i*50,0.8)&34)?q:-q;
}

function SNDshoot5(i) {
	var n=2e4;
	if (i > n) return null;
	var q = t(i,n);
	i=i*0.7;
	return (P(i*50,0.8)&66)?q:-q;
}

function SNDshoot6(i) {
	var n=2e4;
	if (i > n) return null;
	var q = t(i,n);
	i=i*0.7;
	return (P(i*50,0.8)&133)?q:-q;
}

function SNDrumbl0(i) {
	var n=4e4;
	if (i > n) return null;
	return S(i/1000 - S(i/100)*S(i/61))*t(i,n);
}

function SNDrumbl1(i) {
	var n=4e4;
	if (i > n) return null;
	return S(i/2000 - S(i/331)*S(i/61))*t(i,n);
}

function SNDrumbl2(i) {
	var n=3e4;
	if (i > n) return null;
	return S(i/2000 - S(i/331)*S(i/61) + S(S(i/59)/39) * 33)*t(i,n);
}
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console