Symphony of Math.PI

Developer
Size
2,355 Kb
Views
50,600

How do I make an symphony of math.pi?

Made using riffwave.js inspired by http://codepen.io/rjd2/pen/xDaCA. What is a symphony of math.pi? How do you make a symphony of math.pi? This script and codes were developed by Marius Balaj on 07 July 2022, Thursday.

Symphony of Math.PI Previews

Symphony of Math.PI - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Symphony of Math.PI</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div onclick="playPI()"> <span>+---------------------------------------+</span> <span>| Click to play the symphony of Math.PI |</span> <span>+---------------------------------------+</span>
<span id="pi"></span>
</div> <script src='http://js.do/sound/js/riffwave.js'></script> <script src="js/index.js"></script>
</body>
</html>

Symphony of Math.PI - Script Codes CSS Codes

body { background: #000000; color: #00FF00; font-family: monospace;}
div { width:100%; font-family:Courier New; font-size:14px; text-align:center; position:absolute; top:50%; -webkit-transform:translateY(-50%); transform:translateY(-50%); cursor:pointer; -webkit-user-select:none; -moz-user-select:none; -ms-user-select:none; user-select:none;
}
div span { display:block;
}
div span#pi { margin:15px 0 0;
}

Symphony of Math.PI - Script Codes JS Codes

document.getElementById('pi').innerHTML = Math.PI;
var makeNote = function(frequency) { var audio = new Audio(); var wave = new RIFFWAVE(); var data = []; wave.header.sampleRate = 44100; var time = 0.5; for (var i = 0; i < wave.header.sampleRate * time; i++) { data[i] = Math.round(128 + 127 * Math.sin(i * 2 * Math.PI * frequency / wave.header.sampleRate)); } wave.Make(data); audio.src = wave.dataURI; return audio;
};
var sing = function(note) { var note = makeNote(note); note.play();
};
var $0 = 261.63, // DO $1 = 293.66, // RE $2 = 329.63, // MI $3 = 349.23, // FA $4 = 392, // SOL $5 = 220 * 2, // LA $6 = 246.94 * 2, // SI $7 = $0 * 2, // DO $8 = $1 * 2, // RE $9 = $2 * 2; // MI
// MATH.PI
var song = [$3, $1, $4, $1, $5, $9, $2, $6, $5, $3, $5, $8, $9, $7, $9, $3];
var playPI = function() { var i = 0; setInterval(function() { if(i <= song.length ){ sing(song[i]); i++ } }, 500);
}
Symphony of Math.PI - Script Codes
Symphony of Math.PI - Script Codes
Home Page Home
Developer Marius Balaj
Username mariusbalaj
Uploaded July 07, 2022
Rating 3.5
Size 2,355 Kb
Views 50,600
Do you need developer help for Symphony of Math.PI?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Marius Balaj (mariusbalaj) Script Codes
Create amazing captions with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!