There are apps that can make white noise while using 0 network really. If I was Spotify I’d write a library into the app that detected white noise and stopped streaming, and just turned on the local generator in their app.
I’d have a Javascript one-liner producing white noise, except web audio is a Gordian knot of inscrutable identical-sounding types and contexts and maps and whateverthefuck. Documentation reads like they forgot to implement it and hoped nobody would notice.
How do you generate noise? Well you need a sink. How do I get a sink? Well you need an event. How do you get an event? Well you need a processor. How do you get a processor? Well you need a context. How do you get a context? Well you need a node. How do you get a node? Well you need a sink. I’m going to stab you now. Understandable.
Anyway it’s something like data:text/html,{script} ac = newAudioContext(); wn = ac.createScriptProcessor( 4096, 1, 1 ); wn.onaudioprocess = (e) => e.outputBuffer.getChannelData(0).forEach( (v,i,a) => a[i] = Math.random() ); wn.connect( ac.destination ); {/script} except with whatever dark wizardry makes output reach a speaker.
Also I’m not sure .forEach works on whichever array-like type was chosen for audio channels. This stupid language has so many incompatible and incomplete array implementations.
edit: And angle brackets on script and /script, because this stupid website fucked up its Markdown. Preventing random HTML strings in comments: excellent, necessary, obvious; it is not 1999 anymore. Doing so by deleting the entire goddamn thing as if you parsed it before removing it: DEEPLY TROUBLING.
There are apps that can make white noise while using 0 network really. If I was Spotify I’d write a library into the app that detected white noise and stopped streaming, and just turned on the local generator in their app.
I’d have a Javascript one-liner producing white noise, except web audio is a Gordian knot of inscrutable identical-sounding types and contexts and maps and whateverthefuck. Documentation reads like they forgot to implement it and hoped nobody would notice.
How do you generate noise? Well you need a sink. How do I get a sink? Well you need an event. How do you get an event? Well you need a processor. How do you get a processor? Well you need a context. How do you get a context? Well you need a node. How do you get a node? Well you need a sink. I’m going to stab you now. Understandable.
Anyway it’s something like
data:text/html,{script} ac = new AudioContext(); wn = ac.createScriptProcessor( 4096, 1, 1 ); wn.onaudioprocess = (e) => e.outputBuffer.getChannelData(0).forEach( (v,i,a) => a[i] = Math.random() ); wn.connect( ac.destination ); {/script}
except with whatever dark wizardry makes output reach a speaker.Also I’m not sure .forEach works on whichever array-like type was chosen for audio channels. This stupid language has so many incompatible and incomplete array implementations.
edit: And angle brackets on script and /script, because this stupid website fucked up its Markdown. Preventing random HTML strings in comments: excellent, necessary, obvious; it is not 1999 anymore. Doing so by deleting the entire goddamn thing as if you parsed it before removing it: DEEPLY TROUBLING.