From 0724aa3a27b8cb60b4e9ced7288df61ebe32e8ef Mon Sep 17 00:00:00 2001 From: Jean-Marie Favreau <J-Marie.Favreau@uca.fr> Date: Thu, 7 Feb 2019 16:02:13 +0100 Subject: [PATCH] =?UTF-8?q?Am=C3=A9lioration,=20rendu=20sur=20plusieurs=20?= =?UTF-8?q?lignes=20de=20la=20partition?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- brahms.py | 1 + joie.py | 1 + musique/exercice.py | 20 +++++++++++++++++++- tabac2.py | 1 + 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/brahms.py b/brahms.py index 6a0de06..c045d3a 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 6119346..43686fd 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 4fe2bb5..a9b75f5 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 011d874..4127b1f 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: -- GitLab