This commit is contained in:
Bruno Rybársky 2022-03-19 13:31:11 +01:00
parent 72dfafbc1c
commit d94229bb2f
2 changed files with 14 additions and 18 deletions

@ -11,6 +11,6 @@ run: compile
record: compile record: compile
rm -f out.ogg rm -f out.ogg
./randMus|ffmpeg -f u16le -ar 8000 -ac 1 -i - out.ogg ./randMus|ffmpeg -f u16le -ar 8000 -ac 1 -i - -to 00:05:00 out.ogg
all: compile run all: compile run

@ -1,10 +1,8 @@
#include <stdio.h> #include <stdio.h> // putchar
#include <stdlib.h> #include <stdlib.h> // rand
#include <time.h> #include <time.h> // time
const int num_samples = 6; const int num_samples = 6;
const int num_sample_repeats = 1;
int main() { int main() {
srand(time(NULL)); // seed random number generator srand(time(NULL)); // seed random number generator
int a[num_samples]; // array of random numbers int a[num_samples]; // array of random numbers
@ -17,11 +15,10 @@ int main() {
for (x = 0; x < num_samples; x++) { for (x = 0; x < num_samples; x++) {
a[x] = rand() % 20 + 1; // set a[x] to a random number between 1 and 50 a[x] = rand() % 20 + 1; // set a[x] to a random number between 1 and 50
} }
for (y = 0; y < num_sample_repeats; y++) { for (i = 0;i<16000; i++) { // loop forever
for (i = 0;i<32000; i++) { // loop forever
c = i >> a[0]; // shift right i by a[0] c = i >> a[0]; // shift right i by a[0]
c = c | i >> a[1]; // or c by i shifted right by a[1] c = c | i >> a[1]; // or c by i shifted right by a[1]
c = c + (i * 1.5); // multiply c by i c = c * i; // multiply c by i
c = c & a[2]; // and c by a[2] c = c & a[2]; // and c by a[2]
c = c | i >> a[3]; // or c by i shifted right by a[3] c = c | i >> a[3]; // or c by i shifted right by a[3]
tmp = i & i >> a[4]; // and i by i shifted right by a[4] tmp = i & i >> a[4]; // and i by i shifted right by a[4]
@ -31,4 +28,3 @@ int main() {
} }
} }
} }
}