..

author: sbt date: 2014-06-23 12:00:45+00:00 title: Pacman et MSPacman : les musiques et les effets category: abandonware tags: pacman, python

Pacman et MSPacman : les musiques et les effets

J'ai modifié mon code précédent afin d'avoir accès aux véritables données "utiles" et pour la première fois au monde, un accès complet et utilisable des données :

# Pacman and MS-Pacman
# High Level Music and Effect fully extracted for the first time
# All work done by sbec in 2014
# Version 20140714

class MusicsAndEffects(object):
    wavetable = [
            [-1,1,2,3,4,5,5,6,6,6,5,5,4,3,2,1,-1,-3,-4,-5,-6,-7,-7,-8,-8,-8,-7,-7,-6,-5,-4,-3],     # S = sinus or Synth Bass (smooth) to smooth tone
            [-1,4,6,6,5,3,1,2,3,3,2,1,-2,-4,-5,-3,-1,1,3,2,0,-3,-4,-5,-5,-4,-3,-5,-7,-8,-8,-6],     # D = decay or Idling Engine to higher tone
            [-1,2,4,5,6,5,4,2,-1,-4,-6,-7,-8,-7,-6,-4,-1,3,5,6,5,3,-1,-5,-7,-8,-7,-5,-1,6,-1,-8],   # 2 * Freq(S) or Tank Engine to sawtoothy tone
            [-1,5,3,0,3,5,1,-2,3,6,4,-1,1,2,-2,-6,-1,4,0,-4,-3,-1,-6,-8,-5,0,-3,-7,-5,-2,-5,-7],    # 2 * Freq(D) or Noisy Bass to bell-like noise
            [-8,0,7,-1,-7,0,6,-1,-6,0,5,-1,-5,0,4,-1,-4,0,3,-1,-3,0,2,-1,-2,0,1,-1,-1,0,0,-1],      # 7 * Freq(S) + vol decay or Pingy Bass to electric razor
            [-1,0,-2,1,-3,2,-4,3,-5,4,-6,5,-7,6,-8,7,-8,7,-7,6,-6,5,-5,4,-4,3,-3,2,-2,1,-1,0],      # Chirpy to almost silent
            [-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,7,6,5,4,3,2,1,0,-1,-2,-3,-4,-5,-6,-7,-8],      # triangle or almost silent to smooth nice tone
            [-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7],      # saw or brappy to droning high pitch
    ]

    # wave, freqstart, freqinc, duration, reverse, freqincrepeat, repeat, voltype, volval, volinc
    effects = {
        'ms_0_freelife' :   [3, 12000,     0,  12, 0,     0, 10, 1, 15, 0],
        'ms_1_credit' :     [2, 12000, -1875,   7, 1,     0,  2, 0, 15, 0],
        'ms_2_siren1' :     [1,  1500,  9000,   8, 0,     0,  0, 0,  2, 0],
        'ms_3_siren2' :     [1,  1500,  9000,   9, 0,     0,  0, 0,  2, 0],
        'ms_4_siren3' :     [1,  3000,  9000,  10, 0,     0,  0, 0,  2, 0],
        'ms_5_siren4' :     [1,  4500,  9000,  11, 0,     0,  0, 0,  2, 0],
        'ms_6_siren5' :     [1,  6000,  9000,  12, 0,     0,  6, 0,  2, 0],
        'ms_7_bg_blue' :    [4,     0,    70,   8, 0,    23,  0, 0, 10, 0],
        'ms_8_bg_ghosts' :  [6,   164, -2836, 111, 0,     0,  0, 0,  4, 0],
        #'ms_9' :           [0, 24000,     0,   0, 0,     0,  0, 0,  8, 0],
        'ms_A_eatdot' :     [4,   656,  -686,   8, 0,     0,  1, 0,  6, 0],
        'ms_B_eatdot' :     [4,   656,  -686,   8, 0,     0,  1, 0,  6, 0],
        'ms_C_eatfruit' :   [6, 18000, -1500,  12, 1,     0,  2, 0,  8, 0],
        'ms_D_eatghost' :   [6,     0,  3000,  10, 0, 10500,  3, 0, 12, 0],
        'ms_E_death' :      [6, 21000,  -750,  18, 0, -3000,  4, 0, 15,-4],
        'ms_F_fruitmove' :  [2,   187,   187,   6, 0,     0,  1, 0,  7, 0],
        'pac_0_freelife' :  [3, 12000,     0,  12, 0,     0, 10, 1, 15, 0],
        'pac_1_credit' :    [2, 12000, -1875,   7, 1,     0,  2, 0, 15, 0],
        'pac_2_siren1' :    [6, 12000,  1500,  12, 1,     0,  0, 0,  6, 0],
        'pac_3_siren2' :    [6, 15000,  1875,  11, 1,     0,  0, 0,  6, 0],
        'pac_4_siren3' :    [6, 18000,  2250,  10, 1,     0,  0, 0,  6, 0],
        'pac_5_siren4' :    [6, 22500,  2625,   9, 1,     0,  0, 0,  6, 0],
        'pac_6_siren5' :    [6, 27000,  3000,   8, 1,     0,  0, 0,  6, 0],
        'pac_7' :           [4,     0,  1125,   8, 0,     0,  0, 0, 10, 0],
        'pac_8_eatghost2' : [0, 84000, -4500,  16, 0,     0,  0, 0, 10, 0],
        #'pac_9' :           [0, 24000,     0,   0, 0,     0,  0, 0,  8, 0],
        'pac_A_eatdot1' :   [2, 18000, -2250,   6, 0,     0,  1, 0, 12, 0],
        'pac_B_eatdot2' :   [2,  3000,  2250,   6, 0,     0,  1, 0, 12, 0],
        'pac_C_eatfruit':   [6, 18000, -1500,  12, 1,     0,  2, 0, 15, 0],
        'pac_D_eatghost' :  [5,     0,    94,  32, 0,     0,  1, 0, 12, 0],
        'pac_E_death' :     [1, 24000,  -750,   6, 1, -1500, 28, 0, 15,-1],
        'pac_F' :           [0,     0,  6000,  12, 0,     0,  1, 0,  8, 0]
    }

    # octave number 4 in real world
    octave = {
        'C-': 4*440/pow(2,9/12),
        'C#': 4*440/pow(2,8/12),
        'D-': 4*440/pow(2,7/12),
        'D#': 4*440/pow(2,6/12),
        'E-': 4*440/pow(2,5/12),
        'F-': 4*440/pow(2,4/12),
        'F#': 4*440/pow(2,3/12),
        'G-': 4*440/pow(2,2/12),
        'G#': 4*440/pow(2,1/12),
        'A-': 4*440,
        'A#': 4*440*pow(2,1/12),
        'B-': 4*440*pow(2,2/12)
    }

    # key : [ [ [wave, note, duration (1/60 s), volume, volEffect], ...] ...] ...
    musics = {
    'ms_act1' : [[
        [3, "---",  8, 10, 2],
        [3, "F-4",  8, 10, 2],
        [3, "---",  8, 10, 2],
        [3, "F-4",  4, 10, 2],
        [3, "---",  4, 10, 2],
        [3, "F-4", 16, 10, 2],
        [3, "---", 16, 10, 2],
        [3, "---",  8, 10, 2],
        [3, "F-4",  8, 10, 2],
        [3, "---",  8, 10, 2],
        [3, "F-4",  4, 10, 2],
        [3, "---",  4, 10, 2],
        [3, "F-4", 16, 10, 2],
        [3, "---", 16, 10, 2],
        [3, "---",  8, 10, 2],
        [3, "F-4",  8, 10, 2],
        [3, "---",  8, 10, 2],
        [3, "F-4",  4, 10, 2],
        [3, "---",  4, 10, 2],
        [3, "F-4", 16, 10, 2],
        [3, "---", 16, 10, 2],
        [3, "---",  8, 10, 2],
        [3, "C-4",  8, 10, 2],
        [3, "---",  8, 10, 2],
        [3, "C-4",  4, 10, 2],
        [3, "---",  4, 10, 2],
        [3, "C-4", 16, 10, 2],
        [3, "---", 16, 10, 2],
        [3, "F-4", 32, 10, 0],
        [3, "D#4", 32, 10, 0],
        [3, "C#4", 32, 10, 0],
        [3, "C-4", 32, 10, 0],
        [3, "F-4", 16, 10, 1],
        [3, "G#4", 16, 10, 1],
        [3, "A#4", 16, 10, 1],
        [3, "C-4", 16, 10, 1],
        [3, "D#5",  8, 10, 1],
        [3, "C-5",  8, 10, 1],
        [3, "A#4",  8, 10, 1],
        [3, "G#4",  8, 10, 1],
        [3, "F-4", 32, 10, 1],
    ],[
        [0, "G#7",  8, 10, 0],
        [0, "A#7",  8, 10, 0],
        [0, "G#7",  8, 10, 0],
        [0, "F-7", 16, 10, 0],
        [0, "C-7",  8, 10, 0],
        [0, "D#7",  8, 10, 0],
        [0, "E-7",  8, 10, 0],
        [0, "F-7", 16, 10, 0],
        [0, "F-7", 16, 10, 0],
        [0, "D#7",  8, 10, 0],
        [0, "F-7",  8, 10, 0],
        [0, "D#7",  8, 10, 0],
        [0, "C-7",  8, 10, 0],
        [0, "G#7",  8, 10, 0],
        [0, "A#7",  8, 10, 0],
        [0, "G#7",  8, 10, 0],
        [0, "F-7", 16, 10, 0],
        [0, "C-7",  8, 10, 0],
        [0, "D#7",  8, 10, 0],
        [0, "D#7",  8, 10, 0],
        [0, "C-7", 32, 10, 0],
        [0, "---",  8, 10, 0],
        [0, "C-8",  8, 10, 0],
        [0, "D#8",  8, 10, 0],
        [0, "E-8",  8, 10, 0],
        [0, "E-8",  2, 10, 0],
        [0, "F-8",  8, 10, 0],
        [0, "---",  2, 10, 0],
        [0, "---",  4, 10, 0],
        [0, "E-8",  2, 10, 0],
        [0, "F-8",  8, 10, 0],
        [0, "---",  2, 10, 0],
        [0, "---",  4, 10, 0],
        [0, "D#8",  4, 10, 0],
        [0, "F-8",  4, 10, 0],
        [0, "D#8",  4, 10, 0],
        [0, "C-8",  4, 10, 0],
        [0, "A#7",  8, 10, 0],
        [0, "G#7",  8, 10, 0],
        [0, "A#7",  8, 10, 0],
        [0, "G#7",  8, 10, 0],
        [0, "A#7",  8, 10, 0],
        [0, "C-8", 16, 10, 0],
        [0, "A#7",  8, 10, 0],
        [0, "G#7",  8, 10, 0],
        [0, "F-7",  8, 10, 0],
        [0, "D#7",  8, 10, 0],
        [0, "F-7",  8, 10, 0],
        [0, "D#7",  8, 10, 0],
        [0, "C-7",  8, 10, 0],
        [0, "D#7",  8, 10, 0],
        [0, "C-7",  8, 10, 0],
        [0, "A#6",  8, 10, 0],
        [0, "G#6",  8, 10, 0],
        [0, "F-6", 32, 10, 0],
        [0, "F-6", 32, 10, 0],
    ]],
    'ms_act2' : [[
        [3, "---", 16, 10, 2],
        [3, "B-5",  8, 10, 2],
        [3, "A#5",  8, 10, 2],
        [3, "A-5",  8, 10, 2],
        [3, "G#5",  8, 10, 2],
        [3, "G#5",  8, 10, 2],
        [3, "G-5",  8, 10, 2],
        [3, "F#5", 16, 10, 2],
        [3, "F-5",  8, 10, 2],
        [3, "E-5",  8, 10, 2],
        [3, "D#5",  8, 10, 2],
        [3, "D-5",  8, 10, 2],
        [3, "D-5",  8, 10, 2],
        [3, "C#5",  8, 10, 2],
        [3, "C-5", 16, 10, 2],
        [3, "G-4", 32, 10, 2],
        [3, "G-4", 16, 10, 2],
        [3, "G-4",  8, 10, 2],
        [3, "A-4",  4, 10, 2],
        [3, "B-4",  4, 10, 2],
        [3, "C-5", 16, 10, 2],
        [3, "E-5", 16, 10, 2],
        [3, "G-4", 16, 10, 2],
        [3, "E-5", 16, 10, 2],
        [3, "C-5", 16, 10, 2],
        [3, "E-5", 16, 10, 2],
        [3, "G-4", 16, 10, 2],
        [3, "E-5", 16, 10, 2],
        [3, "C-5", 16, 10, 2],
        [3, "E-5", 16, 10, 2],
        [3, "G-4", 16, 10, 2],
        [3, "E-5", 16, 10, 2],
        [3, "E-5", 16, 10, 2],
        [3, "G-5", 16, 10, 2],
        [3, "D#5", 16, 10, 2],
        [3, "F#5", 16, 10, 2],
        [3, "D-5", 16, 10, 2],
        [3, "F-5", 16, 10, 2],
        [3, "G-4", 16, 10, 2],
        [3, "F-5", 16, 10, 2],
        [3, "D-5", 16, 10, 2],
        [3, "F-5", 16, 10, 2],
        [3, "G-4", 16, 10, 2],
        [3, "F-5", 16, 10, 2],
        [3, "D-5", 16, 10, 2],
        [3, "F-5", 16, 10, 2],
        [3, "G-4", 16, 10, 2],
        [3, "F-5", 16, 10, 2],
        [3, "F-5", 32, 10, 2],
        [3, "D-5", 32, 10, 2],
        [3, "E-5",  8, 10, 2],
        [3, "F-5",  8, 10, 2],
        [3, "F#5",  8, 10, 2],
        [3, "G-5",  8, 10, 2],
        [3, "G-5",  8, 10, 2],
        [3, "E-5",  8, 10, 2],
        [3, "D-5",  8, 10, 2],
        [3, "G-4",  8, 10, 2],
        [3, "C-5", 16, 10, 2],
        [3, "E-5", 16, 10, 2],
        [3, "G-4", 16, 10, 2],
        [3, "E-5", 16, 10, 2],
        [3, "C-5", 16, 10, 2],
        [3, "E-5", 16, 10, 2],
        [3, "G-4", 16, 10, 2],
        [3, "E-5", 16, 10, 2],
        [3, "F-4", 16, 10, 2],
        [3, "F-5", 16, 10, 2],
        [3, "E-5", 16, 10, 2],
        [3, "C#5", 16, 10, 2],
        [3, "D-5", 16, 10, 2],
        [3, "B-4", 16, 10, 2],
        [3, "A-4", 16, 10, 2],
        [3, "G-4", 16, 10, 2],
        [3, "F-4", 16, 10, 2],
        [3, "---", 16, 10, 2],
        [3, "---", 16, 10, 2],
        [3, "F-5", 16, 10, 2],
        [3, "E-5", 16, 10, 2],
        [3, "---", 16, 10, 2],
        [3, "---", 16, 10, 2],
        [3, "F-4", 16, 10, 2],
        [3, "---", 16, 10, 2],
        [3, "F-5", 16, 10, 2],
        [3, "---", 16, 10, 2],
        [3, "F-5", 16, 10, 2],
        [3, "C-5", 16, 10, 2],
        [3, "G-4", 16, 10, 2],
        [3, "C-4", 16, 10, 2],
    ],[
        [0, "G-7", 16, 10, 0],
        [0, "B-7",  8, 10, 0],
        [0, "C-8",  8, 10, 0],
        [0, "C#8",  8, 10, 0],
        [0, "D-8",  8, 10, 0],
        [0, "D-8",  8, 10, 0],
        [0, "C-8",  8, 10, 0],
        [0, "D-8", 16, 10, 0],
        [0, "B-7",  8, 10, 0],
        [0, "D-8",  8, 10, 0],
        [0, "E-8",  8, 10, 0],
        [0, "F-8",  8, 10, 0],
        [0, "F-8",  8, 10, 0],
        [0, "E-8",  8, 10, 0],
        [0, "F-8", 16, 10, 0],
        [0, "B-8",  8, 10, 0],
        [0, "A-8",  8, 10, 0],
        [0, "G-8",  8, 10, 0],
        [0, "F-8",  8, 10, 0],
        [0, "E-8",  8, 10, 0],
        [0, "F-8", 16, 10, 0],
        [0, "B-7",  8, 10, 0],
        [0, "C-8", 16, 10, 0],
        [0, "C-7", 32, 10, 0],
        [0, "G-7", 16, 10, 0],
        [0, "E-8",  8, 10, 0],
        [0, "F-8",  8, 10, 0],
        [0, "F#8",  8, 10, 0],
        [0, "G-8",  8, 10, 0],
        [0, "C-8",  8, 10, 0],
        [0, "D-8",  8, 10, 0],
        [0, "D#8",  8, 10, 0],
        [0, "E-8",  8, 10, 0],
        [0, "C-8",  8, 10, 0],
        [0, "E-8",  8, 10, 0],
        [0, "C-8",  8, 10, 0],
        [0, "G-7",  8, 10, 0],
        [0, "G-7",  8, 10, 0],
        [0, "E-7",  8, 10, 0],
        [0, "F-7",  8, 10, 0],
        [0, "F#7",  8, 10, 0],
        [0, "G-7", 32, 10, 0],
        [0, "A#7", 32, 10, 0],
        [0, "B-7", 32, 10, 0],
        [0, "B-7", 16, 10, 0],
        [0, "F-7", 16, 10, 0],
        [0, "F-8",  8, 10, 0],
        [0, "E-8",  8, 10, 0],
        [0, "B-7",  8, 10, 0],
        [0, "C-8",  8, 10, 0],
        [0, "E-8",  8, 10, 0],
        [0, "D-8",  8, 10, 0],
        [0, "A#7",  8, 10, 0],
        [0, "B-7",  8, 10, 0],
        [0, "D-8",  8, 10, 0],
        [0, "F-8",  8, 10, 0],
        [0, "A-8",  8, 10, 0],
        [0, "G-8",  8, 10, 0],
        [0, "G-8",  8, 10, 0],
        [0, "F-8",  8, 10, 0],
        [0, "D-8",  8, 10, 0],
        [0, "B-7",  8, 10, 0],
        [0, "A-7", 32, 10, 0],
        [0, "G-7", 32, 10, 0],
        [0, "C-8",  8, 10, 0],
        [0, "D-8",  8, 10, 0],
        [0, "D#8",  8, 10, 0],
        [0, "E-8",  8, 10, 0],
        [0, "A-7",  8, 10, 0],
        [0, "A#7",  8, 10, 0],
        [0, "B-7",  8, 10, 0],
        [0, "D-8",  8, 10, 0],
        [0, "E-8",  8, 10, 0],
        [0, "F-8",  8, 10, 0],
        [0, "F#8",  8, 10, 0],
        [0, "G-8",  8, 10, 0],
        [0, "C-8",  8, 10, 0],
        [0, "D-8",  8, 10, 0],
        [0, "D#8",  8, 10, 0],
        [0, "E-8",  8, 10, 0],
        [0, "C-8",  8, 10, 0],
        [0, "E-8",  8, 10, 0],
        [0, "C-8",  8, 10, 0],
        [0, "G-7",  8, 10, 0],
        [0, "G-7",  4, 10, 0],
        [0, "G-7",  4, 10, 0],
        [0, "G-7",  8, 10, 0],
        [0, "F#7",  8, 10, 0],
        [0, "G-7",  8, 10, 0],
        [0, "A-7", 32, 10, 0],
        [0, "G#7", 32, 10, 0],
        [0, "A-7", 32, 10, 0],
        [0, "A-7",  8, 10, 0],
        [0, "A-7",  8, 10, 0],
        [0, "A-7", 16, 10, 0],
        [0, "F-8",  8, 10, 0],
        [0, "E-8",  8, 10, 0],
        [0, "D-8",  8, 10, 0],
        [0, "C-8",  8, 10, 0],
        [0, "C-8",  8, 10, 0],
        [0, "D-8",  8, 10, 0],
        [0, "E-8", 16, 10, 0],
        [0, "E-8",  8, 10, 0],
        [0, "D-8",  8, 10, 0],
        [0, "C-8",  8, 10, 0],
        [0, "G-7",  8, 10, 0],
        [0, "G-7",  8, 10, 0],
        [0, "C-7",  8, 10, 0],
        [0, "D-7",  8, 10, 0],
        [0, "A-7",  8, 10, 0],
        [0, "G-7", 32, 10, 0],
        [0, "B-7",  8, 10, 0],
        [0, "F-8",  8, 10, 0],
        [0, "A-7",  8, 10, 0],
        [0, "B-7",  8, 10, 0],
        [0, "C-8", 16, 10, 0],
        [0, "---", 16, 10, 0],
        [0, "C-8", 16, 10, 0],
    ]],
    'ms_act3' : [[
        [2, "E-4",  8, 10, 2],
        [2, "---", 16, 10, 2],
        [2, "G-4",  8, 10, 2],
        [2, "---",  8, 10, 2],
        [2, "G-4",  8, 10, 2],
        [2, "F#4",  8, 10, 2],
        [2, "F-4",  8, 10, 2],
        [2, "E-4",  8, 10, 2],
        [2, "---", 16, 10, 2],
        [2, "C-4",  8, 10, 2],
        [2, "---",  8, 10, 2],
        [2, "C-4",  8, 10, 2],
        [2, "E-4",  8, 10, 2],
        [2, "G-4",  8, 10, 2],
        [2, "F-4",  8, 10, 2],
        [2, "---", 16, 10, 2],
        [2, "D-4",  8, 10, 2],
        [2, "---", 16, 10, 2],
        [2, "F-4", 16, 10, 2],
        [2, "---", 16, 10, 2],
        [2, "E-4", 16, 10, 2],
        [2, "---", 16, 10, 2],
        [2, "E-4", 16, 10, 2],
        [2, "---",  8, 10, 2],
        [2, "F-4", 16, 10, 2],
        [2, "G-4",  8, 10, 2],
        [2, "E-4",  8, 10, 2],
    ],[
        [0, "E-7",  8, 10, 0],
        [0, "D#7",  8, 10, 0],
        [0, "E-7",  8, 10, 0],
        [0, "G-7", 16, 10, 0],
        [0, "F#7",  8, 10, 0],
        [0, "G-7", 16, 10, 0],
        [0, "C-7",  8, 10, 0],
        [0, "D-7",  8, 10, 0],
        [0, "D#7",  8, 10, 0],
        [0, "E-7", 16, 10, 0],
        [0, "D#7",  8, 10, 0],
        [0, "E-7", 16, 10, 0],
        [0, "A-7",  8, 10, 0],
        [0, "G#7",  8, 10, 0],
        [0, "A-7",  8, 10, 0],
        [0, "B-7", 16, 10, 0],
        [0, "E-8",  8, 10, 0],
        [0, "D-8", 16, 10, 0],
        [0, "---", 16, 10, 0],
        [0, "C-8", 16, 10, 0],
        [0, "---", 16, 10, 0],
        [0, "C-8", 16, 10, 0],
        [0, "---",  8, 10, 0],
        [0, "A-7", 16, 10, 0],
        [0, "G-7",  8, 10, 0],
        [0, "C-8",  8, 10, 0],
    ]],
    'ms_start' : [[
        [2, "---",  4, 10, 0],
        [2, "---",  8, 10, 0],
        [2, "F-4", 16, 10, 0],
        [2, "---", 16, 10, 0],
        [2, "C-4", 16, 10, 0],
        [2, "---", 16, 10, 0],
        [2, "F-4", 16, 10, 0],
        [2, "---", 16, 10, 0],
        [2, "G-4",  8, 10, 0],
        [2, "A-4",  8, 10, 0],
        [2, "A#4",  8, 10, 0],
        [2, "G-4",  8, 10, 0],
        [2, "A-4",  8, 10, 0],
        [2, "G-4",  8, 10, 0],
        [2, "F-4",  8, 10, 0],
        [2, "A-4",  8, 10, 0],
        [2, "G-4",  8, 10, 0],
        [2, "F-4",  8, 10, 0],
        [2, "E-4",  8, 10, 0],
        [2, "G-4",  8, 10, 0],
        [2, "F-4", 16, 10, 0],
        [2, "C-4", 16, 10, 0],
        [2, "F-4", 16, 10, 0],
    ],[
        [0, "C-7",  4, 10, 0],
        [0, "D-7",  4, 10, 0],
        [0, "E-7",  4, 10, 0],
        [0, "F-7", 16, 10, 0],
        [0, "A-7", 16, 10, 0],
        [0, "G-7", 16, 10, 0],
        [0, "A#7", 16, 10, 0],
        [0, "A-7",  8, 10, 0],
        [0, "A#7",  8, 10, 0],
        [0, "C-8",  8, 10, 0],
        [0, "A-7",  8, 10, 0],
        [0, "G-7", 16, 10, 0],
        [0, "A#7", 16, 10, 0],
        [0, "A-7",  8, 10, 0],
        [0, "A#7",  8, 10, 0],
        [0, "C-8",  8, 10, 0],
        [0, "A-7",  8, 10, 0],
        [0, "A#7",  8, 10, 0],
        [0, "C-8",  8, 10, 0],
        [0, "D-8",  8, 10, 0],
        [0, "E-8",  8, 10, 0],
        [0, "F-8", 16, 10, 0],
        [0, "E-8", 16, 10, 0],
        [0, "F-8", 16, 10, 0],
        ]],
    'pac_act' : [[
        [2, "F#4",  8, 15, 1],
        [2, "---",  4, 15, 1],
        [2, "---",  2, 15, 1],
        [2, "F#4",  4, 15, 1],
        [2, "---",  2, 15, 1],
        [2, "F#4",  8, 15, 1],
        [2, "---",  4, 15, 1],
        [2, "---",  2, 15, 1],
        [2, "F#4",  4, 15, 1],
        [2, "---",  2, 15, 1],
        [2, "F#4",  8, 15, 1],
        [2, "---",  4, 15, 1],
        [2, "---",  2, 15, 1],
        [2, "F#4",  4, 15, 1],
        [2, "---",  2, 15, 1],
        [2, "A#4",  4, 15, 1],
        [2, "---",  1, 15, 1],
        [2, "B-4",  4, 15, 1],
        [2, "---",  1, 15, 1],
        [2, "C-5",  4, 15, 1],
        [2, "---",  1, 15, 1],
        [2, "C#5",  4, 15, 1],
        [2, "---",  1, 15, 1],
        [2, "F#4",  8, 15, 1],
        [2, "---",  4, 15, 1],
        [2, "---",  2, 15, 1],
        [2, "F#4",  4, 15, 1],
        [2, "---",  2, 15, 1],
        [2, "F#4",  8, 15, 1],
        [2, "---",  4, 15, 1],
        [2, "---",  2, 15, 1],
        [2, "F#4",  4, 15, 1],
        [2, "---",  2, 15, 1],
        [2, "F#4",  8, 15, 1],
        [2, "---",  4, 15, 1],
        [2, "---",  2, 15, 1],
        [2, "F#4",  4, 15, 1],
        [2, "---",  2, 15, 1],
        [2, "A#4",  4, 15, 1],
        [2, "---",  1, 15, 1],
        [2, "B-4",  4, 15, 1],
        [2, "---",  1, 15, 1],
        [2, "C-5",  4, 15, 1],
        [2, "---",  1, 15, 1],
        [2, "C#5",  4, 15, 1],
        [2, "---",  1, 15, 1],
        [2, "F#4",  8, 15, 1],
        [2, "---",  4, 15, 1],
        [2, "---",  2, 15, 1],
        [2, "F#4",  4, 15, 1],
        [2, "---",  2, 15, 1],
        [2, "F#4",  8, 15, 1],
        [2, "---",  4, 15, 1],
        [2, "---",  2, 15, 1],
        [2, "F#4",  4, 15, 1],
        [2, "---",  2, 15, 1],
        [2, "F#4",  8, 15, 1],
        [2, "---",  4, 15, 1],
        [2, "---",  2, 15, 1],
        [2, "F#4",  4, 15, 1],
        [2, "---",  2, 15, 1],
        [2, "A#4",  4, 15, 1],
        [2, "---",  1, 15, 1],
        [2, "B-4",  4, 15, 1],
        [2, "---",  1, 15, 1],
        [2, "C-5",  4, 15, 1],
        [2, "---",  1, 15, 1],
        [2, "C#5",  4, 15, 1],
        [2, "---",  1, 15, 1],
        [2, "F#5",  8, 15, 1],
        [2, "F#4",  2, 15, 1],
        [2, "C#5",  4, 15, 1],
        [2, "---",  1, 15, 1],
        [2, "C-5",  4, 15, 1],
        [2, "---",  1, 15, 1],
        [2, "B-4",  4, 15, 1],
        [2, "---",  1, 15, 1],
        [2, "A-4",  4, 15, 1],
        [2, "---",  1, 15, 1],
        [2, "F#4",  4, 15, 1],
        [2, "---",  1, 15, 1],
        [2, "F-4",  4, 15, 1],
        [2, "---",  1, 15, 1],
        [2, "E-4",  8, 15, 1],
        [2, "---",  2, 15, 1],
        [2, "F-4",  8, 15, 1],
        [2, "---",  2, 15, 1],
        [2, "F#4",  8, 15, 1],
        [2, "F#4",  4, 15, 1],
        [2, "---",  8, 15, 1],
    ],[
        [1, "F-6",  2, 15, 0],
        [1, "F#6",  8, 15, 0],
        [1, "F-6",  2, 15, 0],
        [1, "F#6",  8, 15, 0],
        [1, "F-6",  2, 15, 0],
        [1, "F#6",  8, 15, 0],
        [1, "D-6",  2, 15, 0],
        [1, "D#6",  4, 15, 0],
        [1, "C#6",  4, 15, 0],
        [1, "F#6",  4, 15, 0],
        [1, "---",  2, 15, 0],
        [1, "F#6",  8, 15, 0],
        [1, "A-6",  2, 15, 0],
        [1, "A#6", 16, 15, 0],
        [1, "---",  8, 15, 0],
        [1, "F-6",  2, 15, 0],
        [1, "F#6",  8, 15, 0],
        [1, "F-6",  2, 15, 0],
        [1, "F#6",  8, 15, 0],
        [1, "F-6",  2, 15, 0],
        [1, "F#6",  8, 15, 0],
        [1, "D-6",  2, 15, 0],
        [1, "D#6",  4, 15, 0],
        [1, "C#6",  4, 15, 0],
        [1, "F#6",  4, 15, 0],
        [1, "---",  2, 15, 0],
        [1, "F#6",  8, 15, 0],
        [1, "D-6",  2, 15, 0],
        [1, "D#6", 16, 15, 0],
        [1, "---",  8, 15, 0],
        [1, "F-6",  2, 15, 0],
        [1, "F#6",  8, 15, 0],
        [1, "F-6",  2, 15, 0],
        [1, "F#6",  8, 15, 0],
        [1, "F-6",  2, 15, 0],
        [1, "F#6",  8, 15, 0],
        [1, "D-6",  2, 15, 0],
        [1, "D#6",  4, 15, 0],
        [1, "C#6",  4, 15, 0],
        [1, "F#6",  4, 15, 0],
        [1, "---",  2, 15, 0],
        [1, "F#6",  8, 15, 0],
        [1, "G#6",  2, 15, 0],
        [1, "A-6",  8, 15, 0],
        [1, "A#6",  2, 15, 0],
        [1, "B-6",  8, 15, 0],
        [1, "---",  2, 15, 0],
        [1, "B-6",  2, 15, 0],
        [1, "C-7",  8, 15, 0],
        [1, "C-7",  4, 15, 0],
        [1, "A#6",  2, 15, 0],
        [1, "B-6",  8, 15, 0],
        [1, "G#6",  2, 15, 0],
        [1, "A-6",  8, 15, 0],
        [1, "F#6",  8, 15, 0],
        [1, "F#6",  2, 15, 0],
        [1, "G#6",  2, 15, 0],
        [1, "A-6",  8, 15, 0],
        [1, "A-6",  4, 15, 0],
        [1, "F-6",  2, 15, 0],
        [1, "F#6", 16, 15, 0],
        [1, "---",  8, 15, 0],
    ]],
    'pac_start' : [[
        [2, "C#4", 16, 15, 1],
        [2, "---",  8, 15, 1],
        [2, "G#4",  8, 15, 1],
        [2, "C#4", 16, 15, 1],
        [2, "---",  8, 15, 1],
        [2, "G#4",  8, 15, 1],
        [2, "D-4", 16, 15, 1],
        [2, "---",  8, 15, 1],
        [2, "A-4",  8, 15, 1],
        [2, "D-4", 16, 15, 1],
        [2, "---",  8, 15, 1],
        [2, "A-4",  8, 15, 1],
        [2, "C#4", 16, 15, 1],
        [2, "---",  8, 15, 1],
        [2, "G#4",  8, 15, 1],
        [2, "C#4", 16, 15, 1],
        [2, "---",  8, 15, 1],
        [2, "G#4",  8, 15, 1],
        [2, "G#4", 16, 15, 1],
        [2, "A#4", 16, 15, 1],
        [2, "C-5", 16, 15, 1],
        [2, "C#5", 16, 15, 1],
    ],[
        [0, "C#7",  4, 15, 0],
        [0, "---",  4, 15, 0],
        [0, "C#8",  4, 15, 0],
        [0, "---",  4, 15, 0],
        [0, "G#7",  4, 15, 0],
        [0, "---",  4, 15, 0],
        [0, "F-7",  4, 15, 0],
        [0, "---",  4, 15, 0],
        [0, "C#8",  4, 15, 0],
        [0, "G#7",  4, 15, 0],
        [0, "---",  8, 15, 0],
        [0, "F-7",  8, 15, 0],
        [0, "---",  8, 15, 0],
        [0, "D-7",  4, 15, 0],
        [0, "---",  4, 15, 0],
        [0, "D-8",  4, 15, 0],
        [0, "---",  4, 15, 0],
        [0, "A-7",  4, 15, 0],
        [0, "---",  4, 15, 0],
        [0, "F#7",  4, 15, 0],
        [0, "---",  4, 15, 0],
        [0, "D-8",  4, 15, 0],
        [0, "A-7",  4, 15, 0],
        [0, "---",  8, 15, 0],
        [0, "F#7",  8, 15, 0],
        [0, "---",  8, 15, 0],
        [0, "C#7",  4, 15, 0],
        [0, "---",  4, 15, 0],
        [0, "C#8",  4, 15, 0],
        [0, "---",  4, 15, 0],
        [0, "G#7",  4, 15, 0],
        [0, "---",  4, 15, 0],
        [0, "F-7",  4, 15, 0],
        [0, "---",  4, 15, 0],
        [0, "C#8",  4, 15, 0],
        [0, "G#7",  4, 15, 0],
        [0, "---",  8, 15, 0],
        [0, "F-7",  8, 15, 0],
        [0, "---",  8, 15, 0],
        [0, "E-7",  4, 15, 0],
        [0, "F-7",  4, 15, 0],
        [0, "F#7",  4, 15, 0],
        [0, "---",  4, 15, 0],
        [0, "F#7",  4, 15, 0],
        [0, "G-7",  4, 15, 0],
        [0, "G#7",  4, 15, 0],
        [0, "---",  4, 15, 0],
        [0, "G#7",  4, 15, 0],
        [0, "A-7",  4, 15, 0],
        [0, "A#7",  4, 15, 0],
        [0, "---",  4, 15, 0],
        [0, "C#8",  8, 15, 0],
    ]]
    }

