Example #1
0
def play_result_and_quit():
    #End of selection process, program will now repeat back all selections

    #Top of the hour, disregard minute
    if CURRENT_MINUTE == 0:
        sound.combine_wav_files(TMP_FILE_WAV, YOU_SELECTED_WAV,
                                DAYS_WAV[CURRENT_DAY], HOURS_WAV[CURRENT_HOUR],
                                AMPM_WAV[CURRENT_AMPM])

    #Single digit minute, use OH_WAV
    elif CURRENT_MINUTE >= 1 and CURRENT_MINUTE < 10:
        sound.combine_wav_files(TMP_FILE_WAV, YOU_SELECTED_WAV,
                                DAYS_WAV[CURRENT_DAY], HOURS_WAV[CURRENT_HOUR],
                                OH_WAV, MINUTES_WAV[CURRENT_MINUTE],
                                AMPM_WAV[CURRENT_AMPM])

    else:
        sound.combine_wav_files(TMP_FILE_WAV, YOU_SELECTED_WAV,
                                DAYS_WAV[CURRENT_DAY], HOURS_WAV[CURRENT_HOUR],
                                MINUTES_WAV[CURRENT_MINUTE],
                                AMPM_WAV[CURRENT_AMPM])

    sound.Play(TMP_FILE_WAV)
    time.sleep(4.8)

    sound.Play(EXITING_PROGRAM_WAV)
    # A delay is needed so the sound gets played before quitting.
    time.sleep(EXITING_PROGRAM_WAV_DURATION)
    sound.cleanup()
Example #2
0
def set_day():
    global CURRENT_TIME
    global CURRENT_DAY

    CURRENT_TIME = 0

    #Play the entering state audio
    sound.Play(SET_DAY_WAV)
    time.sleep(1.4)

    #Play current day selection
    sound.combine_wav_files(TMP_FILE_WAV, CURRENT_DAY_WAV,
                            DAYS_WAV[CURRENT_TIME])
    sound.Play(TMP_FILE_WAV)
    time.sleep(3)

    # Get the first keystroke.
    c = readchar.readchar()

    # Endless loop responding to the user's last keystroke.
    # The loop breaks when the user hits the SELECT_KEY or the QUIT_KEY
    while True:

        # Respond to the user's input.
        if c == FORWARD_KEY:

            # Advance the time, looping back around to the start.
            CURRENT_TIME += 1
            if CURRENT_TIME == len(DAYS_WAV):
                CURRENT_TIME = 0

            # Concatenate two audio files to generate the message.
            sound.combine_wav_files(TMP_FILE_WAV, DAYS_WAV[CURRENT_TIME])

            # Play the concatenated file.
            sound.Play(TMP_FILE_WAV)

        # Backward key
        if c == BACKWARD_KEY:

            # Move backward, looping around
            CURRENT_TIME -= 1
            if CURRENT_TIME == -1:
                CURRENT_TIME = len(DAYS_WAV) - 1

            # Concatenate two audio files to generate the message.
            sound.combine_wav_files(TMP_FILE_WAV, DAYS_WAV[CURRENT_TIME])

            # Play the concatenated file.
            sound.Play(TMP_FILE_WAV)

        # Selects current time
        if c == SELECT_KEY:
            sound.combine_wav_files(TMP_FILE_WAV, YOU_SELECTED_WAV,
                                    DAYS_WAV[CURRENT_TIME])

            # Save the hour selection
            CURRENT_DAY = CURRENT_TIME

            # Play the concatenated file.
            sound.Play(TMP_FILE_WAV)
            time.sleep(2.8)

            #Go to set hour state
            set_hour()
            break

        #User presses help key
        if c == HELP_KEY:

            # Notify the user that another HELP_KEY will play the help menu
            sound.Play(PRESS_AGAIN_FOR_HELP_WAV)

            # Get the user's next keystroke.
            c = readchar.readchar()

            # If the user pressed HELP_KEY, play key options
            if c == HELP_KEY:
                sound.combine_wav_files(TMP_FILE_WAV, QUIT_WAV, HELP_WAV,
                                        DOWN_WAV, UP_WAV, SELECT_WAV)
                sound.Play(TMP_FILE_WAV)

        # User quits.
        if c == QUIT_KEY:

            # Notify the user that another QUIT_MENU_KEY will quit the program.
            sound.Play(PRESS_AGAIN_TO_QUIT_WAV)

            # Get the user's next keystroke.
            c = readchar.readchar()

            # If the user pressed QUIT_MENU_KEY, quit the program.
            if c == QUIT_KEY:
                sound.Play(EXITING_PROGRAM_WAV)
                # A delay is needed so the sound gets played before quitting.
                time.sleep(EXITING_PROGRAM_WAV_DURATION)
                sound.cleanup()
                # Quit the program
                break

        # The user presses a key that will have no effect.
        else:
            # Get the user's next keystroke.
            c = readchar.readchar()
Example #3
0
def set_AMPM():
    global CURRENT_TIME
    global CURRENT_AMPM

    CURRENT_TIME = 0

    #Entering new state, play audio to tell user
    sound.Play(SET_PERIOD_WAV)
    time.sleep(1.5)

    #Play current selection of period
    sound.combine_wav_files(TMP_FILE_WAV, CURRENT_AMPM_WAV,
                            AMPM_WAV[CURRENT_TIME])
    sound.Play(TMP_FILE_WAV)
    time.sleep(2.6)

    # Get the first keystroke.
    c = readchar.readchar()

    # Endless loop responding to the user's last keystroke.
    # The loop breaks when the user hits the SELECT_KEY or the QUIT_KEY
    while True:

        # Respond to the user's input.
        if c == FORWARD_KEY:

            # Advance the time, looping back around to the start.
            CURRENT_TIME += 1
            if CURRENT_TIME == 2:
                CURRENT_TIME = 0

            # Concatenate two audio files to generate the message.
            sound.combine_wav_files(TMP_FILE_WAV, AMPM_WAV[CURRENT_TIME])

            # Play the concatenated file.
            sound.Play(TMP_FILE_WAV)

        # Backward key
        if c == BACKWARD_KEY:

            # Move backward, looping around
            CURRENT_TIME -= 1
            if CURRENT_TIME == -1:
                CURRENT_TIME = 1

            # Concatenate two audio files to generate the message.
            sound.combine_wav_files(TMP_FILE_WAV, AMPM_WAV[CURRENT_TIME])

            # Play the concatenated file.
            sound.Play(TMP_FILE_WAV)

        # Selects current time
        if c == SELECT_KEY:
            sound.combine_wav_files(TMP_FILE_WAV, YOU_SELECTED_WAV,
                                    AMPM_WAV[CURRENT_TIME])

            # Save minute selection
            CURRENT_AMPM = CURRENT_TIME

            # Play the concatenated file.
            sound.Play(TMP_FILE_WAV)
            time.sleep(2)

            #Selected last input, move on to play result and quit
            play_result_and_quit()
            break

        #User presses help key
        if c == HELP_KEY:

            # Notify the user that another HELP_KEY will play the help menu
            sound.Play(PRESS_AGAIN_FOR_HELP_WAV)

            # Get the user's next keystroke.
            c = readchar.readchar()

            # If the user pressed HELP_KEY, play key options
            if c == HELP_KEY:
                sound.combine_wav_files(TMP_FILE_WAV, QUIT_WAV, HELP_WAV,
                                        DOWN_WAV, UP_WAV, SELECT_WAV)
                sound.Play(TMP_FILE_WAV)

        # User quits.
        if c == QUIT_KEY:

            # Notify the user that another QUIT_MENU_KEY will quit the program.
            sound.Play(PRESS_AGAIN_TO_QUIT_WAV)

            # Get the user's next keystroke.
            c = readchar.readchar()

            # If the user pressed QUIT_MENU_KEY, quit the program.
            if c == QUIT_KEY:
                sound.Play(EXITING_PROGRAM_WAV)
                # A delay is needed so the sound gets played before quitting.
                time.sleep(EXITING_PROGRAM_WAV_DURATION)
                sound.cleanup()
                # Quit the program
                break

        # The user presses a key that will have no effect.
        else:
            # Get the user's next keystroke.
            c = readchar.readchar()
