X-Git-Url: https://scm.cri.mines-paristech.fr/git/minwii.git/blobdiff_plain/ebf72d7fe428b8af78d5b5906c4c01e4ef59447c..e20495c66925a06496b90ccbe566cebecc74efa6:/src/minwii/musicxml.py 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__' :