Beispiel #1
0
def add_bass_bar(bar):
    global sp_midi, chord_count, bass_count, melody_count, drums_count

    bass_count += 1

    track = mixer.channels["bass"]
    channel = track
    volume = mixer.get_volume("bass")

    sequence = list(bar)
    beat_ref = bass_count * performer.timing

    for i in xrange(len(sequence)):
        note = sequence[i]
        if note != "." and note.startswith("r") == False:
            if len(note) == 5:
                pitch = note[:2]
            else:
                pitch = note[:1]

            octave = int(note[-3:-2])
            length = tools.lengths[str(note[-2:])]
            pitch = tools.letter_to_midi(pitch, octave)
            time = beat_ref + float(float(i) / float(performer.timing))
            sp_midi.addNote(track, channel, pitch, time, length, volume)
Beispiel #2
0
def add_melody_bar(bar):
    global sp_midi, chord_count, bass_count, melody_count, drums_count

    melody_count += 1

    track = mixer.channels["melody"]
    channel = track
    volume = mixer.get_volume("melody")

    sequence = list(bar)
    beat_ref = melody_count * performer.timing

    for i in xrange(len(sequence)):
        note = sequence[i]
        if note != "." and note.startswith("r") == False:
            if len(note) == 5:
                pitch = note[:2]
            else:
                pitch = note[:1]

            octave = int(note[-3:-2])
            length = tools.lengths[str(note[-2:])]
            pitch = tools.letter_to_midi(pitch, octave)
            time = beat_ref + float(float(i)/float(performer.timing))
            sp_midi.addNote(track, channel, pitch, time, length, volume)
Beispiel #3
0
def fire():
    key = conductor.relativekey
    mode = conductor.relativemode
    octave = str(3)

    scale = tools.make_scale(key, mode, octave)

    scalenote = scale[random.randrange(len(scale))]
    scalenote = scalenote[:-1]
    stabnote = tools.letter_to_midi(scalenote, 3)

    performer.play_note(int(mixer.get_channel("stabs")), stabnote, 0.01)
Beispiel #4
0
def fire():
    key = conductor.relativekey
    mode = conductor.relativemode
    octave = str(3)

    scale = tools.make_scale(key, mode, octave)

    scalenote = scale[random.randrange(len(scale))]
    scalenote = scalenote[:-1]
    stabnote = tools.letter_to_midi(scalenote, 3)

    performer.play_note(int(mixer.get_channel("stabs")), stabnote, 0.01)