From ddf8bddf3df44e0dbbe6d26e1380e65a6448570a Mon Sep 17 00:00:00 2001 From: Daniele Lacamera Date: Thu, 12 Apr 2018 14:31:57 +0200 Subject: [PATCH] 5 --- study-on-bytebeat.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/study-on-bytebeat.py b/study-on-bytebeat.py index b6777d6..8a6f023 100755 --- a/study-on-bytebeat.py +++ b/study-on-bytebeat.py @@ -5,6 +5,7 @@ # License: GPL from random import randint +import sys b = 0x7E @@ -14,24 +15,24 @@ t=0 bass_note = [ 18, 9, 6, 16, 12, 10, 12, 10 ] -high_note = [ 18, 9, 2, 18, 12, 10, 12, 12 ] +high_note = [ 18, 9, 12, 32, 12, 10, 24, 27 ] -high2 = [16, 12, 6, 12, 8, 16, 8, 16, 16, 32, 32, 16, 8, 12, 8, 12 ] +high2 = [6, 18, 6, 16, 3, 10, 2, 27, 5, 27, 20, 16, 48, 32, 32, 24 ] snare = [ 0x41, 0x89, 0xAF, 0x49, 0xC6, 0x20, 0xC0, 0x65, 0xCA, 0xAE, 0xB8, 0x42, 0xAD, 0x52, 0x25, 0xAC, 0xFB, 0xD8, 0x6D, 0xD0, 0x6F, 0x41, 0xB5, 0x53, 0x20, 0x81, 0x97, 0x5F, 0xB4, 0xB7, 0x80, 0xC3, 0x89, 0x69, 0x53, 0x5C, 0xB9, 0x65, 0x22, 0xFB, 0x35, 0xE4, 0x94, 0x2E, 0xD9, 0x6E, 0xDB, 0xEA, 0x4B, 0x78, 0x7E, 0x8C, 0x58, 0x46, 0x2C, 0xD0, 0x3A, 0xC5, 0x68, 0x82, 0x81, 0x62, 0x6F, 0xA6, 0xE0, 0xB5, 0x4D, 0x56, 0xF9, 0xF4, 0xD3, 0xBC, 0x6C, 0x66, 0xB4, 0x45, 0xFF, 0x2B, 0xB3, 0xE1, 0x5A, 0x8D, 0xC2, 0x3A, 0xFF, 0x5B, 0xE1, 0x32, 0x23, 0xE4, 0x22, 0xD0, 0x9A, 0x43, 0xD8, 0xA3, 0xF5, 0x5A, 0x3E, 0x38, 0x60, 0x61, 0xCC, 0xFE, 0x3D, 0x84, 0x25, 0xCC, 0x78, 0xCB, 0x30, 0x7D, 0x8F, 0xAB, 0x60, 0x3E, 0xED, 0x7A, 0x9C, 0x9E, 0xFC, 0xF7, 0xC3, 0x5B, 0x80, 0xD0, 0x53, 0xCC] while 1: x = 0 u = (~(t & 0xFF) & 0xFF) - beat = t >> 10 + beat = t >> 11 part = (beat >> 3) # part - hit = (t - (beat << 10)) # Hit: 0-1024 - bnote = (t - ((t >> 9) << 9)) << 6 - note = (t - ((t >> 13)<<13)) << 6 - note2 = (t - ((t >> 14)<<14)) << 7 + hit = (t - (beat << 11)) # Hit: 0-1024 + bnote = (t - ((t >> 10) << 10)) << 5 + note = (t - ((t >> 14)<<14)) << 9 + note2 = (t - ((t >> 15)<<15)) << 9 #bass drum - x = ((t >> 4)|(t >> 3)) & b + x = ((t >> 5)|(t >> 4)) & b if (x > 0): x = b @@ -52,11 +53,11 @@ while 1: # voice 1 if ((part % 8) > 4) or (part > 0 and part % 8 == 0): - x ^= (note / high_note[beat % len(high_note)]) & (0x80) - elif (part > 7): + x ^= (note / high_note[beat % len(high_note)]) & (0x40) + elif (part > 0): x ^= (note2 / high2[beat % len(high2)]) & (0x50) - print chr(x & 0xFF) + sys.stdout.write(chr(x & 0xFF)) t+=1