Example #4
0
def run_menu():

    global CURRENT_MINUTE, CURRENT_HOUR, CURRENT_DAY

    # Provide a minimal indication that the program has started.
    print(MINIMAL_HELP_STRING)

    # Get the first keystroke.
    c = readchar.readchar()

    # Endless loop responding to the user's last keystroke.
    # The loop breaks when the user hits the QUIT_MENU_KEY.
    while True:

        # Respond to the user's input.
        if c == START_KEY:
            CURRENT_DAY = 0
            CURRENT_HOUR = 1
            CURRENT_MINUTE = 0

            #Print the set of instructions for setting the day
            print(BACKWARD_AND_FORWARD_INSTRUCTIONS_DAY)
            sound.Play(SELECT_DAY_OF_THE_WEEK)
            time.sleep(EXITING_PROGRAM_WAV_DURATION)
            sound.Play(DAYS_OF_WEEK_WAV[CURRENT_DAY])
            c = readchar.readchar()

            # Following loop allows the user to choose the day, it breaks when the user presses the SET_KEY
            while True:

                if c == FORWARD_KEY:  #increments or resets the current_day value
                    if CURRENT_DAY != 6:
                        CURRENT_DAY += 1
                    else:
                        CURRENT_DAY = 0
                    sound.Play(DAYS_OF_WEEK_WAV[CURRENT_DAY])
                    c = readchar.readchar()

                elif c == BACKWARD_KEY:  #decrements or resets the current_day value

                    if CURRENT_DAY != 0:
                        CURRENT_DAY -= 1
                    else:
                        CURRENT_DAY = 6
                    sound.Play(
                        DAYS_OF_WEEK_WAV[CURRENT_DAY]
                    )  #plays the sound file corresponding to the index of array containing the day of the week sound files
                    c = readchar.readchar()
                elif c == SET_KEY:
                    break
                else:
                    # Get the user's next keystroke.
                    c = readchar.readchar()
            #end while

            #Print the set of instructions for setting the hour
            print(BACKWARD_AND_FORWARD_INSTRUCTIONS_HOUR)
            sound.Play(SET_HOUR)
            time.sleep(EXITING_PROGRAM_WAV_DURATION)
            sound.Play(NUMBERS_WAV[CURRENT_HOUR])
            c = readchar.readchar()

            #The following loop is for setting hour, the hours ranges from 0-23, it exits the loop by pressing 'set' or 'quit.'
            while True:

                if c == FORWARD_KEY:

                    if CURRENT_HOUR != 23:
                        CURRENT_HOUR += 1
                    else:
                        CURRENT_HOUR = 0

                    sound.Play(NUMBERS_WAV[CURRENT_HOUR])
                    c = readchar.readchar()
                elif c == BACKWARD_KEY:

                    if CURRENT_HOUR != 0:
                        CURRENT_HOUR -= 1
                    else:
                        CURRENT_HOUR = 23

                    sound.Play(NUMBERS_WAV[CURRENT_HOUR])
                    c = readchar.readchar()
                elif c == SET_KEY:
                    break
                else:
                    c = readchar.readchar()
            #end while

            #Print the set of instructions for setting the minutes
            print(BACKWARD_AND_FORWARD_INSTRUCTIONS_MINS)
            sound.Play(SET_MIN)
            time.sleep(EXITING_PROGRAM_WAV_DURATION)
            sound.Play(NUMBERS_WAV[CURRENT_MINUTE])
            c = readchar.readchar()

            #The following loop is for setting minutes, the minutes ranges from 0-59, it exits the loop by pressing 'set' or 'quit.'
            while True:
                if c == FORWARD_KEY:

                    if CURRENT_MINUTE != 59:
                        CURRENT_MINUTE += 1
                    else:
                        CURRENT_MINUTE = 0

                    sound.Play(NUMBERS_WAV[CURRENT_MINUTE])
                    c = readchar.readchar()
                elif c == BACKWARD_KEY:

                    if CURRENT_MINUTE != 0:
                        CURRENT_MINUTE -= 1
                    else:
                        CURRENT_MINUTE = 59

                    sound.Play(NUMBERS_WAV[CURRENT_MINUTE])
                    c = readchar.readchar()
                elif c == SET_KEY:
                    break
                else:
                    c = readchar.readchar()

            #if the time is in the AM
            if CURRENT_HOUR <= 12:
                sound.combine_wav_files(TMP_FILE_WAV, YOU_SELECTED_WAV,
                                        DAYS_OF_WEEK_WAV[CURRENT_DAY],
                                        NUMBERS_WAV[CURRENT_HOUR],
                                        NUMBERS_WAV[CURRENT_MINUTE], AM_WAV)
                sound.Play(TMP_FILE_WAV)

            # if the time is in the PM
            if CURRENT_HOUR > 12:
                sound.combine_wav_files(TMP_FILE_WAV, YOU_SELECTED_WAV,
                                        DAYS_OF_WEEK_WAV[CURRENT_DAY],
                                        NUMBERS_WAV[CURRENT_HOUR - 12],
                                        NUMBERS_WAV[CURRENT_MINUTE], PM_WAV)
                sound.Play(TMP_FILE_WAV)

            #Making the program sleep until the combined wav files is done being reported
            time.sleep(EXITING_PROGRAM_WAV_DURATION)
            time.sleep(EXITING_PROGRAM_WAV_DURATION)
            time.sleep(EXITING_PROGRAM_WAV_DURATION)
            time.sleep(EXITING_PROGRAM_WAV_DURATION)

            #Intructions for starting over or exiting the program
            sound.Play(INTRO_WAV)
            print(MINIMAL_HELP_STRING)
            c = readchar.readchar()

        # User quits.
        elif c == QUIT_KEY:

            # Notify the user that another QUIT_MENU_KEY will quit the program.
            sound.Play(PRESS_AGAIN_TO_QUIT_WAV)

            # Get the user's next keystroke.
            c = readchar.readchar()

            # If the user pressed QUIT_MENU_KEY, quit the program.
            if c == QUIT_KEY:
                sound.Play(EXITING_PROGRAM_WAV)
                # A delay is needed so the sound gets played before quitting.
                time.sleep(EXITING_PROGRAM_WAV_DURATION)
                sound.cleanup()
                # Quit the program
                break

        # The user presses a key that will have no effect.
        else:
            # Get the user's next keystroke.
            c = readchar.readchar()
