adding notes on using the output, and putting back to stdout, instead of

writing to the /dev/audio
This commit is contained in:
Vincent Batts 2012-09-19 21:33:31 -04:00
parent 62a82f13c2
commit ec9844054b
9 changed files with 19 additions and 10 deletions

View File

@ -1,13 +1,14 @@
MUSIC_FILES := $(basename $(wildcard f*.c))
TMP_FILES := $(wildcard *~) $(wildcard *.o)
CFLAGS +=
LDFLAGS += -static -s
all: $(MUSIC_FILES)
audio.o: audio.c audio.h
%: %.c audio.o
$(CC) -static -s -o $@ $^
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
clean:
rm -rf $(MUSIC_FILES) $(TMP_FILES)

9
README
View File

@ -1,4 +1,11 @@
to play these, just compile and run like:
$> ./f1 | aplay
$> ./f1 > /dev/audio
or (fancier)
$> ./f1 | aplay
or (fanciest) (this way you can play with the rate)
$> ./f1 | play -r 8k -t raw -b 8 -c 1 -e signed -
or (fanciester)
$> ./f1 | sox -r 8k -t raw -b 8 -c 1 -e signed - audio.mp3 # mp3 requires 8khz rate
$> play audio.mp3

View File

@ -9,6 +9,7 @@ void init() {
}
void p(int i) {
fputc(i, audio);
//fputc(i, audio);
putchar(i);
}

2
f1.c
View File

@ -1,7 +1,7 @@
#include "audio.h"
int main() {
init();
//init();
int t;
for (t = 0;;t++) {
p((t >> 6 | t | t >> (t >> 16)) * 10 + ((t >> 11) & 7));

2
f2.c
View File

@ -1,6 +1,6 @@
#include "audio.h"
int main(t){
init();
//init();
for(t=0;;t++) {
p(t*(((t>>12)|(t>>8))&(63&(t>>4))));
}

2
f3.c
View File

@ -1,6 +1,6 @@
#include "audio.h"
main(int t) {
init();
//init();
for(;;t++) {
p(t*9&t>>4|t*5&t>>7|t*3&t/1024);

2
f4.c
View File

@ -1,6 +1,6 @@
#include "audio.h"
int main(int t) {
init();
//init();
for (t = 0;;t++) {
int i;
i = (t>>7-(t>>15)&-t>>7-(t>>15));

2
f5.c
View File

@ -1,6 +1,6 @@
#include "audio.h"
main(t){
init();
//init();
for(t=0;;t++) {
p(((t*("36364689"[t>>13&7]&15))/12&128)+(((((t>>12)^(t>>12)-2)%11*t)/4|t>>13)&127));
}

2
f6.c
View File

@ -2,7 +2,7 @@
main(t){
int y,x;
init();
//init();
for(t=0;;t++)
{
x=t*"6689"[t>>16&3]/24&127;