if __name__ == '__main__':
    print(MusicsAndEffects.wavetable)
    print(MusicsAndEffects.effects)
    print(MusicsAndEffects.musics)

Et le générateur :

#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Copyright 2014 Sebastien Bechet

#  This program is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License Version 3 as
#  published by the Free Software Foundation.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.

# [ms][Pac] WSG Sound Generator and more ....
# High Quality - version 20140714

# Thank you :
# Frederic Vecoven (frederic@vecoven.com) (http://www.vecoven.com/elec/pacman/pacman.html)

import array, wave, os
from wildcardman import MusicsAndEffects

# debug
#import pdb
# breakpoint: pdb.set_trace()

class Track(object):
    wave = 0
    frequency = 0
    voltype = 0
    volume = 0
    counter = 0
    accumulator = 0

    def __init__(self):
        self.counter = 0
        self.frequency = 0
        self.volume = 0
        self.voltype = 0
        self.accumulator = 0

    def volumeEffect(self):
        #if self.voltype == 0: # constant volume
        #    return self.volume
        if self.volume > 0:
            if self.voltype == 1: # decreasing volume
                self.volume -= 1
            elif self.voltype == 2: # -1 per 1/2 rate
                if self.counter%2:
                    self.volume -= 1
        self.counter += 1
        return self.volume

    def update(self):
        if self.volume == 0 or self.frequency == 0:
            self.accumulator = 0

    def isFinished(self):
        return False