Example #5
0
def run_menu():

    global CURRENT_TIME
    global CURRENT_DAY 
    global CURRENT_HOUR
    global CURRENT_MINUTE

    #boolean for switching from days to hours
    days_selection = True

    #boolean for switching from hours to minutes if a developer should extend program for minutes
    hour_selection = False

    #booleans for switching from am to pm
    am = True
    pm = False
    
    # Provide a minimal indication that the program has started.
    print(MINIMAL_HELP_STRING)
    # Indicate program has started and list options for user
    sound.Play(INTRO_WAV)
     
    # Get the first keystroke.
    c = readchar.readchar()

    # Endless loop responding to the user's last keystroke.
    # The loop breaks when the user hits the QUIT_MENU_KEY or SET_KEY the second time.
    while True:
        
        #this now should loop though days
        if c == BACKWARD_KEY and days_selection == True:
            if CURRENT_DAY == 0:
                CURRENT_DAY = len(DAYS_WAV)-1
            else:
                CURRENT_DAY -= 1
           

            # Concatenate three audio files to generate the message.
            sound.combine_wav_files(TMP_FILE_WAV, YOU_SELECTED_WAV,
                                    DAYS_WAV[CURRENT_DAY])
            # Play the concatenated file.
            sound.Play(TMP_FILE_WAV)

        # Respond to the user's input. If the day selection is true
        # means if the user has not yet selected a day.
        if c == FORWARD_KEY and days_selection == True:

            # Advance the time, looping back around to the start.
            CURRENT_DAY += 1
            if CURRENT_DAY == len(DAYS_WAV):
                CURRENT_DAY = 0

            # Concatenate three audio files to generate the message.
            sound.combine_wav_files(TMP_FILE_WAV, YOU_SELECTED_WAV,
                                    DAYS_WAV[CURRENT_DAY])
            # Play the concatenated file.
            sound.Play(TMP_FILE_WAV)
        
        # repeat intro if the user hasnt set the day yet
        if c == REPEAT_KEY and days_selection == True:
            sound.Play(INTRO_WAV)
        # repeat set time instruction if days have been selected
        if c == REPEAT_KEY and days_selection == False:
            sound.Play(SET_HOUR_WAV)
        

        # this now should loop though hours
        # since day selection is false the user already selected a day.
        if c == BACKWARD_KEY and days_selection == False:
            
            # boolean variable for converting am to pm and vice versa
            convert = False

            if CURRENT_TIME == 0:
                CURRENT_TIME = 11

                # change from am to pm or vice versa
                convert = True

            else:
                CURRENT_TIME -= 1
         
            #configure am and pm
            if(convert):
                if am == True:
                    am = False
                    pm = True
                    convert = False
                else:
                    am = True
                    pm = False
                    convert = False

            if am == True:
                # Concatenate three audio files to generate the message.
                sound.combine_wav_files(TMP_FILE_WAV, YOU_SELECTED_WAV,
                                    NUMBERS_WAV[CURRENT_TIME], AM_WAV)
            else:
                # Concatenate three audio files to generate the message.
                sound.combine_wav_files(TMP_FILE_WAV, YOU_SELECTED_WAV,
                                    NUMBERS_WAV[CURRENT_TIME], PM_WAV)

            # Play the concatenated file.
            sound.Play(TMP_FILE_WAV)   
        # selecting hour
        if c == FORWARD_KEY and days_selection == False:

            # variable for converting am to pm and vice versa
            convert = False
            
            # Advance the time, looping back around to the start.
            if (CURRENT_TIME) > 10:
                CURRENT_TIME = 0
                # change from am to pm or vice versa
                convert = True
            else:
                CURRENT_TIME += 1
            

            #configure am and pm
            if(convert):
                if am == True:
                    am = False
                    pm = True
                    convert = False
                else:
                    am = True
                    pm = False
                    convert = False

            if am == True:
                # Concatenate three audio files to generate the message.
                sound.combine_wav_files(TMP_FILE_WAV, YOU_SELECTED_WAV,
                                    NUMBERS_WAV[CURRENT_TIME], AM_WAV)
            else:
                # Concatenate three audio files to generate the message.
                sound.combine_wav_files(TMP_FILE_WAV, YOU_SELECTED_WAV,
                                    NUMBERS_WAV[CURRENT_TIME], PM_WAV)

            # Play the concatenated file.
            sound.Play(TMP_FILE_WAV)    
        

        if c == SET_KEY:

            # second time being pressed
            if days_selection == False:
                # audio recognition of hours being selected
                sound.Play(HOUR_SET_WAV)
                # pause to play next sound
                time.sleep(PAUSING_BETWEEN_AUDIO_FILE_DURATION)
                # informing exit
                sound.Play(EXITING_PROGRAM_WAV)
                # A delay is needed so the sound gets played before quitting.
                time.sleep(EXITING_PROGRAM_WAV_DURATION)
                sound.cleanup()
                # Quit the program
                break
            else:
                # disable day conditions
                days_selection = False
                sound.Play(DAY_SET_WAV)
                time.sleep(PAUSING_BETWEEN_AUDIO_FILE_DURATION)
                #indicate switch from days to hours
                sound.Play(SET_HOUR_WAV)
                        
                #listen for user input
                c = readchar.readchar() 

        # User quits.
        if c == QUIT_KEY:

            # Notify the user that another QUIT_MENU_KEY will quit the program.
            sound.Play(PRESS_AGAIN_TO_QUIT_WAV)

            # Get the user's next keystroke.
            c = readchar.readchar()

            # If the user pressed QUIT_MENU_KEY, quit the program.
            if c == QUIT_KEY:
                sound.Play(EXITING_PROGRAM_WAV)
                # A delay is needed so the sound gets played before quitting.
                time.sleep(EXITING_PROGRAM_WAV_DURATION)
                sound.cleanup()
                # Quit the program
                break

        # The user presses a key that will have no effect.
        else:
            # Get the user's next keystroke.
            c = readchar.readchar()
