chord3 = NoteSeq("E G B") chord4 = NoteSeq("F A C") seqlist = [chord1, chord2, chord3, chord4] pprint(seqlist) midi3 = Midi(1, tempo=60) midi3.seq_chords(seqlist, track=0) midi3.write('foochord.mid') #Script foo() # Pygame script # pick a midi music file you have ... # (if not in working folder use full path) music_file = "foochord.mid" init_player() #play_music(music_file) """freq = 44100 # audio CD quality bitsize = -16 # unsigned 16 bit channels = 2 # 1 is mono, 2 is stereo buffer = 1024 # number of samples pygame.mixer.init(freq, bitsize, channels, buffer) # optional volume 0 to 1.0 pygame.mixer.music.set_volume(0.8) try: play_music(music_file) except KeyboardInterrupt: # if user hits Ctrl/C then exit # (works only in console mode) pygame.mixer.music.fadeout(1000) pygame.mixer.music.stop()
while phrase_length: note = notes.random_note() note.dur = c.QUARTER write_list.append(note) phrase_length = phrase_length - 1 repeat = repeat - 1 # Include rests if repeat: write_list.append(Rest(length*c.QUARTER)) write_midi(write_list) player.play_music() # Execute player.init_player() #test_note = Note(0,5,1,100) # print test_note.chord(c.FULLY_DIMINISHED) #test_notes = [Note(0,5,c.QUARTER,100), Rest(), Note(0,5,c.QUARTER,100)] #write_midi(test_notes) #midi = Midi(1, 120) #midi.seq_notes(test_notes, track=0) #midi.write('temp.mid') # test_single_pitch_in_chord(other_notes=4) # pitch_meditation(pitch=c.PITCH_A, repeat=2000) # pitch_in_random_chords(pitch=9, repeat=100) # test_multiple_pitches(note_list=[]) play_random_sequences(NoteSeq([Note(c.PITCH_A,5,c.QUARTER), Note(c.PITCH_B,5,c.QUARTER), Note(c.PITCH_E,5,c.QUARTER), Note(c.PITCH_F,5,c.QUARTER), Note(c.PITCH_G,5,c.QUARTER)])) # play_random_sequences(NoteSeq([Note(c.PITCH_Csharp,5,c.QUARTER), Note(c.PITCH_D,5,c.QUARTER), Note(c.PITCH_Dsharp,5,c.QUARTER), Note(c.PITCH_E,5,c.QUARTER), Note(c.PITCH_F,5,c.QUARTER)]))