Written by marcelpetrick
on May 7, 2016
Found a one-liner which uses input from urandom to create music. And: I’ve experienced worse musical accentuation in games xD
1 |
cat /dev/urandom | hexdump -v -e '/1 "%u\n"' | awk '{ split("0,2,4,5,7,9,11,12",a,","); for (i = 0; i < 1; i+= 0.0001) printf("%08X\n", 100*sin(1382*exp((a[$1 % 8]/12)*log(2))*i)) }' | xxd -r -p | aplay -c 2 -f S32_LE -r 16000 |
Original source is that blog. Also offers explanations and how to tune the scale. Great!
I recorded a short sample for those who don’t suffer from enjoy a *nix-system. (Piped raw data to file instead of aplay; imported & converted via Audacity. All hail OSS!)
Leave a Reply
You must be logged in to post a comment.