def get_notelist_for_xml(filename, absolute=False):

    abstimenotelist = []

    def handleNoteDetection(time, pitch, duration):
        #code here to handle the detection of a note
        #in XML, we actually need to cache them in
        #a list
        abstimenotelist.append((time, pitch, duration))

    #we can get the number of slices for pickup here,
    #but not sure what to do with it, one possibility
    #is to slice off initial notes in the pickup
    pickup_slices = readxml.parseXMLFileToSomething(filename,
                                                    handleNoteDetection)

    abstimenotelist.sort(key=lambda x: x[0])

    currtime = 0
    currpitch = 0
    retlist = []

    for time, pitch, duration in abstimenotelist:
        if absolute:
            retlist.append(AbsoluteNote(None, pitch, time - currtime,
                                        duration))
        else:
            retlist.append(
                RelativeNote(None, pitch - currpitch, time - currtime,
                             duration))
        currtime = time
        currpitch = pitch

    return retlist
Exemplo n.º 2
0
def get_notelist_for_xml(filename, absolute=False):

    abstimenotelist = []

    def handleNoteDetection(time, pitch, duration):
        #code here to handle the detection of a note
        #in XML, we actually need to cache them in
        #a list
        abstimenotelist.append((time, pitch, duration))


    #we can get the number of slices for pickup here,
    #but not sure what to do with it, one possibility
    #is to slice off initial notes in the pickup
    pickup_slices = readxml.parseXMLFileToSomething(filename,
                                                   handleNoteDetection)

    abstimenotelist.sort(key=lambda x: x[0])

    currtime = 0
    currpitch = 0
    retlist = []

    for time, pitch, duration in abstimenotelist:
        if absolute:
            retlist.append(AbsoluteNote(None, pitch, time - currtime, duration))
        else:
            retlist.append(RelativeNote(None, pitch - currpitch,
                                        time - currtime, duration))
        currtime = time
        currpitch = pitch

    return retlist
Exemplo n.º 3
0
import readxml, sys, os

if __name__ == '__main__':

    if len(sys.argv) != 2:
        print "Requires exactly one arg, input XML file"
        exit(1)

    inputFile = sys.argv[1]

    if not os.path.isfile(inputFile):
        print "file {} does not exist.".format(outfile)
        exit(1)

    def handleNoteDetection(time, pitch, duration):
        print time, pitch, duration

    readxml.parseXMLFileToSomething(inputFile, handleNoteDetection)
Exemplo n.º 4
0
import readxml, sys, os


if __name__ == '__main__':

  if len(sys.argv) != 2:
    print "Requires exactly one arg, input XML file"
    exit(1)

  inputFile = sys.argv[1]

  if not os.path.isfile(inputFile):
    print "file {} does not exist.".format(outfile)
    exit(1)

  def handleNoteDetection(time, pitch, duration):
    print time, pitch, duration

  readxml.parseXMLFileToSomething(inputFile, handleNoteDetection)