new version
authorTobias Girstmair <tobi@isticktoit.net>
Thu, 4 Mar 2021 00:11:59 +0000 (01:11 +0100)
committerTobias Girstmair <tobi@isticktoit.net>
Thu, 4 Mar 2021 00:11:59 +0000 (01:11 +0100)
bsv.c

diff --git a/bsv.c b/bsv.c
index ed30e94626a3cb0d47f7a92f143c2e20a093a4da..6a8deeb9cb0d93610ceeef36c5caa2c9fd75df2a 100644 (file)
--- a/bsv.c
+++ b/bsv.c
@@ -11,7 +11,8 @@ u8 g(u8 x, u8 t, u8 o){
        u8 notes_ix = t & 0x7;
        if(3&i2)
                notes_ix += 8;
-       u8 result = ((i1<<8|i0)*notes[notes_ix])>>o;
+       u8 result = ((i1<<8|i0)*notes[notes_ix])>>8;  // keep hi byte
+       result >>= o;
        result &= x;
        result &= 3;
        return result;
@@ -23,19 +24,19 @@ void main(void){
                u8 n = i2<<2 | i1>>6;
                u8 s = i2>>1;
 
-               sample = g(1,n,12);
+               sample = g(1,n,4);
 
                { u8 tmp;
                  tmp = i2<<3 | i1>>5;
                  tmp ^= n;
-               sample += g(s,tmp,10);
+               sample += g(s,tmp,2);
                } //tmp
 
                { u8 tmp1 = s/3;
                  u8 tmp2;
                  tmp2 = (i2<<5|i1>>3)%3;
                  tmp2 += n;
-               sample += g(tmp1,tmp2,10);
+               sample += g(tmp1,tmp2,2);
                } //tmp1, tmp2
 
                { u8 tmp1 = s/5;
@@ -44,7 +45,7 @@ void main(void){
                    tmp2 -= tmp3;
                  } // tmp3
                  tmp2 += 8;
-               sample += g(tmp1,tmp2,9);
+               sample += g(tmp1,tmp2,1);
                } //tmp1, tmp2
 
                putchar(sample<<4);
Imprint / Impressum