adding notes on using the output, and putting back to stdout, instead of
writing to the /dev/audio
This commit is contained in:
parent
62a82f13c2
commit
ec9844054b
5
Makefile
5
Makefile
|
@ -1,13 +1,14 @@
|
||||||
|
|
||||||
MUSIC_FILES := $(basename $(wildcard f*.c))
|
MUSIC_FILES := $(basename $(wildcard f*.c))
|
||||||
TMP_FILES := $(wildcard *~) $(wildcard *.o)
|
TMP_FILES := $(wildcard *~) $(wildcard *.o)
|
||||||
|
CFLAGS +=
|
||||||
|
LDFLAGS += -static -s
|
||||||
all: $(MUSIC_FILES)
|
all: $(MUSIC_FILES)
|
||||||
|
|
||||||
audio.o: audio.c audio.h
|
audio.o: audio.c audio.h
|
||||||
|
|
||||||
%: %.c audio.o
|
%: %.c audio.o
|
||||||
$(CC) -static -s -o $@ $^
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(MUSIC_FILES) $(TMP_FILES)
|
rm -rf $(MUSIC_FILES) $(TMP_FILES)
|
||||||
|
|
9
README
9
README
|
@ -1,4 +1,11 @@
|
||||||
to play these, just compile and run like:
|
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
|
||||||
|
|
||||||
|
|
3
audio.c
3
audio.c
|
@ -9,6 +9,7 @@ void init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void p(int i) {
|
void p(int i) {
|
||||||
fputc(i, audio);
|
//fputc(i, audio);
|
||||||
|
putchar(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
f1.c
2
f1.c
|
@ -1,7 +1,7 @@
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
init();
|
//init();
|
||||||
int t;
|
int t;
|
||||||
for (t = 0;;t++) {
|
for (t = 0;;t++) {
|
||||||
p((t >> 6 | t | t >> (t >> 16)) * 10 + ((t >> 11) & 7));
|
p((t >> 6 | t | t >> (t >> 16)) * 10 + ((t >> 11) & 7));
|
||||||
|
|
2
f2.c
2
f2.c
|
@ -1,6 +1,6 @@
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
int main(t){
|
int main(t){
|
||||||
init();
|
//init();
|
||||||
for(t=0;;t++) {
|
for(t=0;;t++) {
|
||||||
p(t*(((t>>12)|(t>>8))&(63&(t>>4))));
|
p(t*(((t>>12)|(t>>8))&(63&(t>>4))));
|
||||||
}
|
}
|
||||||
|
|
2
f3.c
2
f3.c
|
@ -1,6 +1,6 @@
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
main(int t) {
|
main(int t) {
|
||||||
init();
|
//init();
|
||||||
for(;;t++) {
|
for(;;t++) {
|
||||||
p(t*9&t>>4|t*5&t>>7|t*3&t/1024);
|
p(t*9&t>>4|t*5&t>>7|t*3&t/1024);
|
||||||
|
|
||||||
|
|
2
f4.c
2
f4.c
|
@ -1,6 +1,6 @@
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
int main(int t) {
|
int main(int t) {
|
||||||
init();
|
//init();
|
||||||
for (t = 0;;t++) {
|
for (t = 0;;t++) {
|
||||||
int i;
|
int i;
|
||||||
i = (t>>7-(t>>15)&-t>>7-(t>>15));
|
i = (t>>7-(t>>15)&-t>>7-(t>>15));
|
||||||
|
|
2
f5.c
2
f5.c
|
@ -1,6 +1,6 @@
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
main(t){
|
main(t){
|
||||||
init();
|
//init();
|
||||||
for(t=0;;t++) {
|
for(t=0;;t++) {
|
||||||
p(((t*("36364689"[t>>13&7]&15))/12&128)+(((((t>>12)^(t>>12)-2)%11*t)/4|t>>13)&127));
|
p(((t*("36364689"[t>>13&7]&15))/12&128)+(((((t>>12)^(t>>12)-2)%11*t)/4|t>>13)&127));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue