X-Git-Url: https://svn.cri.ensmp.fr/git/minwii.git/blobdiff_plain/ebf72d7fe428b8af78d5b5906c4c01e4ef59447c..18944a0196254fc2c01f416e4f39b8511ee6eb19:/src/minwii/musicxml.py?ds=inline 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__' :