X-Git-Url: https://scm.cri.ensmp.fr/git/minwii.git/blobdiff_plain/ebf72d7fe428b8af78d5b5906c4c01e4ef59447c..29dfa14e4419fb6ceb9350223f410e967e8cc4f6:/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__' :