second inital commit
This commit is contained in:
parent
3e39c5d860
commit
6b1afec73d
4
Makefile
Normal file
4
Makefile
Normal file
@ -0,0 +1,4 @@
|
||||
all:
|
||||
gcc -o randMus randMus.c
|
||||
run:
|
||||
./randMus | aplay
|
10
README.md
10
README.md
@ -1,9 +1,17 @@
|
||||
RandMus
|
||||
=======
|
||||
|
||||
Random Music generator using aplay (Linux only)
|
||||
Random Music generator piping into aplay (Linux only)
|
||||
|
||||
A simple little program that pipes char data into aplay resulting in random little tunes.
|
||||
Some sound good and are kind of catchy, others blow out your ears and will drive you insane. (could be a good thing I suppose if you like dubstep)
|
||||
|
||||
In short, A fun little thing to play around with.
|
||||
|
||||
Instructions:
|
||||
- cd into the RandMus directory
|
||||
- type "make" to compile
|
||||
- type "make run" to run the program
|
||||
- to quit the program type ctrl-c
|
||||
- to view the random values for the current or last song first open another terminal window, cd to the RandMus directory, and run the command "cat lastSong.txt"
|
||||
- spend hours messing around with it
|
||||
|
6
lastSong.txt
Normal file
6
lastSong.txt
Normal file
@ -0,0 +1,6 @@
|
||||
a[0]: 12
|
||||
a[1]: 29
|
||||
a[2]: 17
|
||||
a[3]: 2
|
||||
a[4]: 28
|
||||
a[5]: 42
|
26
randMus.c
Normal file
26
randMus.c
Normal file
@ -0,0 +1,26 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
int main()
|
||||
{
|
||||
//create data file
|
||||
FILE *f = fopen("lastSong.txt", "w");
|
||||
if(f==NULL)
|
||||
return 0;
|
||||
int num = 6;
|
||||
srand(time(NULL));
|
||||
int a[num];
|
||||
int i;
|
||||
for(i=0;i<num;i++)
|
||||
{
|
||||
a[i] = rand() % 50 + 1;
|
||||
fprintf(f,"a[%d]: %d\n", i, a[i]);
|
||||
}
|
||||
fclose(f);
|
||||
// system("gnome-terminal \"cat lastSong.txt\"");
|
||||
for(i=0;;i++)
|
||||
{
|
||||
putchar(((i*(i>>a[0]|i>>a[1])&a[2]&i>>a[3]))^(i&i>>a[4]|i>>a[5]));
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user