Example #6
0
def quit_program():
    sound.Play(EXITING_PROGRAM_WAV)
    # A delay is needed so the sound gets played before quitting.
    time.sleep(EXITING_PROGRAM_WAV_DURATION)
    sound.cleanup()
    quit()
Example #7
0
def run_menu():

    global CURRENT_TIME
    global CURRENT_DAY
    global CURRENT_HOUR
    global CURRENT_MINUTE

    #boolean for switching from days to hours
    days_selection = True

    #boolean for switching from hours to minutes if a developer should extend program for minutes
    hour_selection = False

    #booleans for switching from am to pm
    am = True
    pm = False

    # Provide a minimal indication that the program has started.
    print(MINIMAL_HELP_STRING)
    # Indicate program has started and list options for user
    sound.Play(INTRO_WAV)

    # Get the first keystroke.
    c = readchar.readchar()

    # Endless loop responding to the user's last keystroke.
    # The loop breaks when the user hits the QUIT_MENU_KEY or SET_KEY the second time.
    while True:

        #this now should loop though days
        if c == BACKWARD_KEY and days_selection == True:
            if CURRENT_DAY == 0:
                CURRENT_DAY = len(DAYS_WAV) - 1
            else:
                CURRENT_DAY -= 1

            # Concatenate three audio files to generate the message.
            sound.combine_wav_files(TMP_FILE_WAV, YOU_SELECTED_WAV,
                                    DAYS_WAV[CURRENT_DAY])
            # Play the concatenated file.
            sound.Play(TMP_FILE_WAV)

        # Respond to the user's input. If the day selection is true
        # means if the user has not yet selected a day.
        if c == FORWARD_KEY and days_selection == True:

            # Advance the time, looping back around to the start.
            CURRENT_DAY += 1
            if CURRENT_DAY == len(DAYS_WAV):
                CURRENT_DAY = 0

            # Concatenate three audio files to generate the message.
            sound.combine_wav_files(TMP_FILE_WAV, YOU_SELECTED_WAV,
                                    DAYS_WAV[CURRENT_DAY])
            # Play the concatenated file.
            sound.Play(TMP_FILE_WAV)

        # repeat intro if the user hasnt set the day yet
        if c == REPEAT_KEY and days_selection == True:
            sound.Play(INTRO_WAV)
        # repeat set time instruction if days have been selected
        if c == REPEAT_KEY and days_selection == False:
            sound.Play(SET_HOUR_WAV)

        # this now should loop though hours
        if c == BACKWARD_KEY and days_selection == False and hour_selection == True:

            # boolean variable for converting am to pm and vice versa
            convert = False

            if CURRENT_HOUR <= 1:
                CURRENT_HOUR = 12

                # change from am to pm or vice versa
                convert = True

            else:
                CURRENT_HOUR -= 1

            # configure am and pm
            if (convert):
                if am == True:
                    am = False
                    pm = True
                    convert = False
                else:
                    am = True
                    pm = False
                    convert = False

            if am == True:
                # Concatenate three audio files to generate the message.
                sound.combine_wav_files(TMP_FILE_WAV, YOU_SELECTED_WAV,
                                        NUMBERS_WAV[CURRENT_HOUR], AM_WAV)
            else:
                # Concatenate three audio files to generate the message.
                sound.combine_wav_files(TMP_FILE_WAV, YOU_SELECTED_WAV,
                                        NUMBERS_WAV[CURRENT_HOUR], PM_WAV)

            # Play the concatenated file.
            sound.Play(TMP_FILE_WAV)

        # selecting minute
        if c == FORWARD_KEY and days_selection == False and hour_selection == False:

            # advance the time, looping back around to the start.
            if (CURRENT_MINUTE) > 58:
                CURRENT_MINUTE = 0
                # change from am to pm or vice versa
                convert = True
            else:
                CURRENT_MINUTE += 1

            # Concatenate three audio files to generate the message.
            sound.combine_wav_files(TMP_FILE_WAV, YOU_SELECTED_WAV,
                                    NUMBERS_WAV[CURRENT_MINUTE])
            sound.Play(TMP_FILE_WAV)

        # selecting minute
        if c == BACKWARD_KEY and days_selection == False and hour_selection == False:

            if CURRENT_MINUTE == 1:
                CURRENT_MINUTE = 59
            else:
                CURRENT_MINUTE -= 1
            # Concatenate three audio files to generate the message.
            sound.combine_wav_files(TMP_FILE_WAV, YOU_SELECTED_WAV,
                                    NUMBERS_WAV[CURRENT_MINUTE])
            sound.Play(TMP_FILE_WAV)

        # selecting hour
        if c == FORWARD_KEY and days_selection == False and hour_selection == True:

            # variable for converting am to pm and vice versa
            convert = False

            # Advance the time, looping back around to the start.
            if (CURRENT_HOUR) > 11:
                CURRENT_HOUR = 1
                # change from am to pm or vice versa
                convert = True
            else:
                CURRENT_HOUR += 1

            #configure am and pm
            if (convert):
                if am == True:
                    am = False
                    pm = True
                    convert = False
                else:
                    am = True
                    pm = False
                    convert = False

            if am == True:
                # Concatenate three audio files to generate the message.
                sound.combine_wav_files(TMP_FILE_WAV, YOU_SELECTED_WAV,
                                        NUMBERS_WAV[CURRENT_HOUR], AM_WAV)
            else:
                # Concatenate three audio files to generate the message.
                sound.combine_wav_files(TMP_FILE_WAV, YOU_SELECTED_WAV,
                                        NUMBERS_WAV[CURRENT_HOUR], PM_WAV)

            # Play the concatenated file.
            sound.Play(TMP_FILE_WAV)

        if c == SET_KEY:

            # second time being pressed
            if hour_selection == True:
                # so if day selection is false then program went through hour cycle already and came back
                hour_selection = False
                # audio recognition of hours being selected
                sound.Play(HOUR_SET_WAV)
                # pause between sounds
                time.sleep(PAUSING_BETWEEN_AUDIO_FILE_DURATION_FASTER)
                # indicate to set minutes
                sound.Play(SET_MINUTES_WAV)

            elif days_selection == True:
                # disable day conditions
                days_selection = False
                hour_selection = True
                sound.Play(DAY_SET_WAV)
                # pause between sounds
                time.sleep(PAUSING_BETWEEN_AUDIO_FILE_DURATION_FASTER)
                #indicate switch from days to hours
                sound.Play(SET_HOUR_WAV)

                #listen for user input
                c = readchar.readchar()

            # minutes == true
            elif days_selection == False and hour_selection == False:

                if am == True:

                    # numbers starting at one and and ending at nine are pronounced: "number oh number" typically
                    # example: 1:10 = "one ten" whereas 1:09= "one oh nine"
                    if (CURRENT_MINUTE < 10 and CURRENT_MINUTE > 0):

                        # audio recognition of minutes being selected and result of all selections
                        # Concatenate three audio files to generate the message.
                        sound.combine_wav_files(TMP_FILE_WAV,
                                                DAYS_WAV[CURRENT_DAY],
                                                NUMBERS_WAV[CURRENT_HOUR],
                                                OH_WAV,
                                                NUMBERS_WAV[CURRENT_MINUTE],
                                                AM_WAV, EXITING_PROGRAM_WAV)
                        sound.Play(TMP_FILE_WAV)

                    # if the minutes are equal to zero then we should not say the minutes, example 1:00 = "1 am" or "1 pm"
                    elif (CURRENT_MINUTE == 0):

                        sound.combine_wav_files(TMP_FILE_WAV,
                                                DAYS_WAV[CURRENT_DAY],
                                                NUMBERS_WAV[CURRENT_HOUR],
                                                AM_WAV)
                        sound.Play(TMP_FILE_WAV)

                    else:
                        # audio recognition of minutes being selected and result of all selections
                        # Concatenate three audio files to generate the message.

                        sound.combine_wav_files(TMP_FILE_WAV,
                                                DAYS_WAV[CURRENT_DAY],
                                                NUMBERS_WAV[CURRENT_HOUR],
                                                NUMBERS_WAV[CURRENT_MINUTE],
                                                AM_WAV, EXITING_PROGRAM_WAV)
                        sound.Play(TMP_FILE_WAV)

                    # giving time for the current audio to finish playing before exiting program.
                    time.sleep(PAUSING_BETWEEN_AUDIO_FILE_DURATION_SLOWER)
                    quit_program()

                # if pm is true and am is false
                else:
                    # numbers starting at one and and ending at nine are pronounced: "number oh number" typically
                    # example: 1:10 = "one ten" whereas 1:09= "one oh nine"
                    if (CURRENT_MINUTE < 10 and CURRENT_MINUTE > 0):
                        # audio recognition of minutes being selected and result of all selections
                        # Concatenate three audio files to generate the message.

                        sound.combine_wav_files(TMP_FILE_WAV,
                                                DAYS_WAV[CURRENT_DAY],
                                                NUMBERS_WAV[CURRENT_HOUR],
                                                OH_WAV,
                                                NUMBERS_WAV[CURRENT_MINUTE],
                                                PM_WAV)
                        sound.Play(TMP_FILE_WAV)

                    # if the minutes are equal to zero then we should not say the minutes, example 1:00 = "1 am" or "1 pm"
                    elif (CURRENT_MINUTE == 0):

                        sound.combine_wav_files(TMP_FILE_WAV,
                                                DAYS_WAV[CURRENT_DAY],
                                                NUMBERS_WAV[CURRENT_HOUR],
                                                AM_WAV)
                        sound.Play(TMP_FILE_WAV)

                    else:
                        # audio recognition of minutes being selected and result of all selections
                        # Concatenate three audio files to generate the message.

                        sound.combine_wav_files(TMP_FILE_WAV,
                                                DAYS_WAV[CURRENT_DAY],
                                                NUMBERS_WAV[CURRENT_HOUR],
                                                NUMBERS_WAV[CURRENT_MINUTE],
                                                PM_WAV)

                        sound.Play(TMP_FILE_WAV)

                    # giving time for the current audio to finish playing before exiting program.
                    time.sleep(PAUSING_BETWEEN_AUDIO_FILE_DURATION_SLOWER)
                    quit_program()

        # User quits.
        if c == QUIT_KEY:

            # Notify the user that another QUIT_MENU_KEY will quit the program.
            sound.Play(PRESS_AGAIN_TO_QUIT_WAV)

            # Get the user's next keystroke.
            c = readchar.readchar()

            # If the user pressed QUIT_MENU_KEY, quit the program.
            if c == QUIT_KEY:
                sound.Play(EXITING_PROGRAM_WAV)
                # A delay is needed so the sound gets played before quitting.
                time.sleep(EXITING_PROGRAM_WAV_DURATION)
                sound.cleanup()
                # Quit the program
                break

        # The user presses a key that will have no effect.
        else:
            # Get the user's next keystroke.
            c = readchar.readchar()
