From 05b982a56957b1accf4730f79106bc92beaf04b2 Mon Sep 17 00:00:00 2001 From: Daniele Lacamera Date: Thu, 12 Apr 2018 14:18:22 +0200 Subject: [PATCH] Removed newline, resampled --- study-on-bytebeat-2.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/study-on-bytebeat-2.py b/study-on-bytebeat-2.py index 2299ff7..03985b2 100755 --- a/study-on-bytebeat-2.py +++ b/study-on-bytebeat-2.py @@ -3,6 +3,7 @@ # Study on bytebeat # By danielinux # License: GPL +import sys from random import randint @@ -15,7 +16,7 @@ t=0 bass_note0 = [ 16, 0, 8, 0, 8, 16, 9, 0] bass_note1 = [ 12, 0, 12, 0, 0, 14,16,0] bass_note2 = [ 12, 0, 12, 0, 12, 14,16,0] -hi_note0 = [2, 4, 2, 4, 3,4,3,4] +hi_note0 = [4, 8, 4, 8, 6,8,6,8] hi_note1 = [12,6,12,6,14,12,14,12] bd = [ 1, 1, 0, 0, 0, 1, 0, 1 ] @@ -26,12 +27,12 @@ snare = [ 0x41, 0x89, 0xAF, 0x49, 0xC6, 0x20, 0xC0, 0x65, 0xCA, 0xAE, while 1: x = 0 u = (~(t & 0xFF) & 0xFF) - beat = t >> 9 + beat = t >> 10 part = (beat >> 3) # part - hit = (t - (beat << 9)) # Hit: 0-1024 - bnote = (t - ((t >> 9) << 9)) << 6 - note = (t - ((t >> 13)<<13)) << 6 - note2 = (t - ((t >> 14)<<14)) << 7 + hit = (t - (beat << 10)) # Hit: 0-1024 + bnote = (t - ((t >> 10) << 10)) << 6 + note = (t - ((t >> 14)<<14)) << 5 + note2 = (t - ((t >> 13)<<13)) << 7 if (bd[beat & 0x07]) and (hit < 32): x = 0xFF; @@ -62,7 +63,7 @@ while 1: if (hi_note1[beat % len(hi_note1)] != 0): x ^= (bnote / hi_note1[beat % len(hi_note1)]) & (0x30) - print chr(x & 0xFF) + sys.stdout.write(chr(x & 0xFF)) t+=1