#!/usr/bin/python ### GUI modules import pygtk pygtk.require('2.0') import gtk import gobject ##### modules needed: from sys import * import os from time import * from random import * import string from socket import * from copy import * from thread import * ####### my modules: from midi_functions import * from scales import * from pink_noise import * gobject.threads_init() ###### midi setup: channel_choice = 0 channel = 0 old_channel = 0 open_port_exists = 0 ###### init some variables: text = 'blah' virgin = 1 step = 0 note_autocounter = 0 vol_autocounter = 0 note = 60 old_note = 60 mode = 0 transpose = 0 vol_evo = 0 note_evo = 0 scale_string = "pentatonic" scale_size = 20 endpoint = 15 note_noise_type = 'brown' vol_noise_type = 'brown' runstate = "START" ping = None ####### MIDI device functions: def is_midi_device_file(file): if 'midi' in file: return True else: return False devices = os.listdir('/dev/snd') devices.sort() midi_devices = filter(is_midi_device_file, devices) def device_config(widget, data): global open_port_exists, port if open_port_exists: close_port() open_port("/dev/snd/%s" % data) open_port_exists = 1 def channel_choice_config(widget, data): global channel_choice channel_choice = int(data) - 1 ####### scales: scales = ['pentatonic','modal','chromatic', \ 'whole_tone','octatonic','gypsy',\ 'overtone'] perc_scales = ['tabla','hydrogen_drums'] all_scales = copy(scales) all_scales.extend(perc_scales) ######## global master scale arrays for sc in scales: exec("""globals()['%s_scale'] = create_scale(%s)"""% (sc,sc)) def scale_config(widget, scale_string): global scale_choice, scale_size lowest = int(low_oct_adjustment.value) highest = int(oct_range_adjustment.value + lowest) #### get full set length: full_scale = eval("%s_scale" % scale_string) print "full scale is %s" % full_scale if (scale_string in ['tabla', 'hydrogen_drums'] ): scale_choice = full_scale[:] scale_size = len(scale_notes) - 1 else: notes_per_oct = full_scale.index(12) print "notes per octave is %s" % notes_per_oct print "lowest oct is %s" % lowest print "highest is %s" % highest scale_choice = full_scale[(lowest * notes_per_oct):(highest * notes_per_oct + 1)] print "scale_choice-blah-is %s" % scale_choice scale_size = len(scale_choice) - 1 for x in range(32): exec("""current_val = note_slider%i_adjustment.value""" % x) exec("""note_slider%i_adjustment.set_upper(%i)""" % (x, scale_size)) exec("""note_slider%i_adjustment.set_lower(-1)""" % x) exec("""note_slider%i_adjustment.set_value(%i)""" % (x, current_val % scale_size)) exec("""note_slider%i_adjustment.emit("changed")""" % x) ##### evoked on start/stop button def reverse(widget): global runstate, my_lock, old_note, step, virgin, start_time, seqtime, channel if runstate == "START": runstate = "STOP" widget.set_label("gtk-media-stop") my_lock = allocate_lock() start_new_thread(pystepseq,()) else: runstate = "START" widget.set_label("gtk-media-play") def setter(widget, variable, value): x = eval(str(value)) exec("""%s = %s""" % (variable, x)) in globals() print "%s is now %s" % (variable, x) def set_note_noise_type(widget, data): global note_noise_type note_noise_type = data print "note noise type is %s" % note_noise_type def set_vol_noise_type(widget, data): global vol_noise_type vol_noise_type = data print "vol noise type is %s" % vol_noise_type ######## randomize functions: def note_white(start, finish): global scale_size, endpoint var = note_depth_adjustment.value chance_repeat = note_repeat_adjustment.value chance_tie = note_tie_adjustment.value scale_midpoint = scale_size/2 for blah in range(start, finish): randnum = scale_midpoint + randint(-var,var) if (randnum > scale_size): randnum = scale_size - (randnum - scale_size) if (randnum < 0): randnum = abs(randnum) if (chance_repeat >= randint(1, 100)): #### for repeat if (chance_tie >= randint(1,100)): #### for space randnum = -1 else: exec("""randnum = note_slider%i_adjustment.value""" % ((blah - 1) % endpoint)) exec("""note_slider%i_adjustment.set_value(randnum)""" % blah) def note_brown(start, finish): global scale_size, endpoint var = note_depth_adjustment.value chance_repeat = note_repeat_adjustment.value chance_tie = note_tie_adjustment.value for blah in range(1, finish): offset = randint(-var,var) current = eval("""note_slider%i_adjustment.value""" % (blah-1)) new = (current + offset) if (new > scale_size): new = (current - offset) if (new < 0): new = abs(new) if (chance_repeat >= randint(1, 100)): #### for repeat if (chance_tie >= randint(1,100)): #### for tie new = -1 else: exec("""new = note_slider%i_adjustment.value""" % ((blah - 1) % endpoint)) exec("""note_slider%i_adjustment.set_value(new)""" % blah) for gah in range(0,1): #### for repeat: if (chance_repeat >= randint(1, 100)): #### for repeat if (chance_tie >= randint(1,100)): #### for tie new = -1 else: exec("""new = note_slider%i_adjustment.value""" % (blah - 1) % endpoint) exec("""note_slider%i_adjustment.set_value(new)""" % blah) def note_pink(start, finish): global scale_size, endpoint var = note_depth_adjustment.value chance_repeat = note_repeat_adjustment.value chance_tie = note_tie_adjustment.value scale_midpoint = scale_size/2 result_array = pink_noise(5,var) offset = -1 * (max(result_array)/2) for blah in range(start, finish): randnum = scale_midpoint + (result_array[blah - 1] + offset) if (randnum > scale_size): randnum = scale_size - (randnum - scale_size) if (randnum < 0): randnum = abs(randnum) if (chance_repeat >= randint(1, 100)): #### for repeat if (chance_tie >= randint(1,100)): #### for tie randnum = -1 else: exec("""randnum = note_slider%i_adjustment.value""" % ((blah - 1) % endpoint)) exec("""note_slider%i_adjustment.set_value(randnum)""" % blah) def vol_white(start, finish): var = vol_depth_adjustment.value chance = vol_space_adjustment.value for blah in range(start, finish): randnum = 64 + randint(-var,var) ### 64 is half of 127 if (randnum > 127): randnum = 127 - (randnum - 127) if (randnum < 0): randnum = abs(randnum) if (chance >= randint(1,100)): #### for space randnum = 0 exec("""vol_slider%i_adjustment.set_value(randnum)""" % blah) def vol_brown(start, finish): var = vol_depth_adjustment.value chance = vol_space_adjustment.value for blah in range(start, finish): offset = randint(-var,var) current = eval("""vol_slider%i_adjustment.value""" % (blah-1)) new = (current + offset) if (new > 127): new = (current - offset) if (new < 0): new = (current - offset) exec("""vol_slider%i_adjustment.set_value(new)""" % blah) for gah in range(start, finish): #### for space: if (chance >= randint(1,100)): exec("""vol_slider%i_adjustment.set_value(0)""" % gah) def vol_pink(start, finish): var = vol_depth_adjustment.value chance = vol_space_adjustment.value result_array = pink_noise(5,var) offset = -1 * (max(result_array)/2) for blah in range(start, finish): randnum = 64 + (result_array[blah - 1] + offset) if (randnum > 127): randnum = 127 - (randnum - 127) if (randnum < 0): randnum = abs(randnum) if (chance >= randint(1,100)): #### for space randnum = 0 exec("""vol_slider%i_adjustment.set_value(randnum)""" % blah) def randomize_notes(widget): global note_noise_type if note_noise_type == 'brown': exec("""note_%s(1,32)""" % note_noise_type) else: exec("""note_%s(0,32)""" % note_noise_type) def randomize_vols(widget): global vol_noise_type if vol_noise_type == 'brown': exec("""vol_%s(1,32)""" % vol_noise_type) else: exec("""vol_%s(0,32)""" % vol_noise_type) ##################################################################### ################# mcast receiver: # Open a UDP socket, bind it to a port and select a multicast group def openmcastsock(group, port): # Import modules used only here import string import struct # # Create a socket s = socket(AF_INET, SOCK_DGRAM) # # Allow multiple copies of this program on one machine # (not strictly needed) s.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) # Bind it to the port s.bind(('', port)) # # Look up multicast group address in name server # (doesn't hurt if it is already in ddd.ddd.ddd.ddd format) group = gethostbyname(group) # # Construct binary group address bytes = map(int, string.split(group, ".")) grpaddr = 0 for byte in bytes: grpaddr = (grpaddr << 8) | byte # # Construct struct mreq from grpaddr and ifaddr ifaddr = INADDR_ANY mreq = struct.pack('LL', htonl(grpaddr), htonl(ifaddr)) # # Add group membership s.setsockopt(IPPROTO_IP, IP_ADD_MEMBERSHIP, mreq) # return s MYPORT = 8123 MYGROUP = '225.0.0.250' ##################################################################### def pystepseq(): global channel, old_channel, channel_choice, endpoint, \ scale_choice, scale_size, scale_string, \ transpose, mode, runstate, runstate, note_array, vol_array, len_array, \ note_evo, vol_evo, note_noise_type, vol_noise_type, my_lock, MYGROUP, MYPORT receiver = openmcastsock(MYGROUP, MYPORT) trigger_flag = 0 note_autocounter = 0 vol_autocounter = 0 step = 0 virgin = 1 p = None while runstate == 'STOP': receiver.recv(1) trigger_flag += 1 my_endpoint = endpoint if trigger_flag == 1: #### proceed if it's the first of a note length! note_index = note_array[step] vol = vol_array[step] my_note_evo = note_evo my_vol_evo = vol_evo my_note_noise_type = note_noise_type my_vol_noise_type = vol_noise_type my_transpose = transpose my_mode = mode my_channel = channel_choice if note_index == -1: ### ties pass else: note = eval("scale_choice[%i]" % bounce(note_index + mode, scale_size)) if not virgin: ### turn off any sounding notes note_off(int(old_channel),int(old_note)) channel = old_channel note = note + my_transpose note_on(int(my_channel), int(note), int(vol)) virgin = 0 old_channel = my_channel old_note = note ###### update cycle count, etc. if step == 0: ### do this at the beginning of every cycle note_autocounter = note_autocounter + 1 vol_autocounter = vol_autocounter + 1 if note_autocounter > (my_note_evo - 1): note_autocounter = 0 if my_note_evo > 0: z = randrange(my_endpoint + 1) exec("""note_%s(z,z+1)""" % my_note_noise_type) if vol_autocounter > (my_vol_evo - 1): vol_autocounter = 0 if my_vol_evo > 0: z = randrange(my_endpoint + 1) exec("""vol_%s(z,z+1)""" % my_vol_noise_type) ### do this below after every ping: try: nlv = int(len_array[step]) except: nlv = 1 if trigger_flag == nlv: #### if the trigger flag reaches note length value, step += 1 #### go onto the next event print "step is %s" % step if step > my_endpoint: step = 0 print "step is now %s" % step trigger_flag = 0 #### and reset the trigger flag note_off(old_channel, old_note) ######### GUI # Create a new window window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.set_title("Testing a new look for Pystepseq") window.connect("destroy", lambda w: gtk.main_quit()) window.set_border_width(10) window.set_size_request(-1,-1) # Create a Box container master_box = gtk.VBox(False, 10) window.add(master_box) master_box.show() # needed this by default at the top -- it's referenced early on low_oct_adjustment = gtk.Adjustment(4, 3, 8, 1, 2, 0) low_oct_adjustment.connect("value-changed", scale_config, scale_string) oct_range_adjustment = gtk.Adjustment(2, 1, 5, 1, 2, 0) oct_range_adjustment.connect("value-changed", scale_config, scale_string) for i in range(32): exec("""note_slider%i_adjustment = gtk.Adjustment(0, -1, 30, 1, 5, 0)""" % i) # Add menu bar and menus menubar = gtk.MenuBar() master_box.pack_start(menubar, False) def create_scale_menu(): menu = gtk.Menu() group = None for s in all_scales: exec("""menuitem_%s = gtk.RadioMenuItem(group, '%s') menuitem_%s.connect("toggled", scale_config, '%s') group = menuitem_%s menu.add(menuitem_%s) menuitem_%s.show()""" % (s, s, s, s, s, s, s)) menuitem_pentatonic.set_active(True) return menu menuitem1 = gtk.MenuItem('scales') menuitem1.set_submenu(create_scale_menu()) menubar.add(menuitem1) def create_device_menu(): global midi_devices menu = gtk.Menu() group = None for d in range(len(midi_devices)): exec("""menuitem_%s = gtk.RadioMenuItem(group, '%s') menuitem_%s.connect("toggled", device_config, '%s') group = menuitem_%s menu.add(menuitem_%s) menuitem_%s.show()""" % (d,midi_devices[d],d,midi_devices[d],d,d,d)) menuitem_0.set_active(True) return menu menuitem2 = gtk.MenuItem('midi_device') menuitem2.set_submenu(create_device_menu()) menubar.add(menuitem2) def create_channel_menu(): global channel_choice menu = gtk.Menu() group = None for c in range(1,17): exec("""menuitem_%s = gtk.RadioMenuItem(group, '%s') menuitem_%s.connect("toggled", channel_choice_config, '%s') group = menuitem_%s menu.add(menuitem_%s) menuitem_%s.show()""" % (c,c,c,c,c,c,c)) menuitem_1.set_active(True) return menu menuitem3 = gtk.MenuItem('midi_channel') menuitem3.set_submenu(create_channel_menu()) menubar.add(menuitem3) menubar.show_all() ##### Create a table for main part table = gtk.Table(5,32,False) master_box.add(table) table.show() ##### box for octave ranges octave_box = gtk.HBox(False, 0) master_box.pack_start(octave_box, False, False) octave_box.show() ##### box for note random functions noterandom_box = gtk.HBox(False, 0) master_box.pack_start(noterandom_box, False, False) noterandom_box.show() ##### box for vol random functions volrandom_box = gtk.HBox(False, 0) master_box.pack_start(volrandom_box, False, False) volrandom_box.show() ##### box for start and quit buttons start_box = gtk.HBox(False, 0) master_box.pack_start(start_box, False, False) start_box.show() #def attach(child, left_attach, right_attach, top_attach, bottom_attach, # xoptions=gtk.EXPAND|gtk.FILL, yoptions=gtk.EXPAND|gtk.FILL, # xpadding=0, ypadding=0) # create a step lable for each step of the sequencer for i in range(32): exec("""label%i = gtk.Label('%i') table.attach(label%i, %i, %i, 0, 1) label%i.show()""" % (i,i+1,i,i,i+1,i)) # create 32 radio buttons to pick sequence length radio0 = gtk.RadioButton() radio0.connect("toggled", setter, "endpoint", 0) table.attach(radio0, 0, 1, 1, 2,gtk.EXPAND) radio0.show() for i in range(1,32): exec("""radio%i = gtk.RadioButton(radio0) radio%i.connect("toggled", setter, "endpoint", %i) table.attach(radio%i, %i, %i, 1, 2,gtk.EXPAND) radio%i.show()""" % (i,i,i,i,i,i+1,i)) radio15.set_active(True) # create 32 note length entries for i in range(32): exec("""len_entry%i = gtk.Entry(2) len_entry%i.set_width_chars(2) len_entry%i.set_text('01') len_entry%i.connect("activate", setter, "len_array[%i]", "len_entry%i.get_text()") table.attach(len_entry%i, %i, %i, 2, 3) len_entry%i.show()""" % (i,i,i,i,i,i,i,i,i+1,i)) # create 32 scale sliders for notes: for i in range(32): exec("""note_slider%i = gtk.VScale(note_slider%i_adjustment) note_slider%i.set_inverted(True) note_slider%i.set_draw_value(False) note_slider%i.set_size_request(-1,100) note_slider%i_adjustment.connect("value-changed", setter, "note_array[%i]", "note_slider%i_adjustment.value") table.attach(note_slider%i, %i, %i, 3, 4,2,0,0,0) note_slider%i.show()""" % (i,i,i,i,i,i,i,i,i,i,i+1,i)) # create 32 scale sliders for vols: for i in range(32): exec("""vol_slider%i_adjustment = gtk.Adjustment(0, 0, 101, 1, 5, 0) vol_slider%i = gtk.VScale(vol_slider%i_adjustment) vol_slider%i.set_inverted(True) vol_slider%i.set_draw_value(False) vol_slider%i.set_size_request(-1,100) vol_slider%i_adjustment.connect("value-changed", setter, "vol_array[%i]", "vol_slider%i_adjustment.value") table.attach(vol_slider%i, %i, %i, 4, 5,2,0,0,0) vol_slider%i.show()""" % (i,i,i,i,i,i,i,i,i,i,i,i+1,i)) ################################## space1 = gtk.Label(" ") octave_box.pack_start(space1, True, True) space1.show() #### low_oct_label = gtk.Label("low octave") octave_box.pack_start(low_oct_label, False, False) low_oct_label.show() low_oct_slider = gtk.HScale(low_oct_adjustment) low_oct_slider.set_size_request(100,-1) low_oct_slider.set_digits(0) octave_box.pack_start(low_oct_slider, False, False) low_oct_slider.show() #### oct_range_label = gtk.Label("octave range") octave_box.pack_start(oct_range_label, False, False) oct_range_label.show() oct_range_slider = gtk.HScale(oct_range_adjustment) oct_range_slider.set_size_request(100,-1) oct_range_slider.set_digits(0) octave_box.pack_start(oct_range_slider, False, False) oct_range_slider.show() #### mode_label = gtk.Label("mode") octave_box.pack_start(mode_label, False, False) mode_label.show() mode_adjustment = gtk.Adjustment(0, -12, 12, 1, 2, 0) mode_slider = gtk.HScale(mode_adjustment) mode_slider.set_size_request(100,-1) mode_slider.set_digits(0) mode_adjustment.connect("value-changed", setter, "mode", "mode_adjustment.value") octave_box.pack_start(mode_slider, False, False) mode_slider.show() #### transpose_label = gtk.Label("transpose") octave_box.pack_start(transpose_label, False, False) transpose_label.show() transpose_adjustment = gtk.Adjustment(0, -24, 24, 1, 12, 0) transpose_slider = gtk.HScale(transpose_adjustment) transpose_slider.set_size_request(100, -1) transpose_slider.set_digits(0) transpose_adjustment.connect("value-changed", setter, "transpose", "transpose_adjustment.value") octave_box.pack_start(transpose_slider, False, False) transpose_slider.show() #### space2 = gtk.Label(" ") octave_box.pack_start(space2, True, True) space2.show() ###################################### note_brown_label = gtk.Label("brown") noterandom_box.pack_start(note_brown_label, False, False) note_brown_label.show() note_brown_button = gtk.RadioButton() note_brown_button.connect("toggled", set_note_noise_type, "brown") noterandom_box.pack_start(note_brown_button, False, False, 0) note_brown_button.show() #### note_pink_label = gtk.Label("pink") noterandom_box.pack_start(note_pink_label, False, False) note_pink_label.show() note_pink_button = gtk.RadioButton(note_brown_button) note_pink_button.connect("toggled", set_note_noise_type, "pink") noterandom_box.pack_start(note_pink_button, False, False) note_pink_button.show() #### note_white_label = gtk.Label("white") noterandom_box.pack_start(note_white_label, False, False) note_white_label.show() note_white_button = gtk.RadioButton(note_brown_button) note_white_button.connect("toggled", set_note_noise_type, "white") noterandom_box.pack_start(note_white_button, False, False) note_white_button.show() #### note_randomize_button = gtk.Button("note random") note_randomize_button.connect("clicked", randomize_notes) noterandom_box.pack_start(note_randomize_button, False, False) note_randomize_button.show() #### note_depth_label = gtk.Label("note depth") noterandom_box.pack_start(note_depth_label) note_depth_label.show() note_depth_adjustment = gtk.Adjustment(5, 0, 50, 1, 2, 0) note_depth_slider = gtk.HScale(note_depth_adjustment) note_depth_slider.set_size_request(70,-1) note_depth_slider.set_digits(0) noterandom_box.pack_start(note_depth_slider) note_depth_slider.show() #### note_repeat_label = gtk.Label("note repeat") noterandom_box.pack_start(note_repeat_label) note_repeat_label.show() note_repeat_adjustment = gtk.Adjustment(0, 0, 100, 1, 10, 0) note_repeat_slider = gtk.HScale(note_repeat_adjustment) note_repeat_slider.set_size_request(70,-1) note_repeat_slider.set_digits(0) noterandom_box.pack_start(note_repeat_slider) note_repeat_slider.show() #### note_tie_label = gtk.Label("note tie") noterandom_box.pack_start(note_tie_label) note_tie_label.show() note_tie_adjustment = gtk.Adjustment(0, 0, 100, 1, 10, 0) note_tie_slider = gtk.HScale(note_tie_adjustment) note_tie_slider.set_size_request(70,-1) note_tie_slider.set_digits(0) noterandom_box.pack_start(note_tie_slider) note_tie_slider.show() #### note_evolver_label = gtk.Label("note evolver") noterandom_box.pack_start(note_evolver_label) note_evolver_label.show() note_evolver_adjustment = gtk.Adjustment(0, 0, 8, 1, 2, 0) note_evolver_slider = gtk.HScale(note_evolver_adjustment) note_evolver_slider.set_size_request(70,-1) note_evolver_slider.set_digits(0) note_evolver_adjustment.connect("value-changed", setter, "note_evo", "note_evolver_adjustment.value") noterandom_box.pack_start(note_evolver_slider) note_evolver_slider.show() ################## vol_brown_label = gtk.Label("brown") volrandom_box.pack_start(vol_brown_label, False, False) vol_brown_label.show() vol_brown_button = gtk.RadioButton() vol_brown_button.connect("toggled", set_vol_noise_type, "brown") volrandom_box.pack_start(vol_brown_button, False, False, 0) vol_brown_button.show() #### vol_pink_label = gtk.Label("pink") volrandom_box.pack_start(vol_pink_label, False, False) vol_pink_label.show() vol_pink_button = gtk.RadioButton(vol_brown_button) vol_pink_button.connect("toggled", set_vol_noise_type, "pink") volrandom_box.pack_start(vol_pink_button, False, False) vol_pink_button.show() #### vol_white_label = gtk.Label("white") volrandom_box.pack_start(vol_white_label, False, False) vol_white_label.show() vol_white_button = gtk.RadioButton(vol_brown_button) vol_white_button.connect("toggled", set_vol_noise_type, "white") volrandom_box.pack_start(vol_white_button, False, False) vol_white_button.show() #### vol_randomize_button = gtk.Button("vol random") vol_randomize_button.connect("clicked", randomize_vols) volrandom_box.pack_start(vol_randomize_button, False, False) vol_randomize_button.show() #### vol_depth_label = gtk.Label("vol depth") volrandom_box.pack_start(vol_depth_label) vol_depth_label.show() vol_depth_adjustment = gtk.Adjustment(5, 0, 64, 1, 2, 0) vol_depth_slider = gtk.HScale(vol_depth_adjustment) vol_depth_slider.set_size_request(100,-1) vol_depth_slider.set_digits(0) volrandom_box.pack_start(vol_depth_slider) vol_depth_slider.show() #### vol_space_label = gtk.Label("vol space") volrandom_box.pack_start(vol_space_label) vol_space_label.show() vol_space_adjustment = gtk.Adjustment(0, 0, 100, 1, 10, 0) vol_space_slider = gtk.HScale(vol_space_adjustment) vol_space_slider.set_size_request(100,-1) vol_space_slider.set_digits(0) volrandom_box.pack_start(vol_space_slider) vol_space_slider.show() #### vol_evolver_label = gtk.Label("vol evolver") volrandom_box.pack_start(vol_evolver_label) vol_evolver_label.show() vol_evolver_adjustment = gtk.Adjustment(0, 0, 8, 1, 2, 0) vol_evolver_slider = gtk.HScale(vol_evolver_adjustment) vol_evolver_slider.set_size_request(100,-1) vol_evolver_slider.set_digits(0) vol_evolver_adjustment.connect("value-changed", setter, "vol_evo", "vol_evolver_adjustment.value") volrandom_box.pack_start(vol_evolver_slider) vol_evolver_slider.show() ############################################### space3 = gtk.Label(" ") start_box.pack_start(space3, True, True) space3.show() start_button = gtk.Button("START", gtk.STOCK_MEDIA_PLAY) start_button.connect("clicked", reverse) start_box.pack_start(start_button, False, False) start_button.show() quit_button = gtk.Button("QUIT", gtk.STOCK_QUIT) quit_button.connect("clicked", lambda w: gtk.main_quit()) start_box.pack_start(quit_button, False, False) quit_button.show() space4 = gtk.Label(" ") start_box.pack_start(space4, True, True) space4.show() # Display the window scale_config(None, 'pentatonic') window.show() note_array = map(lambda n: eval("note_slider%i_adjustment.value" % n), range(32)) vol_array = map(lambda n: eval("vol_slider%i_adjustment.value" % n), range(32)) len_array = map(lambda n: eval("int(len_entry%i.get_text())" % n), range(32)) # run! gtk.main()