def add_chords_bar(bar): global sp_midi, chord_count, bass_count, melody_count, drums_count chord_count += 1 track = mixer.channels["chords"] channel = track volume = mixer.get_volume("chords") sequence = list(bar) beat_ref = chord_count * performer.timing for i in xrange(len(sequence)): chord = sequence[i] if chord != "." and chord.startswith("r") == False: chordnotes = tools.get_chord(chord) if len(chord) == 5: pitch = chord[:2] else: pitch = chord[:1] length = tools.lengths[str(chord[-2:])] time = beat_ref + float(float(i) / float(performer.timing)) for note in chordnotes: sp_midi.addNote(track, channel, note, time, length, volume)
def lily_convert_chord(bar): sequence = list(bar) lilybar = [] for chord in sequence: if chord != ".": length = lily_length(str(chord[-2:])) if chord.startswith("r") == False: chordnotes = tools.get_chord(chord) chordsize = 3 octave = lily_octave(int(chord[-4:-3]), 2) lilychord = "<" for i in xrange(chordsize): note = chordnotes[i] pitch = tools.midi_to_genletter(note) lilynote = str(lily_note(pitch) + octave + " ") lilychord += lilynote lilychord += ">" + length lilybar.append(lilychord) elif chord == "r1": lilybar.append(chord + " ") else: lilybar.append("r" + length + " ") return " ".join(lilybar)
def add_chords_bar(bar): global sp_midi, chord_count, bass_count, melody_count, drums_count chord_count += 1 track = mixer.channels["chords"] channel = track volume = mixer.get_volume("chords") sequence = list(bar) beat_ref = chord_count * performer.timing for i in xrange(len(sequence)): chord = sequence[i] if chord != "." and chord.startswith("r") == False: chordnotes = tools.get_chord(chord) if len(chord) == 5: pitch = chord[:2] else: pitch = chord[:1] length = tools.lengths[str(chord[-2:])] time = beat_ref + float(float(i)/float(performer.timing)) for note in chordnotes: sp_midi.addNote(track, channel, note, time, length, volume)
def play_chord(chan, speed, pattern): beat = 0 while beat < (tsig * timing): noteinfo = pattern[beat] if noteinfo != "." and noteinfo.startswith("r") == False: chord = tools.get_chord(noteinfo) length = tools.lengths[str(noteinfo[-2:])] chordsize = 6 * int(tools.invlerp(0, 100, profiles.motion)) threading.Thread(target = play_notes, args = [chan,chord,0,length,chordsize]).start() nextbeat = float(float(speed)/float(timing)) time.sleep(nextbeat) beat += 1
def play_chord(chan, speed, pattern): beat = 0 while beat < (tsig * timing): noteinfo = pattern[beat] if noteinfo != "." and noteinfo.startswith("r") == False: chord = tools.get_chord(noteinfo) length = tools.lengths[str(noteinfo[-2:])] chordsize = 6 * int(tools.invlerp(0, 100, profiles.motion)) threading.Thread(target=play_notes, args=[chan, chord, 0, length, chordsize]).start() nextbeat = float(float(speed) / float(timing)) time.sleep(nextbeat) beat += 1