class Effect(Track):
    def __init__(self, source):
        Track.__init__(self)
        # Data Effect (ro)
        self.duration = source[3]
        self.reverse = source[4]
        self.freqincrepeat = source[5]
        self.repeat = source[6]
        self.volinc = source[9]
        # Helper (rw)
        self.freqstart = source[1]
        self.freqinc = source[2]
        self.play = True
        self.pingpong = True
        self.curduration = self.duration
        # Track (rw)
        self.wave = source[0]
        self.frequency = self.freqstart
        self.voltype = source[7]
        self.volume = source[8]

    def update(self):
        Track.update(self)
        if not self.play:
            return False

        self.curduration -= 1;
        if self.curduration == 0:
            # duration is now 0, check repeat
            self.repeat -= 1
            if self.repeat <= 0:
                self.frequency = 0
                self.volume = 0
                self.play = False
                return False
            # duration is 0. Re-init it.
            self.curduration = self.duration
            # Reverse Frequency increment
            if self.reverse:
                self.freqinc = - self.freqinc
                self.pingpong = not self.pingpong
            if (not self.reverse) or self.pingpong:
                self.freqstart += self.freqincrepeat
                self.frequency = self.freqstart
                self.volume += self.volinc

        self.frequency += self.freqinc
        self.volumeEffect()
        return True

    def isFinished(self):
        return not self.play