Example #8
0
def run_fenu():

    global CURRENT_TIME
    global CURRENT_DAY 

    #boolean for switching from days to hours
    days_selection = True

    #boolean for switching from hours to minutes
    hours_selection = False

    #booleans for switching from am to pm
    am = True
    pm = False
    
    # Provide a minimal indication that the program has started.
    print(MINIMAL_HELP_STRING)

    
    # Concatenate three audio files to generate the message.
    sound.combine_wav_files(TMP_FILE_WAV, INTRO_WAV, SET_DAY_WAV)
    # Play the concatenated file.
    sound.Play(TMP_FILE_WAV)

    # Get the 2nd keystroke.
    c = readchar.readchar()

    # Endless loop responding to the user's last keystroke.
    # The loop breaks when the user hits the QUIT_MENU_KEY or SET_KEY the second time.
    while True:
          
        
        #this now should loop though days
        if c == BACKWARD_KEY and days_selection == True:
            if CURRENT_DAY == 0:
                CURRENT_DAY = len(DAYS_WAV)-1
            else:
                CURRENT_DAY -= 1
           

            # Concatenate three audio files to generate the message.
            sound.combine_wav_files(TMP_FILE_WAV, YOU_SELECTED_WAV,
                                    DAYS_WAV[CURRENT_DAY])
            # Play the concatenated file.
            sound.Play(TMP_FILE_WAV)

        # Respond to the user's input.
        if c == FORWARD_KEY and days_selection == True:

            # Advance the time, looping back around to the start.
            CURRENT_DAY += 1
            if CURRENT_DAY == len(DAYS_WAV):
                CURRENT_DAY = 0

            # Concatenate three audio files to generate the message.
            sound.combine_wav_files(TMP_FILE_WAV, YOU_SELECTED_WAV,
                                    DAYS_WAV[CURRENT_DAY])
            # Play the concatenated file.
            sound.Play(TMP_FILE_WAV)


        

        # this now should loop though hours
        if c == BACKWARD_KEY and days_selection == False:

            hours_selection = True
            
            # variable for converting am to pm and vice versa
            convert = False

            if CURRENT_TIME == 0:
                CURRENT_TIME = len(NUMBERS_WAV)-1

                # change from am to pm or vice versa
                convert = True

            else:
                CURRENT_TIME -= 1
           

            print(CURRENT_TIME)
            #configure am and pm
            if(convert):
                if am == True:
                    am = False
                    pm = True
                    convert = False
                else:
                    am = True
                    pm = False
                    convert = False

            if am == True:
                # Concatenate three audio files to generate the message.
                sound.combine_wav_files(TMP_FILE_WAV, YOU_SELECTED_WAV,
                                    NUMBERS_WAV[CURRENT_TIME], AM_WAV)
            else:
                # Concatenate three audio files to generate the message.
                sound.combine_wav_files(TMP_FILE_WAV, YOU_SELECTED_WAV,
                                    NUMBERS_WAV[CURRENT_TIME], PM_WAV)

            # Play the concatenated file.
            sound.Play(TMP_FILE_WAV)   

        if c == FORWARD_KEY and days_selection == False:

            hours_selection = True

            # variable for converting am to pm and vice versa
            convert = False
            
            # Advance the time, looping back around to the start.
            if (CURRENT_TIME+1) == len(NUMBERS_WAV):
                CURRENT_TIME = 0
                # change from am to pm or vice versa
                convert = True
            else:
                CURRENT_TIME += 1
            
            print(CURRENT_TIME)

            #configure am and pm
            if(convert):
                if am == True:
                    am = False
                    pm = True
                    convert = False
                else:
                    am = True
                    pm = False
                    convert = False

            if am == True:
                # Concatenate three audio files to generate the message.
                sound.combine_wav_files(TMP_FILE_WAV, YOU_SELECTED_WAV,
                                    NUMBERS_WAV[CURRENT_TIME], AM_WAV)
            else:
                # Concatenate three audio files to generate the message.
                sound.combine_wav_files(TMP_FILE_WAV, YOU_SELECTED_WAV,
                                    NUMBERS_WAV[CURRENT_TIME], PM_WAV)

            # Play the concatenated file.
            sound.Play(TMP_FILE_WAV)    
        

        if c == SET_KEY:

            if days_selection == True:
                # day is selected 
                days_selection = False

                hours_selection = True

                #indicate switch from days to hours
                sound.Play(SET_HOUR_WAV)

                #listen for user input
                c = readchar.readchar() 

            elif hours_selection = True:

                hours_selection = False

            else:
                sound.Play(EXITING_PROGRAM_WAV)
                break

            # second time being pressed
            if days_selection == False:
                sound.Play(EXITING_PROGRAM_WAV)
                break
            else:
                # disable day conditions
                days_selection = False

                #indicate switch from days to hours
                sound.Play(SET_HOUR_WAV)
                        
                #listen for user input
                c = readchar.readchar() 

        # User quits.
        if c == QUIT_KEY:

            # Notify the user that another QUIT_MENU_KEY will quit the program.
            sound.Play(PRESS_AGAIN_TO_QUIT_WAV)

            # Get the user's next keystroke.
            c = readchar.readchar()

            # If the user pressed QUIT_MENU_KEY, quit the program.
            if c == QUIT_KEY:
                sound.Play(EXITING_PROGRAM_WAV)
                # A delay is needed so the sound gets played before quitting.
                time.sleep(EXITING_PROGRAM_WAV_DURATION)
                sound.cleanup()
                # Quit the program
                break

        # The user presses a key that will have no effect.
        else:
            # Get the user's next keystroke.
            c = readchar.readchar()
