songFile = self.getSongFile()
song = musicXml2Song(songFile)
- duration = 0
- for note, verseIndex in song.iterNotes() :
- duration = duration + note.duration
- duration = duration * song.quarterNoteDuration # en milisecondes
+ duration = song.duration
return self._toTimeDelta(duration)
@statsresults
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) :
printNotes=options.printNotes)
from pprint import pprint
pprint(song.intervalsHistogram)
+ print song.duration
if __name__ == '__main__' :