Is there a way to make it sounds more pleasant? The sine wave is a bit harsh...
The example from /r/coding[1] is very nice to listen to: awk 'function wl() { rate=64000; return (rate/160)*(0.87055^(int(rand()*10)))}; BEGIN { srand(); wla=wl(); while(1) { wlb=wla; wla=wl(); if (wla==wlb) {wla*=2;}; d=(rand()*10+5)*rate/4; a=b=0; c=128; ca=40/wla; cb=20/wlb; de=rate/10; di=0; for (i=0;i wla) {a=0; ca*=-1}; if (b>wlb) {b=0; cb*=-1}; if (di>de) {di=0; ca*=0.9; cb*=0.9}; printf("%c",c)}; c=int(c); wh…
'Music' from /dev/urandom
51–58 of 58 posts
Re: 'Music' from /dev/urandom
#52Code: https://github.com/gordol/ld_preload-sounds
Preview: https://soundcloud.com/glowdon/malloc-read-hook-self-compile
Re: 'Music' from /dev/urandom
#53Re: 'Music' from /dev/urandom
#54Re: 'Music' from /dev/urandom
#55> I only expected this to work on Ubuntu And yet here's the command: cat /dev/urandom | hexdump -v -e '/1 "%u\n"' | awk '{ split("0,2,4,5,7,9,11,12",a,","); for (i = 0; i There's nothing Ubuntu-specific there: it works fine on other Linuxes. It's gotten more than a little annoying, this widespread equivalence between Ubuntu and Linux. Ubuntu is a Linux distro, albeit hardly the best, most idiomatic or most traditiona…
Part of this exercise was to leverage highly portable and backward compatible utilities as much as possible, so I expect stuff like cat and awk to work mostly the same everywhere. 'aplay' is the one I was not sure about. If I recall correctly, it was even necessary to explicitly 'sudo apt-get install' on older versions of Ubuntu.
FWIW, I really dig the demo: it's cool.
Re: 'Music' from /dev/urandom
#56Re: 'Music' from /dev/urandom
#57I hope everyone is turning off CSS before copy-pasting this command-line into their terminal :) http://thejh.net/misc/website-terminal-copy-paste
Always paste to the browser url bar and then copy again. This clears any extra tags you might carry over and will display anything that might be hidden. You could copy and paste to notepad, but the browser bar is closer.
Re: 'Music' from /dev/urandom
#58Handy smoke test for a good RNG? Not sure I see any case where it would actually be useful for this in practice, but I find the idea amusing in theory.
You may be able to hear or see that a very bad RNG is bad (there are certainly sufficiently bad ones for which you can), but you can not hear or see that one is good.