From e2d0b65df8ef964ea59fdcfac2458fce74d81d19 Mon Sep 17 00:00:00 2001 From: Jean-Marie Favreau <J-Marie.Favreau@uca.fr> Date: Thu, 4 Apr 2019 10:25:15 +0200 Subject: [PATCH] Ajout joyeux anniversaire --- Makefile | 2 +- boomwhackers-8+5.json | 16 ++++++++++++++++ boomwhackers-8.json | 8 +++++++- happybirthday.py | 4 ++-- musique/exercice.py | 7 +++++++ 5 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 boomwhackers-8+5.json diff --git a/Makefile b/Makefile index 5308430..2991122 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ PDF=$(EXECOLLPDF) $(EXEPROJPDF) $(EXEPRIMPDF) $(EXECORRPDF) WAVES=$(addprefix $(SONS)/,$(SCRIPTS:.py=.wav)) -BOOMWHACKERS=boomwhackers-8.json +BOOMWHACKERS=boomwhackers-8+5.json .PRECIOUS: $(TEX) diff --git a/boomwhackers-8+5.json b/boomwhackers-8+5.json new file mode 100644 index 0000000..3cf596e --- /dev/null +++ b/boomwhackers-8+5.json @@ -0,0 +1,16 @@ +{ + "do1": { "couleur": [255, 0, 0], "capsule": "0", "court": "1" }, + "re1": { "couleur": [255, 170, 20], "capsule": "0", "court": "1" }, + "mi1": { "couleur": [255, 238, 0], "capsule": "0", "court": "1" }, + "fa1": { "couleur": [81, 255, 0], "capsule": "0", "court": "1" }, + "sol1": { "couleur": [0, 118, 88], "capsule": "0", "court": "1" }, + "la1": { "couleur": [140, 0, 255], "capsule": "0", "court": "1" }, + "si1": { "couleur": [221, 0, 115], "capsule": "0", "court": "1" }, + "do2": { "couleur": [255, 0, 0], "capsule": "0", "court": "0" }, + + "dod1": { "couleur": [255, 0, 0], "capsule": "0", "court": "1", "alteration": "#" }, + "mib1": { "couleur": [255, 238, 0], "capsule": "0", "court": "1", "alteration" : "b"}, + "fad1": { "couleur": [81, 255, 0], "capsule": "0", "court": "1", "alteration": "#" }, + "sold1": { "couleur": [0, 118, 88], "capsule": "0", "court": "1", "alteration": "#" }, + "sib1": { "couleur": [221, 0, 115], "capsule": "0", "court": "1", "alteration" : "b" } +} diff --git a/boomwhackers-8.json b/boomwhackers-8.json index 7d1d8e6..4ccc82a 100644 --- a/boomwhackers-8.json +++ b/boomwhackers-8.json @@ -6,5 +6,11 @@ "sol1": { "couleur": [0, 118, 88], "capsule": "0", "court": "1" }, "la1": { "couleur": [140, 0, 255], "capsule": "0", "court": "1" }, "si1": { "couleur": [221, 0, 115], "capsule": "0", "court": "1" }, - "do2": { "couleur": [255, 0, 0], "capsule": "0", "court": "0" } + "do2": { "couleur": [255, 0, 0], "capsule": "0", "court": "0" }, + + "dod1": { "couleur": [255, 0, 0], "capsule": "0", "court": "1", "alteration": "#" }, + "mib1": { "couleur": [255, 238, 0], "capsule": "0", "court": "1", "alteration" : "♭"}, + "fad1": { "couleur": [81, 255, 0], "capsule": "0", "court": "1", "alteration": "#" }, + "sold1": { "couleur": [0, 118, 88], "capsule": "0", "court": "1", "alteration": "#" }, + "sib1": { "couleur": [221, 0, 115], "capsule": "0", "court": "1", "alteration" : "♭" }, } diff --git a/happybirthday.py b/happybirthday.py index 8984bb2..224c59b 100755 --- a/happybirthday.py +++ b/happybirthday.py @@ -51,11 +51,11 @@ happy = [ [ [gamme.do(4), gamme.crochepointee], ] ] -if args.exerciceSpectrogramme: +if args.exerciceSpectrogramme or args.transparent or args.correction: g = GenerateurExercice(gamme.bpm) g.setBoomwhackers(boomwhackers) g.setLongueurPartitionColoree(6) - g.setLongueurPartitionMusicale(8) + g.setLongueurPartitionMusicale(12) if args.primaire: g.setTableauSimplifie(True) if args.exerciceSpectrogramme: diff --git a/musique/exercice.py b/musique/exercice.py index 2671e0c..1f52c08 100644 --- a/musique/exercice.py +++ b/musique/exercice.py @@ -338,6 +338,11 @@ class GenerateurExercice(GammeTemperee): rayon = r * 1.2 if boomwhacker["court"] == "0" else r result += "\\fill[fill=tempcolor] ("+ \ str(x) + "," + str(y) + ") circle (" + str(rayon) + ");" + if "alteration" in boomwhacker: + if (boomwhacker["couleur"][0] + boomwhacker["couleur"][1] + boomwhacker["couleur"][2]) > 128 * 3: + result += "\\draw (" + str(x) + "," + str(y) + ") node{" + str(boomwhacker["alteration"]) + "};" + else: + result += "\\draw[color=white] (" + str(x) + "," + str(y) + ") node{" + str(boomwhacker["alteration"]) + "};" if boomwhacker["capsule"] == "1": result += "\\fill [black] (" + str(x - r) + "," + str(y - 1.2 * r) + \ ") rectangle (" + str(x + r) + ", " + str(y - 1.9 * r) + ");" @@ -351,6 +356,7 @@ class GenerateurExercice(GammeTemperee): notes = sorted(list(set(frequences))) result += "\\begin{table}[H]\n\centering\n" + result += '\\resizebox{1\\textwidth}{!}{%\n' if not beamer: result += "\\begin{tabular}{|r|" + "".join(["c|"] * len(notes)) + "}\n" else: @@ -385,6 +391,7 @@ class GenerateurExercice(GammeTemperee): if not beamer: result += "\\hline\n" result += "\\end{tabular}\n" + result += "}\n" result += "\\caption{Représentation colorée des notes}\n" result += "\\end{table}\n" return result -- GitLab