Exemplo n.º 1
0
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)
Exemplo n.º 2
0
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)
Exemplo n.º 3
0
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)
Exemplo n.º 4
0
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)
Exemplo n.º 5
0
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
Exemplo n.º 6
0
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