class Music(Track):
    notes = {}

    def __init__(self, source):
        Track.__init__(self)
        # Data Effect (ro)
        self.data = source
        # Helper (rw)
        self.play = True
        self.duration = 1
        self.seek = 0
        # Track (rw)
        self.wave = 0
        self.frequency = 0
        self.voltype = 0
        self.volume = 0
        self.initNote()

    def initNote(self):
        # No Music
        k2 = '---'
        v2 = 0
        self.notes[k2] = v2
        for k, v in MusicsAndEffects.octave.items():
            k2 = k + '0'
            v2 = int(v / 8)
            self.notes[k2] = v2
            k2 = k + '1'
            v2 = int(v / 4)
            self.notes[k2] = v2
            k2 = k + '2'
            v2 = int(v / 2)
            self.notes[k2] = v2
            k2 = k + '3'
            v2 = int(v)
            self.notes[k2] = v2
            for i in (1, 2, 3, 4, 5, 6):
                k2 = k + str(i+3)
                v2 = int(v * pow(2,i))
                self.notes[k2] = v2

    def update(self):
        Track.update(self)
        if not self.play:
            return False

        #wave, note, duration (1/60 s), volume, volEffect
        self.duration -= 1
        if self.duration == 0:
            if self.seek >= len(self.data):
                self.play = False
                return False
            self.wave = self.data[self.seek][0]
            self.note = self.data[self.seek][1]
            self.duration = self.data[self.seek][2]
            self.volume = self.data[self.seek][3]
            self.voltype = self.data[self.seek][4]
            self.seek += 1

            self.frequency = self.notes[self.note]

        self.volumeEffect()
        return True

    def isFinished(self):
        return not self.play

#----------------------------------------------------------------------
class Wsg(object):
    def __init__(self, bank, outputFrequency):
        self.bank = bank
        self.count = 0
        self.outputFrequency = outputFrequency
        self.vblank = int(outputFrequency / 60)
        self.wavetable = MusicsAndEffects.wavetable

    def update(self,length):
        sequence = length * [0]
        better_size_is = 0   # real sequence length
        for track in self.bank:
            incr = track.frequency / self.outputFrequency
            wtab = self.wavetable[track.wave]
            for i in range(length):
                if track.isFinished():
                    break
                if self.count%self.vblank == 0:
                    track.update()
                    incr = track.frequency / self.outputFrequency
                if (track.volume != 0) and (track.frequency != 0):
                    seek = int(track.accumulator) % 32
                    sequence[i] += track.volume * wtab[abs(seek)]
                    track.accumulator += incr
                self.count += 1
            if i > better_size_is:
                better_size_is = i + 1
        return sequence[:better_size_is]

    def isFinished(self):
        finished = True;
        for track in self.bank:
            finished = track.isFinished() & finished
        return finished
#----------------------------------------------------------------------
class SoundWave(Wsg):
    wave_file = None

    def __init__(self, bank, outputFrequency, name):
        Wsg.__init__(self, bank, outputFrequency)
        # SHRT_MAX / (max(sample)*max(volume)*nbtrack)
        self.normalize = int((2**15) / (16*16*len(bank)))
        self.wave_file = wave.open(name + ".wav", "w")
        nchannels = 1
        sampwidth = 2
        framerate = outputFrequency
        nframes = 0 # this is a library problem, not my own
        comptype = "NONE"
        compname = "not compressed"
        self.wave_file.setparams((nchannels, sampwidth, framerate,
            nframes, comptype, compname))

    def __del__(self):
        self.wave_file.close()

    def update(self):
        seq = Wsg.update(self,4096)
        seq16 = [s * self.normalize for s in seq] # normalize
        seqb = array.array('h', seq16).tostring() # then in bytes()
        self.wave_file.writeframes(seqb)

def genEffect(destFreq):
    for name, data in MusicsAndEffects.effects.items():
        print("===" + name + "===")
        dname = 'waves/' + name
        e = []
        e.append(Effect(data))
        s = SoundWave(e, destFreq, dname)
        while not s.isFinished():
            seq = s.update()

def genMusic(destFreq):
    for name, tracks in MusicsAndEffects.musics.items():
        print("===" + name + "===")
        dname = 'waves/' + name
        m = []
        for track in tracks:
            m.append(Music(track))
        s = SoundWave(m, destFreq, dname)
        while not s.isFinished():
            seq = s.update()

if __name__ == '__main__':
    try:
        os.mkdir('waves')
    except OSError as e:
        print('wave/ : ', e.args)
    destFreq = 48000
    genEffect(destFreq)
    genMusic(destFreq)

Et en bonus, les waves avec une qualité identique voir meilleur que la borne d'arcarde d'origine : waves-48kHz