3 ms·
Here is one with the blues scale. From time to time it grooves really nice. cat /dev/urandom | hexdump -v -e '/1 "%u\n"' | awk '{ split("0,3,5,6,7,10,12",a,"
by ckaygusu 11y ago
Here is one with the blues scale. From time to time it grooves really nice.
cat /dev/urandom | hexdump -v -e '/1 "%u\n"' | awk '{ split("0,3,5,6,7,10,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 24000
- robertelder 11y agoThis sounds better than my version.
- Vivtek 11y agoIt really does! At twice the sampling rate it's pretty interesting, too. Incidentally, this little idea rocks. It's amazing what's buried down there in Unix command-line utilities.
- robertelder 11y agoI received an email suggestion yesterday of a variant of this command that places it inside a function, so that you could play multiple instruments at once with function calls. I guess you could make an entire music composing utility in bash if you wanted to.
- ep103 11y agoanyone got a sample?
- sajal83 11y agohttps://dl.dropboxusercontent.com/u/361747/urandom.mp3 https://dl.dropboxusercontent.com/u/361747/urandom.mp3
- sajal83 11y ago80s/90s computer game soundtrack...
- laumars 11y agoI have this version and the authors "sad" version playing together. It's weird because after about 10 or so minutes they stop sounding random and become almost like chiptune jazz.
- unsignedint 11y agoHere's Ryukyu (Okinawa) Japanese music scale cat /dev/urandom | hexdump -v -e '/1 "%u\n"' | awk '{ split("4,5,7,11",a,","); for (i = 0; i < 1; i+= 0.0001) printf("%08X\n", 100*sin(1046*exp((a[$1 % 8]/12)*log(2))*i)) }' | xxd -r -p | aplay -c 2 -f S32_LE -r 24000
- laumars 11y agoUnfortunately markdown formatting has broken your code. I can make a guess based on where the italics starts and ends, but you might want to indent that code.
- unsignedint 11y agoOops, I'm sorry. Looks better now?