diff --git a/brahms.py b/brahms.py index 6a0de0658e298f1d0fcf0918d37ff21988390c57..c045d3a5af3b49d1dcfabbbf7008334e4af758c7 100644 --- a/brahms.py +++ b/brahms.py @@ -60,6 +60,7 @@ if args.exerciceSpectrogramme or args.transparent: g = GenerateurExercice(gamme.bpm) g.setBoomwhackers(boomwhackers) g.setLongueurPartitionColoree(6) + g.setLongueurPartitionMusicale(12) if args.exerciceSpectrogramme: g.genererExerciceSpectrogramme(brahms, "exercices/ex-spec-brahms.tex", "thème 4", "Lullaby, berceuse de Brahms") if args.transparent: diff --git a/joie.py b/joie.py index 61193465f62d0843c58ce8de04694be6dff402c0..43686fd78c2c2abb8ae55883fd61153c646df8a5 100644 --- a/joie.py +++ b/joie.py @@ -72,6 +72,7 @@ if args.exerciceSpectrogramme or args.transparent: g = GenerateurExercice(gamme.bpm) g.setBoomwhackers(boomwhackers) g.setLongueurPartitionColoree(8) + g.setLongueurPartitionMusicale(16) if args.exerciceSpectrogramme: g.genererExerciceSpectrogramme(joie, "exercices/ex-spec-joie.tex", "thème 1", "Hymne à la joie") if args.transparent: diff --git a/musique/exercice.py b/musique/exercice.py index 4fe2bb52e648e9f8a569477ed8a225525f9cfc63..a9b75f5d163cce1d9a19b03beb80a404c5dcc24a 100644 --- a/musique/exercice.py +++ b/musique/exercice.py @@ -24,12 +24,17 @@ class GenerateurExercice(GammeTemperee): self.margeLegende = 2.0 self.boomwhackers = [] self.longueurPartitionColoree = 4 + self.longueurPartitionMusicale = 16 # donne la largeur d'une ligne de partition colorée, exprimée # en nombre de noires def setLongueurPartitionColoree(self, longueur): self.longueurPartitionColoree = longueur + # donne la largeur d'une ligne de partition musicale, exprimée + # en nombre de noires + def setLongueurPartitionMusicale(self, longueur): + self.longueurPartitionMusicale = longueur def setBoomwhackers(self, mw): import json @@ -467,6 +472,10 @@ class GenerateurExercice(GammeTemperee): maxNote = max([ n for n in notes if n[1] > 0]) (maxoctave, maxidnote) = maxNote midOctave = int((maxoctave + minoctave) / 2) + + dureePartition = self.longueurPartitionMusicale * self.noire + longueurCourante = 0 + if beamer: result += "\\normalmusicsize" else: @@ -482,10 +491,19 @@ class GenerateurExercice(GammeTemperee): result += self.dureeToMusicTex(note[1]) + "{" result += self.frequenceToMusicTeX(note[0], midOctave) result += "}" + longueurCourante += note[1] else: # TODO pass - result +="\enotes" + if longueurCourante >= dureePartition and i < len(partition) - 1: + longueurCourante = 0 + result +="\\enotes" + result += "\\zendextract" + result += "\\end{music}" + result += "\\begin{music}" + result += "\\startextract" + result += "\\notes " + result +="\\enotes" result += "\\zendextract" result += "\\end{music}" result += "\\caption{Partition simplifiée}" diff --git a/tabac2.py b/tabac2.py index 011d8742319cac1eadc80b1c308fb60111875ede..4127b1f43c3f0c687eeeecdf37f22955e10d4274 100644 --- a/tabac2.py +++ b/tabac2.py @@ -57,6 +57,7 @@ if args.exerciceSpectrogramme or args.transparent: g = GenerateurExercice(gamme.bpm) g.setBoomwhackers(boomwhackers) g.setLongueurPartitionColoree(6) + g.setLongueurPartitionMusicale(8) if args.exerciceSpectrogramme: g.genererExerciceSpectrogramme(tabac, "exercices/ex-spec-tabac2.tex", "thème 3", "j'ai du bon tabac") if args.transparent: