Ejemplo n.º 1
0
def test_single_pitch_in_chord(note_list=None, other_notes=1):
    # Play initial note
    note = random_note(note_list)
    write_midi(note)
    player.play_music()
   
    # Pick other notes
    chord = random_chord(note_list, exception_list=[note.value])

    # True or False? To include original note
    boolean = choice([True, False])
    if boolean:
        chord.append(note)
    else:
        chord.append(random_note(note_list, exception_list=[note.value])) 


    # Play chord
    chord_seq = NoteSeq(chord)
    write_midi(chord_seq) # make this Note and NoteSeq methods
    player.play_music()
    response = raw_input("Was the note in the chord? ")
    if correct_boolean_response(response, boolean):
        print "Correct!"
    else:
        print "Wrong!"
    print "The first note was " + note.name
    print "The chord was " + ", ".join(map(str, chord))
Ejemplo n.º 2
0
def test_single_pitch(note_list=None):
    note = random_note(note_list)
    write_midi(note)
    player.play_music()

    response = input("What is the note? ")
    if response == note.name:
        print("Correct!")
    else:
        print("The note was " + note.name)
Ejemplo n.º 3
0
def pitch_meditation(pitch=None, repeat=100): 
    if isinstance(pitch, Note):
        note = pitch
    elif pitch:
        note = Note(pitch, 5, 1, 100)
    else:
        note = random_note()
    notes = [note]
    while repeat:
        notes.append(note)
        repeat = repeat - 1
    write_midi(notes)
    print "The note is " + note.name
    player.play_music()
Ejemplo n.º 4
0
def play_random_sequences(notes=None, repeat=20, length=4):
    if notes: 
        if isinstance(notes, NoteSeq): # Handles NoteSeq only
            write_list = []
            while repeat:
                phrase_length = length
                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()
Ejemplo n.º 5
0
def pitch_in_random_chords(pitch=None, repeat=100):
    if isinstance(pitch, Note):
        note = pitch
    elif pitch:
        note = Note(pitch, 5, 1, 100)
    else:
        note = random_note()
    
    notes_list = []
    while repeat: 
        if repeat % 2: # Alternate
            notes = NoteSeq([note] + random_chord()) # Chord with note in it
            notes_list.append(notes)
        else:
            notes_list.append(note)
        repeat = repeat - 1

    print "The note is " + note.name
    write_midi(notes_list)
    player.play_music()