INNER CODE UNIT · Python

select_melody

microsoft/muzic · musicagent/auxiliary/muzic/roc/main.py:31

def select_melody(c, is_maj, is_chorus, length, last_bar, chord, chord_ptr, is_last_sentence):
    cursor = c.execute(
        "SELECT DISTINCT NOTES, CHORDS from MELOLIB  where LENGTH = '{}' and CHORUS = '{}' and MAJOR = '{}' ".format(
            length, is_chorus, is_maj))  # and MAJOR = '{}'
    candidates_bars = []
    if is_debug:
        print("Retrive melody...")
    for row in cursor:
        notes = row[0]
        cd_ = row[1]
        candidates_bars.append((notes, cd_))

    # Filter by chords.
    chord_list_ = chord.strip().split(' ')
    chord_list_ = chord_list_[chord_ptr:] + chord_list_[:chord_ptr]
    re_str = ''

    if not is_last_sentence:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…