def edit_scale(pad, verbose): global config rbank = int((pad - 1) / _PADS) rsubpad = pad - (_PADS * rbank) - 1 menu = qprompt.Menu() x = 0 for y in Scale._SCALE_PATTERNS: menu.add(str(x), y) x = x + 1 stype = menu.show(hdr="Pad %d (Bank %s-%d):" % (pad, chr(65 + rbank), rsubpad + 1), msg="Scale", returns="desc") root = qprompt.ask_int("Note", vld=list(range(0, 128)), dft=config[1][rbank][rsubpad]['note']) count = qprompt.ask_int("Count", vld=[0] + list(range(1, _PTOTAL + 2 - pad)), dft=0) scale = Scale.build_scale(Note.from_midi_num(root), stype) scale_lst = [] for note in scale: scale_lst.append(note.midi_note_number()) if count: while len(scale_lst) < count: root = scale_lst.pop() scale = Scale.build_scale(Note.from_midi_num(root), stype) for note in scale: scale_lst.append(note.midi_note_number()) else: count = len(scale_lst) if pad + count > _PTOTAL: count = _PTOTAL + 1 - pad for note in scale_lst[:count]: bank = int((pad - 1) / _PADS) subpad = pad - (_PADS * bank) - 1 config[1][bank][subpad]['note'] = note if verbose: print("Setting Pad %d (Bank %s-%d) to %d (%s)" % (pad, chr(65 + bank), subpad + 1, note, Note.from_midi_num(note))) pad = pad + 1
def test_midi_num_57(): n1 = Note.from_midi_num(57) n2 = Note.from_note_string('A3') assert n1 == n2
def edit_scale(pad, verbose): global config rbank = int((pad - 1) / _PADS) rsubpad = pad - (_PADS * rbank) - 1 menu = qprompt.Menu() menu.add("0", "Note") menu.add("1", "Midi-CC") menu.add("2", "Program") ptype = menu.show(msg="Apply Scale to:", returns="desc", dft="0") menu = qprompt.Menu() x = 0 for y in Scale._SCALE_PATTERNS: menu.add(str(x), y) x = x + 1 stype = menu.show(hdr="Pad %d (Bank %s-%d):" % (pad, chr(65 + rbank), rsubpad + 1), msg="Scale", returns="desc") same = None if ptype == "Note": root = qprompt.ask_int("Note", vld=list(range(0, 128)), dft=config[1][rbank][rsubpad]['note']) same = qprompt.ask_yesno(msg="Config all as per Pad %d?" % pad, dft='N') elif ptype == "Midi-CC": root = qprompt.ask_int("Midi-CC Value", vld=list(range(0, 128)), dft=config[1][rbank][rsubpad]['midicc']) else: root = qprompt.ask_int("Program Value", vld=list(range(0, 128)), dft=config[1][rbank][rsubpad]['prog']) count = qprompt.ask_int("Count", vld=[0] + list(range(1, _PTOTAL + 2 - pad)), dft=0) scale = Scale.build_scale(Note.from_midi_num(root), stype) scale_lst = [] for note in scale: scale_lst.append(note.midi_note_number()) if count: while len(scale_lst) < count: root = scale_lst.pop() scale = Scale.build_scale(Note.from_midi_num(root), stype) for note in scale: scale_lst.append(note.midi_note_number()) else: count = len(scale_lst) if pad + count > _PTOTAL: count = _PTOTAL + 1 - pad for note in scale_lst[:count]: bank = int((pad - 1) / _PADS) subpad = pad - (_PADS * bank) - 1 if same and ptype == "Note": config[1][bank][subpad]['trigger'] = config[1][rbank][rsubpad][ 'trigger'] if ptype == "Note": config[1][bank][subpad]['note'] = note elif ptype == "Midi-CC": config[1][bank][subpad]['midicc'] = note else: config[1][bank][subpad]['prog'] = note if verbose: print("Setting Pad %d (Bank %s-%d) to %d (%s)" % (pad, chr(65 + bank), subpad + 1, note, Note.from_midi_num(note))) pad = pad + 1
def test_midi_num_82(): n1 = Note.from_midi_num(82) n2 = Note.from_note_string('A5#') assert n1 == n2
def test_midi_num_80(): n1 = Note.from_midi_num(80) n2 = Note.from_note_string('G5#') assert n1 == n2
def test_midi_num_78(): n1 = Note.from_midi_num(78) n2 = Note.from_note_string('F5#') assert n1 == n2
def test_midi_num_76(): n1 = Note.from_midi_num(76) n2 = Note.from_note_string('E5') assert n1 == n2
def test_midi_num_74(): n1 = Note.from_midi_num(74) n2 = Note.from_note_string('D5') assert n1 == n2
def test_midi_num_64(): n1 = Note.from_midi_num(64) n2 = Note.from_note_string('E4') assert n1 == n2
def test_midi_num_63(): n1 = Note.from_midi_num(63) n2 = Note.from_note_string('D4#') assert n1 == n2
def test_midi_num_62(): n1 = Note.from_midi_num(62) n2 = Note.from_note_string('D4') assert n1 == n2
def test_midi_num_61(): n1 = Note.from_midi_num(61) n2 = Note.from_note_string('C4#') assert n1 == n2
def test_midi_num_60(): n1 = Note.from_midi_num(60) n2 = Note.from_note_string('C4') assert n1 == n2
def test_midi_num_59(): n1 = Note.from_midi_num(59) n2 = Note.from_note_string('B3') assert n1 == n2
def test_midi_num_58(): n1 = Note.from_midi_num(58) n2 = Note.from_note_string('A3#') assert n1 == n2
def test_midi_num_72(): n1 = Note.from_midi_num(72) n2 = Note.from_note_string('C5') assert n1 == n2
def test_midi_num_73(): n1 = Note.from_midi_num(73) n2 = Note.from_note_string('C5#') assert n1 == n2
def test_midi_num_65(): n1 = Note.from_midi_num(65) n2 = Note.from_note_string('F4') assert n1 == n2
def test_midi_num_75(): n1 = Note.from_midi_num(75) n2 = Note.from_note_string('D5#') assert n1 == n2
def test_midi_num_66(): n1 = Note.from_midi_num(66) n2 = Note.from_note_string('F4#') assert n1 == n2
def test_midi_num_77(): n1 = Note.from_midi_num(77) n2 = Note.from_note_string('F5') assert n1 == n2
def test_midi_num_67(): n1 = Note.from_midi_num(67) n2 = Note.from_note_string('G4') assert n1 == n2
def test_midi_num_79(): n1 = Note.from_midi_num(79) n2 = Note.from_note_string('G5') assert n1 == n2
def test_midi_num_68(): n1 = Note.from_midi_num(68) n2 = Note.from_note_string('G4#') assert n1 == n2
def test_midi_num_81(): n1 = Note.from_midi_num(81) n2 = Note.from_note_string('A5') assert n1 == n2
def test_midi_num_69(): n1 = Note.from_midi_num(69) n2 = Note.from_note_string('A4') assert n1 == n2
def test_midi_num_83(): n1 = Note.from_midi_num(83) n2 = Note.from_note_string('B5') assert n1 == n2
def test_midi_num_70(): n1 = Note.from_midi_num(70) n2 = Note.from_note_string('A4#') assert n1 == n2
def edit_scale(pad, verbose): global config rbank = int((pad - 1) / _PADS) rsubpad = pad - (_PADS * rbank) - 1 ptype = config[1][rbank][rsubpad]['type'] if ptype == "BANK": qprompt.error("Pad %d (Bank %s-%d) is configured as a BANK" % (pad, chr(65 + rbank), rsubpad + 1)) return menu = qprompt.Menu() x = 0 for y in Scale._SCALE_PATTERNS: menu.add(str(x), y) x = x + 1 stype = menu.show(hdr="Pad %d (Bank %s-%d):" % (pad, chr(65 + rbank), rsubpad + 1), msg="Scale", returns="desc") root = qprompt.ask_int("Note", vld=list(range(0, 128)), dft=config[1][rbank][rsubpad]['note']) count = qprompt.ask_int("Count", vld=[0] + list(range(1, _PTOTAL + 2 - pad)), dft=0) same = qprompt.ask_yesno(msg="Config all as per Pad %d?" % pad, dft='N') scale = Scale.build_scale(Note.from_midi_num(root), stype) scale_lst = [] for note in scale: scale_lst.append(note.midi_note_number()) if count: while len(scale_lst) < count: root = scale_lst.pop() scale = Scale.build_scale(Note.from_midi_num(root), stype) for note in scale: scale_lst.append(note.midi_note_number()) else: count = len(scale_lst) if pad + count > _PTOTAL: count = _PTOTAL + 1 - pad for note in scale_lst[:count]: bank = int((pad - 1) / _PADS) subpad = pad - (_PADS * bank) - 1 if same and ptype == "NOTE": config[1][bank][subpad]['type'] = config[1][rbank][rsubpad]['type'] config[1][bank][subpad]['channel'] = config[1][rbank][rsubpad][ 'channel'] config[1][bank][subpad]['trigger'] = config[1][rbank][rsubpad][ 'trigger'] config[1][bank][subpad]['aftertouch'] = config[1][rbank][rsubpad][ 'aftertouch'] if same and ptype == "PROG": config[1][bank][subpad]['type'] = config[1][rbank][rsubpad]['type'] config[1][bank][subpad]['channel'] = config[1][rbank][rsubpad][ 'channel'] if ptype == "NOTE": config[1][bank][subpad]['note'] = note else: config[1][bank][subpad]['program'] = note if verbose: print("Setting Pad %d (Bank %s-%d) to %d (%s)" % (pad, chr(65 + bank), subpad + 1, note, Note.from_midi_num(note))) pad = pad + 1
def test_midi_num_71(): n1 = Note.from_midi_num(71) n2 = Note.from_note_string('B4') assert n1 == n2