4 ms·
My personal favorite is Viznut's classic signature: #include <math.h> /* outputs 8 kHz 8-bit unsigned pcm to stdout */ main(v,i,z,n,u,t){for(v=-1;;)for
by inoop 11y ago
My personal favorite is Viznut's classic signature:
#include <math.h> /* outputs 8 kHz 8-bit unsigned pcm to stdout */
main(v,i,z,n,u,t){for(v=-1;;)for(n=pow(/* gcc -lm sig.c;./a.out>/dev/dsp */
1.06,"`cW`g[`cgcg[eYcb^bV^eW^be^bVecb^"[++v&31]+(v&64)/21),i=999;i;putchar(
128+((8191&u)>i?0:i/8)-((8191&(z+=n))*i-->>16)))u+=v&1?t/2: (t=v&6?t:n/4);}
edit: fixed copy/paste error
- e19293001 11y agoGot an error when I compile: $ gcc -lm sig.c sig.c: In function ‘main’: sig.c:3: error: expected ‘;’ before numeric constant Fixed this statement: < i=9 99; > i=999; Garbage is displayed when I execute the code.
- Rotten194 11y agoYou have to pipe it into an audio player (traditionally that was /dev/dsp IIRC but I don't think that's a thing anymore). aplay should work with the right flags.
- Narishma 11y agoIt's not a thing anymore on modern (pulseaudio-enabled) Linux but you can still use applications that write to /dev/dsp by launching them with padsp.
- a1k0n 11y agoI am a big fan of viznut also, and took the liberty of translating this into Javascript so we can all hear it without trying to find a /dev/dsp analog (I used ./viznut | sox -t raw -e unsigned -b 8 -r 8000 - -d): https://jsbin.com/tazeyoqoci/edit?html,output https://jsbin.com/tazeyoqoci/edit?html,output Amazing work.