X-Git-Url: https://scm.cri.mines-paristech.fr/git/minwii.git/blobdiff_plain/ebf72d7fe428b8af78d5b5906c4c01e4ef59447c..fa5bf40bfe796d33480a09d9e6400502552d66f7:/src/minwii/musicxml.py?ds=sidebyside diff --git a/src/minwii/musicxml.py b/src/minwii/musicxml.py index 7468eca..54d859f 100755 --- a/src/minwii/musicxml.py +++ b/src/minwii/musicxml.py @@ -176,6 +176,17 @@ class Part(object) : histogram[interval] = 1 previousNote = note return histogram + + @property + def duration(self) : + 'Durée de référence du morceau en milisecondes' + it = self.iterNotes() + duration = 0 + for note, verseIndex in it : + duration = duration + note.duration + duration = duration * self.quarterNoteDuration # en milisecondes + return duration + def pprint(self) : for note, verseIndex in self.iterNotes(indefinitely=False) : @@ -423,6 +434,7 @@ def main() : printNotes=options.printNotes) from pprint import pprint pprint(song.intervalsHistogram) + print song.duration if __name__ == '__main__' :