# Program to load sequence of sounds (pitch, amplitude and duration) and play it

def playSequence(songFileName):

  # load and process the sound sequence file

  songFile = open(getMediaPath(songFileName), 'r')

  for line in songFile.readlines():  # Loop over all lines in this file

    line = line.strip()  # Remove surounding spaces and new-lines
    
    lineList = line.split(',')  # Split at each comma in the line
    
    note = int(lineList[0])  # Extract the note MIDI number (0...127)

    # convert string -> float -> int
    noteDuration = int(float(lineList[2])) 

    noteIntensity = int(lineList[1])  # Second column in song file

    #print 'Playing:', note, noteDuration, noteIntensity
    playNote(note, noteDuration, noteIntensity)

  songFile.close()  # End reading the song file


