Created
April 18, 2019 06:04
-
-
Save rileyjshaw/722a5dfbac901f9d236c353181f0a7e2 to your computer and use it in GitHub Desktop.
ascii equalizer based on https://twitter.com/jake_albaugh/status/1118611365508337665; trying to fit this into a single tweet (280 characters)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n=(l='▁▂▃▄▅▆▇█'.split(''),x=new AudioContext(),d=new Uint8Array(16),a=x.createAnalyser()).fftSize=32 | |
navigator.mediaDevices.getUserMedia({audio:1}).then(s=>{x.createMediaStreamSource(s).connect(a) | |
setInterval(_=>{a.getByteFrequencyData(d) | |
location.hash=[...d].map(v=>l[0|v/n]).join('')},n)}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Warning: this really thrashes your browser history. Consider replacing
location.hash
withdocument.title
before running.