Example #9
0
def run_menu():

    global CURRENT_DAY
    global CURRENT_HOUR
    global CURRENT_MINUTES
    global CURRENT_AM_PM
    global CURRENT_MENU_CHOICE

    # Play the introduction audio
    sound.Play(INTRO_WAV)

    # Provide a minimal indication that the program has started.
    print(MINIMAL_HELP_STRING)

    # Get the first keystroke.
    c = readchar.readchar()

    # Endless loop responding to the user's last keystroke.
    # The loop breaks when the user hits the QUIT_MENU_KEY.
    while True:

        # Respond to the user's input.
        if c == FORWARD_KEY:

            # Advance the time, looping back around to the start.
            CURRENT_MENU_CHOICE += 1

            if CURRENT_MENU_CHOICE == len(MENU_CHOICES_WAV):
                CURRENT_MENU_CHOICE = 0

            sound.Play(MENU_CHOICES_WAV[CURRENT_MENU_CHOICE])

        if c == BACKWARD_KEY:

            # Retreat the time, looping back around to the end.
            CURRENT_MENU_CHOICE -= 1

            if CURRENT_MENU_CHOICE < 0:
                CURRENT_MENU_CHOICE = len(MENU_CHOICES_WAV) - 1

            sound.Play(MENU_CHOICES_WAV[CURRENT_MENU_CHOICE])

        if c == SET_KEY:

            #Run the sub-menu function. run_submenu() will determine what specific submenu to run based on the value of CURRENT_MENU_CHOICE
            run_submenu()

        if c == HELP_KEY:

            # Create and play the help audio. Starting with the current day and time.
            sound.combine_wav_files(TMP_FILE_WAV, IT_IS_WAV,
                                    DAYS_WAV[CURRENT_DAY],
                                    HOURS_WAV[CURRENT_HOUR],
                                    MINUTES_WAV[CURRENT_MINUTES],
                                    AM_AND_PM_WAV[CURRENT_AM_PM], HELP_WAV)
            sound.Play(TMP_FILE_WAV)

        # User quits.
        if c == QUIT_KEY:

            # Notify the user that another QUIT_MENU_KEY will quit the program.
            sound.Play(PRESS_AGAIN_TO_QUIT_WAV)

            # Get the user's next keystroke.
            c = readchar.readchar()

            # If the user pressed QUIT_MENU_KEY, quit the program.
            if c == QUIT_KEY:
                sound.Play(EXITING_PROGRAM_WAV)
                # A delay is needed so the sound gets played before quitting.
                time.sleep(EXITING_PROGRAM_WAV_DURATION)
                sound.cleanup()
                # Quit the program
                return
        # The user presses a key that will have no effect.
        else:
            # Get the user's next keystroke.
            c = readchar.readchar()
def run_menu():

    # Initialize time variables and current system state
    day = 0
    hour = 12
    minute = 0
    is_AM = True
    state = 4

    # Print the minimal help string and play the introductory file
    print(MINIMAL_HELP_STRING)
    sound.Play(INTRO_WAV)
    # Get the first keystroke.
    c = readchar.readchar()

    # Endless loop responding to the user's last keystroke.
    # The loop breaks when the user hits the QUIT_KEY.
    while True:

        # User presses the forward key
        if c == FORWARD_KEY:
            # User in set weekday state, increment the day
            if (state == 0):
                day += 1
                # Ensure day does not exceed the maximum
                if (day > 6):
                    day = 0
                # Plays the currently selected weekday
                play_current_weekday(day)
            # User in set hour state, increment the hour
            elif (state == 1):
                hour += 1
                # Ensure hour does not exceed the maximum
                if (hour > 12):
                    hour = 1
                play_current_hour(hour)
            # User in set minute state, increment the minute
            elif (state == 2):
                minute += 1
                # Ensure day does not exceed the maximum
                if (minute > 59):
                    minute = 0
                play_current_minute(minute)
            # User in set AM PM state, switch the boolean
            elif (state == 3):
                is_AM = not is_AM
                # Play 'AM' or 'PM' depending which is currently selected
                play_AM_PM(is_AM)
            # User in timer mode, play the full current time
            elif (state == 4):
                play_complete_time(day, hour, minute, is_AM)

        # User presses the backwards key
        if c == BACKWARD_KEY:
            # User in set weekday state, decrement the day
            if (state == 0):
                day -= 1
                # Ensure day does not go below 0
                if (day < 0):
                    day = 6
                play_current_weekday(day)
            # User in set hour state, decrement the hour
            elif (state == 1):
                hour -= 1
                # Ensure hour does not go below 0
                if (hour < 1):
                    hour = 12
                play_current_hour(hour)
            # User in set minute state, decrement the minute
            elif (state == 2):
                minute -= 1
                # Ensure minute does not go below 0
                if (minute < 0):
                    minute = 59
                play_current_minute(minute)
            # User in set AM PM state, switch the boolean
            elif (state == 3):
                is_AM = not is_AM
                # Play 'AM' or 'PM' depending which is currently selected
                play_AM_PM(is_AM)
            # User in timer mode, play the full current time
            elif (state == 4):
                play_complete_time(day, hour, minute, is_AM)

        # User presses the help key
        if c == HELP_KEY:
            play_help(state)

        # User presses the select key, go to next state
        if c == SELECT_KEY:
            state += 1
            # If user in timer mode, play the current full time
            if (state == 4):
                play_complete_time(day, hour, minute, is_AM)
            # Reset state back to 0 if after last state
            if (state > 4):
                state = 0
            # Announce the current state to the user
            play_current_state(state)

        # User quits.
        if c == QUIT_KEY:

            # Notify the user that another QUIT_KEY will quit the program.
            sound.Play(PRESS_AGAIN_TO_QUIT_WAV)

            # Get the user's next keystroke.
            c = readchar.readchar()

            # If the user pressed QUIT_KEY, quit the program.
            if c == QUIT_KEY:
                sound.Play(EXITING_PROGRAM_WAV)
                # A delay is needed so the sound gets played before quitting.
                time.sleep(EXITING_PROGRAM_WAV_DURATION)
                sound.cleanup()
                # Quit the program.
                break

        # The user presses a key that will have no effect.
        else:
            # Get the user's next keystroke.
            c = readchar.readchar()
Example #11
0
def run_menu():

    global TIME_VAL

    CURRENT_VAL = 0    # Current value of time frame being set
    CURRENT_STAGE = 0   # Current time frame being set: 1=Day, 2=Hour, 3=Minute


    # Provide a minimal indication that the program has started.
    print(MINIMAL_HELP_STRING)

    # Get the first keystroke.
    c = readchar.readchar()

    # Endless loop responding to the user's last keystroke.
    # The loop breaks when the user hits the QUIT_MENU_KEY.
    while True:

        # Respond to the user's input.
        if c == ADD_KEY:

            # Loop over the right list
            WAV_LOOP = WEEKDAYS_WAV if CURRENT_STAGE == 0 else NUMBERS_WAV

            # Limit possible numbers for hour stage
            MAX = 24 if CURRENT_STAGE == 1 else len(WAV_LOOP)

            # Advance the time, looping back around to the start.
            CURRENT_VAL += 1
            if CURRENT_VAL == MAX:
                CURRENT_VAL = 0

            # Play the concatenated file.
            sound.Play(WAV_LOOP[CURRENT_VAL])

        if c == SUB_KEY:

            # Loop over the right list
            WAV_LOOP = WEEKDAYS_WAV if CURRENT_STAGE == 0 else NUMBERS_WAV

            # Limit possible numbers for hour stage
            MAX = 23 if CURRENT_STAGE == 1 else len(WAV_LOOP) - 1

            # Reduce the time, looping forward around to the end.
            CURRENT_VAL -= 1
            if CURRENT_VAL < 0:
                CURRENT_VAL = MAX

            # Play the concatenated file.
            sound.Play(WAV_LOOP[CURRENT_VAL])

        if c == CONTINUE_KEY:

            # Set the time frame and move on to the next one.
            if CURRENT_STAGE < len(TIME_VAL):
                TIME_VAL[CURRENT_STAGE] = CURRENT_VAL
                CURRENT_STAGE += 1
                CURRENT_VAL = 0 if CURRENT_STAGE == len(TIME_VAL) \
                                else TIME_VAL[CURRENT_STAGE]
                # DEVNOTE: How the hell is one supposed to format a multiline 
                # ternary operator? It's definitely not this.
                introduce_stage(CURRENT_STAGE)

            if CURRENT_STAGE >= len(TIME_VAL):
                # Program is concluded - build result feedback
                RESULT = [ YOU_SELECTED_WAV, WEEKDAYS_WAV[TIME_VAL[0]] ]
                
                if TIME_VAL[1] == 0:
                    RESULT.append(OH_WAV)
                else: 
                    RESULT.append(NUMBERS_WAV[TIME_VAL[1]])

                if TIME_VAL[2] == 0:
                    RESULT.append(O_CLOCK_WAV)
                elif 1 <= TIME_VAL[2] and TIME_VAL[2] <= 9:
                    RESULT.append(OH_WAV)
                    RESULT.append(NUMBERS_WAV[TIME_VAL[2]]) 
                else:
                    RESULT.append(NUMBERS_WAV[TIME_VAL[2]]) 
                
                RESULT.append(EXITING_PROGRAM_WAV)

                sound.combine_wav_files(TMP_FILE_WAV, *RESULT)

                sound.Play(TMP_FILE_WAV)
                time.sleep(5)
                # Quit the program
                break

        if c == UNDO_KEY:

            # Revert the time frame
            if CURRENT_STAGE > 0:
                CURRENT_STAGE -= 1
                CURRENT_VAL = TIME_VAL[CURRENT_STAGE]
                introduce_stage(CURRENT_STAGE)

        # User quits.
        if c == QUIT_KEY:

            # Notify the user that another QUIT_MENU_KEY will quit the program.
            sound.Play(PRESS_AGAIN_TO_QUIT_WAV)

            # Get the user's next keystroke.
            c = readchar.readchar()

            # If the user pressed QUIT_MENU_KEY, quit the program.
            if c == QUIT_KEY:
                sound.Play(EXITING_PROGRAM_WAV)
                # A delay is needed so the sound gets played before quitting.
                time.sleep(EXITING_PROGRAM_WAV_DURATION)
                sound.cleanup()
                # Quit the program
                break

        # The user presses a key that will have no effect.
        else:
            # Get the user's next keystroke.
            c = readchar.readchar()
Example #12
0
def run_menu():

    global CURRENT_TIME,LIMIT,days, sound_str,PHASE

    # Provide a minimal indication that the program has started.
    print("Starting program...\n")
    print(MINIMAL_HELP_STRING)

    # Get the first keystroke.
    c = readchar.readchar()

    # Special wav files for instructions
    instr_j = "my_sounds/j_to_quit.wav"
    instr_k = "my_sounds/k_for_up.wav"
    instr_l = "my_sounds/l_for_down.wav"
    semi_help = "my_sounds/semi_for_help.wav"
    space_to = "my_sounds/space_to.wav"
    restart = "my_sounds/restart.wav"
    space_conf = "my_sounds/space_to_confirm.wav"

    LIMIT = 7
    days = ['sunday','monday','tuesday','wednesday','thursday','friday','saturday']
    sound_str = "sound_string.wav"
    index = ""

    # Endless loop responding to the user's last keystroke.
    # The loop breaks when the user hits the QUIT_MENU_KEY.
    while True:

        ##### Respond to the user's input.
        ##### User goes forwards scrolling
        if c == FORWARD_KEY:

            # Advance the time, looping back around to the start.
            CURRENT_TIME += 1
            if CURRENT_TIME == LIMIT:
                CURRENT_TIME = 0

            # Check if in Set Day phase
            if PHASE == 0:
                sound.Play(day_path + days[CURRENT_TIME] + "_f.wav")

            # Check phase to see if Hour Phase
            if PHASE == 1:
                get_hour(CURRENT_TIME)

            #Check if user is in Minute Phase
            if PHASE == 2:
                get_minutes(CURRENT_TIME)


        ##### User Goes backwards scrolling
        if c == BACKWARD_KEY:
            # Decrease the time, looping back around to the start.
            CURRENT_TIME -= 1
            if CURRENT_TIME < 0:
                CURRENT_TIME = LIMIT-1

            # Check if in Set Day phase
            if PHASE == 0:
                sound.Play(day_path + days[CURRENT_TIME] + "_f.wav")

            # Check phase to see if Hour phase
            if PHASE == 1:
                get_hour(CURRENT_TIME)

            # Check if User is in Minute Phase
            if PHASE == 2:
                get_minutes(CURRENT_TIME)

        ##### When user confirms selection
        if c == CONFIRM:
            # Check if user is at the end of the program
            if next_state() == 1:
                time.sleep(4)
                # GIve user choice to restart or quit program
                sound.combine_wav_files(sound_str,instr_j,space_to,restart)
                sound.Play(sound_str)

                # Get user's next key input
                c = readchar.readchar()
                # If the user decides to quit, the program will end
                if (c == QUIT_KEY):
                    sound.Play(EXITING_PROGRAM_WAV)
                    time.sleep(EXITING_PROGRAM_WAV_DURATION)
                    break
                # If the user decides to restart, the program will restart all its values
                # and start the user at setting the day of the week
                elif c == CONFIRM:
                    sound.Play(nav_path + "Set_day_of_week_f.wav")
                    CURRENT_TIME = 0
                    LIMIT = 7
                    PHASE = 0


        #### If the User presses for help
        if c == HELP:
            # Notify the user to press the button again
            sound.Play(nav_path + "Press_again_for_help_f.wav")
            # Get user's next keystroke
            c = readchar.readchar()

            # Give the user instructions of the key functions and current phase
            # of the program the user is in
            if c == HELP:
                if PHASE == 0:
                    help_day = nav_path + "Set_day_of_week_f.wav"
                    sound.combine_wav_files(sound_str,space_conf,instr_j,instr_k,instr_l,semi_help,help_day)
                    sound.Play(sound_str)
                elif PHASE == 1:
                    help_hour = nav_path + "Set_hour_f.wav"
                    sound.combine_wav_files(sound_str,space_conf,instr_j,instr_k,instr_l,semi_help,help_hour)
                    sound.Play(sound_str)
                elif PHASE == 2:
                    help_day = nav_path + "Set_minutes_f.wav"
                    sound.combine_wav_files(sound_str,space_conf,instr_j,instr_k,instr_l,semi_help,help_day)
                    sound.Play(sound_str)

        #### User quits.
        if c == QUIT_KEY:

            # Notify the user that another QUIT_MENU_KEY will quit the program.
            sound.Play(PRESS_AGAIN_TO_QUIT_WAV)

            # Get the user's next keystroke.
            c = readchar.readchar()

            # If the user pressed QUIT_MENU_KEY, quit the program.
            if c == QUIT_KEY:
                sound.Play(EXITING_PROGRAM_WAV)
                # A delay is needed so the sound gets played before quitting.
                time.sleep(EXITING_PROGRAM_WAV_DURATION)
                sound.cleanup()
                # Quit the program
                break


        ##### The user presses a key that will have no effect.
        else:
            # Get the user's next keystroke.
            c = readchar.readchar()