Skip to content

Instantly share code, notes, and snippets.

@ashtonmeuser
Created January 21, 2021 00:49
Show Gist options
  • Save ashtonmeuser/5e696524d986ba6c25af0df89bdbdccc to your computer and use it in GitHub Desktop.
Save ashtonmeuser/5e696524d986ba6c25af0df89bdbdccc to your computer and use it in GitHub Desktop.
// bookmarklet-title: Eno
// bookmarklet-about: Plays demoscene interpretation of Brian Eno's 1/2 from the album Ambient 1. Original code by Mathieu Henri (http://www.p01.org/music_for_tiny_airports).
const k = 8192;
let t = 0;
const AudioContext = window.AudioContext || window.webkitAudioContext;
const ac = new AudioContext();
const sp = ac.createScriptProcessor(k, 0, 1);
sp.connect(ac.destination);
sp.onaudioprocess = pe => {
for(let i=0; i<k; t+=2e-5) pe.outputBuffer.getChannelData(0)[i++] = '%,IW7:A'.charCodeAt(i%7)*t%.1*(1-t/(Math.tan(i%7)+9)%1);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment