3 ms·
This one, from HAKMEM's circle-drawing hack, generates a simple pure sine wave: main(t,u){for(t=u=85;;t+=u>>2,u-=t>>2)putchar(t+128);} BTW, I think the co
by kragen 15y ago
This one, from HAKMEM's circle-drawing hack, generates a simple pure sine wave:
main(t,u){for(t=u=85;;t+=u>>2,u-=t>>2)putchar(t+128);}
BTW, I think the comments saying that aplay or pacat are equivalent to /dev/audio are slightly mistaken. /dev/audio is μ-law, like aplay -f MU_LAW. aplay defaults to linear unsigned 8-bit. With the sine wave above, the difference is very noticeable. With the various distorted sawtooths and white-noises in the original videos, it's harder to tell, but I'm reasonably sure that they're using μ-law, not linear.
BTW, aplay refuses to play 8-bit audio on my Logitech USB speakers. So I ended up using sox to convert:
./viznut1 | sox -r 8000 -U -t u8 - -t s16 - | aplay -f S16_LE -D hw:1,0
The -U specifies μ-law conversion.
I created a Git repository for these programs at https://github.com/kragen/viznut-music https://github.com/kragen/viznut-music.