예제 #1
0
def main():
    for s in songs:
        audio = pitch_to_audio(keys_to_pitch(notes_to_keys(s[2].split(' '))), s[1])
        audio.export('test_' + s[0] + '.mp3', format='mp3')

    with open('tests.txt', 'w') as f:
        for s in songs:
            text = keys_to_text(notes_to_keys(s[2].split(' ')))
            text = ''.join([n * int(s[1] / 1000 * 8 + 0.5) for n in text])
            f.write(text + '\n')
예제 #2
0
def main():
    parser = argparse.ArgumentParser(description='Generate audio clips from pitch tracks.',
            formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument('pitch_file')
    parser.add_argument('-o', '--output_file', default='song.mp3', help='output audio file name')
    parser.add_argument('-t', '--note_rate', default=8, type=float, help='Note length in milliseconds')
    args = parser.parse_args()

    with open(args.pitch_file) as f:
        text = f.read()

    if any(char.isdigit() for char in text):
        keys = notes_to_keys(text.aplit(' '))
    else:
        keys = text_to_keys(text)
    song = pitch_to_audio(keys_to_pitch(keys), int(1000 / args.note_rate))

    song.export(args.output_file, format='mp3')
예제 #3
0
def generate_hp():
    notes = 'c5 A4 c5 f5 D5 d5 D5 g5 f5 f5 f5'.split(' ')
    song = pitch_to_audio(keys_to_pitch(notes_to_keys(notes)), 1000)
    song.export('ha_tikva.mp3', format='mp3')
예제 #4
0
def generate_circle():
    notes = 'g4 a4 c5 c5 c5 c5 e5 d5 c5 c5 e5 e5 e5 e5 e5 d5 c5 c5 c5 c5 a4 c5 g4 g4 g4 g4 g4 g4'.split(' ')
    song = pitch_to_audio(keys_to_pitch(notes_to_keys(notes)), 500)
    song.export('ha_tikva.mp3', format='mp3')
예제 #5
0
def generate_bach():
    notes = 'e5 D5 e5 b4 c5 G4 a4'.split(' ')
    song = pitch_to_audio(keys_to_pitch(notes_to_keys(notes)), 1000)
    song.export('ha_tikva.mp3', format='mp3')
예제 #6
0
def generate_got():
    notes = 'e5 e5 e5 a4 a4 c5 d5 e5 e5 e5 a4 a4 c5 d5 b4 b4 b4 b4 b4 b4'.split(' ')
    song = pitch_to_audio(keys_to_pitch(notes_to_keys(notes)), 500)
    song.export('ha_tikva.mp3', format='mp3')
예제 #7
0
def generate_ha_tikva_3():
    notes = 'a3 b3 c4 d4 e4 x e4 x f4 e4 f4 a4 e4 e4 x x d4 x d4 d4 c4 x c4 c4 b3 a3 b3 c4 a3 a3 a3 x'.split(' ')
    song = pitch_to_audio(keys_to_pitch(notes_to_keys(notes)), 1000)
    song.export('ha_tikva.mp3', format='mp3')
예제 #8
0
def generate_ha_tikva_2():
    notes = 'a4 b4 c5 d5 e5 x e5 x f5 e5 f5 a5 e5 e5 x x d5 x d5 d5 c5 x c5 c5 b4 a4 b4 c5 a4 a4 a4 x'.split(' ')
    song = pitch_to_audio(keys_to_pitch(notes_to_keys(notes)), 1000)
    song.export('ha_tikva.mp3', format='mp3')