Advertisement
sxiii

Linux Cool Music Generator via Bash and C - try it yourself!

May 27th, 2016
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.83 KB | None | 0 0
  1. # This oneliner creates simple C program to write computer music, then compiles it, than runs it
  2. # To use it you need gcc and aplay (sudo apt-get install gcc)
  3. # Run it in linux bash to hear the music
  4.  
  5. a=10;b=8;c=63;d=5;echo "main(t){for(t=0;;t++)putchar(t*((t>>$a|t>>$b)&$c^t>>$d));}" | gcc -x c -o ttt - && ./ttt | aplay
  6.  
  7. # Another sample (fun one ^_^ cute):
  8.  
  9. a=10;b=8;c=63;d=25;echo "main(t){for(t=0;;t++)putchar(t*((t>>$a|t>>$b)&$c^t>>$d));}" | gcc -x c -o ttt - && ./ttt | aplay
  10.  
  11.  
  12. # Use Ctrl+C to stop the program
  13. # Please change a, b, c and d values to change the music
  14. # Also have a look at this links:
  15. # http://countercomplex.blogspot.ru/2011/10/algorithmic-symphonies-from-one-line-of.html
  16. # https://github.com/MattVitelli/GRUV
  17. # http://tones.wolfram.com/generate/
  18. # http://www.ibm.com/developerworks/java/library/j-camusic/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement