commit: 04f4543159037a79a9b3517ee5dc52935dd024f9
parent 155869e7f4a05a3d3842e7c28d70e47945e92bb0
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Fri, 24 Sep 2021 07:50:01 +0200
Split AU 8-bit 8kHz.c properly
Diffstat:
4 files changed, 73 insertions(+), 50 deletions(-)
diff --git a/C/AU 8-bit 8kHz.c b/C/AU 8-bit 8kHz.c
@@ -1,47 +0,0 @@
-#define _POSIX_C_SOURCE 200809L
-#include <stdio.h>
-#include <inttypes.h> // uint32_t
-
-#include "au.h"
-
-int
-main(void)
-{
- struct au_header header = {
- .offset = 24, // no-annotation, in octets
- .lenght = 0xFFFFFFFF, // unknown data size
- .encoding = 02, // unsigned 8-bit linear PCM
- .samplerate = 8000, // Hz
- .channels = 1
- };
-
- // fd 1 is stdout
- write_au_header(1, &header);
-
-for(int t = 0;;t++)putchar(
- // 8kHz
- //t*(((t>>12)|(t>>8))&(63&(t>>4)))
- //(t/3&(t/64)%32)*6 // rythm-bass
- //(t/3&(t/64)%32)&t/2 // alien-alert
- //(t/4&(t/256)%32)&t*2 // alien-alert (too loud)
- //t*(42&t>>10) // 42-melody
- t*((42&t>>10)%14) // 42-melody-western
- //t*(t>>9|t>>13)&16 // twit-twit
-
- //t*5&(t>>7)|t*3&(t*4>>10)
- //(t*5&t>>7)|(t*3&t>>10)
- //t*9&t>>4|t*5&t>>7|t*3&t/1024 // robot march
-
- // Sierpinski Harmony
- //(t*3)&t>>8
- //t&t>>8
- //t*(0xCA98>>(t>>9&14)&15)|t>>8
- //(t>>8^t>>10|t>>14|t*3)&63
- //(t*9&t>>4|t*5&t>>7|t*3&t/1024)-1
- //t>>7&1?t>>5:-t>>4
- //t>>4|t&((t>>5)/(t>>7-(t>>15)&-t>>7-(t>>15)))
- //(int)(t/1e7*t*t+t)%127|t>>4|t>>5|t%127+(t>>16)|t
-
- // 44.1kHz
- //((t*("36364689"[t>>13&7]&15))/12&128)+(((((t>>12)^(t>>12)-2)%11*t)/4|t>>13)&127)
-);}
diff --git a/C/Makefile b/C/Makefile
@@ -1,9 +1,7 @@
WAYLAND_PROTOCOLS=`pkg-config --variable=pkgdatadir wayland-protocols`
WAYLAND_SCANNER=`pkg-config --variable=wayland_scanner wayland-scanner`
-all: AU\ 8-bit\ 8kHz.c SDL_YUV_visualisation wayland
-
-AU\ 8-bit\ 8kHz: AU\ 8-bit\ 8kHz.c au.h
+all: au8b_8kHz au8b_44.1kHz SDL_YUV_visualisation wayland
SDL_YUV_visualisation: SDL_YUV_visualisation.c
$(CC) $(CFLAGS) SDL_YUV_visualisation.c -o SDL_YUV_visualisation `sdl2-config --cflags --libs`
diff --git a/C/au8b_44.1kHz.c b/C/au8b_44.1kHz.c
@@ -0,0 +1,25 @@
+#define _POSIX_C_SOURCE 200809L
+#include <stdio.h>
+#include <inttypes.h> // uint32_t
+
+#include "au.h"
+
+int
+main(void)
+{
+ struct au_header header = {
+ .offset = 24, // no-annotation, in octets
+ .length = 0xFFFFFFFF, // unknown data size
+ .encoding = 02, // unsigned 8-bit linear PCM
+ .samplerate = 44100, // Hz
+ .channels = 1
+ };
+
+ // fd 1 is stdout
+ write_au_header(1, &header);
+
+for(int t = 0;t<2097334;t++)putchar(
+ //((t*("36364689"[t>>13&7]&15))/12&128)+(((((t>>12)^(t>>12)-2)%11*t)/4|t>>13)&127)
+ //((t*(t>>13&10))/12&128)+
+ (((((t>>12)^(t>>12)-1)%11*t)/5|t>>14)&127)
+);}
diff --git a/C/au8b_8kHz.c b/C/au8b_8kHz.c
@@ -0,0 +1,47 @@
+#define _POSIX_C_SOURCE 200809L
+#include <stdio.h>
+#include <inttypes.h> // uint32_t
+
+#include "au.h"
+
+int
+main(void)
+{
+ struct au_header header = {
+ .offset = 24, // no-annotation, in octets
+ .length = 0xFFFFFFFF, // unknown data size
+ .encoding = 02, // unsigned 8-bit linear PCM
+ .samplerate = 8000, // Hz
+ .channels = 1
+ };
+
+ // fd 1 is stdout
+ write_au_header(1, &header);
+
+for(int t = 0;;t++)putchar(
+ // 8kHz
+ //t*(((t>>12)|(t>>8))&(63&(t>>4)))
+ //(t/3&(t/64)%32)*6 // rythm-bass
+ //(t/3&(t/64)%32)&t/2 // alien-alert
+ //(t/4&(t/256)%32)&t*2 // alien-alert (too loud)
+ //t*(42&t>>10) // 42-melody
+ //t*((42&t>>10)%14) // 42-melody-western
+ //t*(t>>9|t>>13)&16 // twit-twit
+
+ //t*5&(t>>7)|t*3&(t*4>>10)
+ //(t*5&t>>7)|(t*3&t>>10)
+ t*9&t>>4|t*5&t>>7|t*3&t/1024 // robot march
+
+ // Sierpinski Harmony
+ //(t*3)&t>>8
+ //t&t>>8
+ //t*(0xCA98>>(t>>9&14)&15)|t>>8
+ //(t>>8^t>>10|t>>14|t*3)&63
+ //(t*9&t>>4|t*5&t>>7|t*3&t/1024)-1
+ //t>>7&1?t>>5:-t>>4
+ //t>>4|t&((t>>5)/(t>>7-(t>>15)&-t>>7-(t>>15)))
+ //(int)(t/1e7*t*t+t)%127|t>>4|t>>5|t%127+(t>>16)|t
+
+ // 44.1kHz
+ //((t*("36364689"[t>>13&7]&15))/12&128)+(((((t>>12)^(t>>12)-2)%11*t)/4|t>>13)&127)
+);}