Skip to content

Instantly share code, notes, and snippets.

@jebrial
Created April 19, 2019 03:27
Show Gist options
  • Save jebrial/24cc1e8b4cc581d490efa94dddda5828 to your computer and use it in GitHub Desktop.
Save jebrial/24cc1e8b4cc581d490efa94dddda5828 to your computer and use it in GitHub Desktop.
// https://twitter.com/jake_albaugh/status/1118611365508337665
function z() {
setTimeout(z, 40);
a.getByteFrequencyData(d);
var s = [];
d.forEach(v => s.push(l[Math.floor((v / 255) * 8)]));
location.hash = document.title = s.join("");
}
var l = ["▁", "▂", "▃", "▄", "▅", "▆", "▇", "█"];
var x = new AudioContext();
var a = x.createAnalyser();
a.fftSize = 32;
var d = new Uint8Array(16);
navigator.mediaDevices.getUserMedia({ audio: true }).then(s => {
x.createMediaStreamSource(s).connect(a);
z();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment