new version
authorTobias Girstmair <tobi@isticktoit.net>
Wed, 3 Mar 2021 23:52:15 +0000 (00:52 +0100)
committerTobias Girstmair <tobi@isticktoit.net>
Wed, 3 Mar 2021 23:52:15 +0000 (00:52 +0100)
bsv.c

diff --git a/bsv.c b/bsv.c
index 0b9d3b3242600cf2a45dafc4fc583a5628291170..fff89f3e5d5bd2ee32bfd39e7e4f9bc3f4923a1e 100644 (file)
--- a/bsv.c
+++ b/bsv.c
@@ -1,6 +1,7 @@
 typedef unsigned char u8;
 
 int i;
+u8 i0, i1, i2, i3;
 
 u8 notes[] = {
        0x84, 0x9d, 0xb0, 0x69, 0x9d, 0x84, 0x69, 0x58,
@@ -8,7 +9,9 @@ u8 notes[] = {
 };
 
 u8 g(u8 x, u8 t, u8 o){
-       u8 notes_ix = t%8 + 8*!!(3&i>>16);
+       u8 notes_ix = t & 0x7;
+       if(3&i2)
+               notes_ix += 8;
        u8 result = (i*notes[notes_ix])>>o;
        result &= x;
        result &= 3;
@@ -16,10 +19,11 @@ u8 g(u8 x, u8 t, u8 o){
 }
 void main(void){
        i = 0;
+       i0 = i1 = i2 = i3 = 0;
        for(;;) {
                u8 sample;
-               u8 n = i >> 14;
-               u8 s = i >> 17;
+               u8 n = i2<<2 | i1>>6;
+               u8 s = i3<<7 | i2>>1;
                sample = g(1,n,12);
                { u8 tmp = n^i>>13;
                sample += g(s,tmp,10);
@@ -33,6 +37,11 @@ void main(void){
                sample += g(tmp1,tmp2,9);
                } //tmp1, tmp2
                putchar(sample<<4);
+
                i++;
+               i0++;
+               i1 += !i0;
+               i2 += !i1 && !i0;
+               i3 += !i2 && !i1 && !i0;
        }
 }
Imprint / Impressum