Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
basicsynth
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jean-Marie FAVREAU
basicsynth
Commits
c2f48ab7
Commit
c2f48ab7
authored
7 years ago
by
Jean-Marie FAVREAU
Browse files
Options
Downloads
Patches
Plain Diff
Ajout des longueurs des durées
parent
920abf23
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
musique/exercice.py
+21
-15
21 additions, 15 deletions
musique/exercice.py
with
21 additions
and
15 deletions
musique/exercice.py
+
21
−
15
View file @
c2f48ab7
...
...
@@ -122,13 +122,16 @@ class GenerateurExercice(GammeTemperee):
ds
=
self
.
durees
(
partitions
)
result
+=
"
\\
begin{table}[H]
\n
\centering
\n
"
result
+=
"
\\
begin{tabular}{|c|c|}
\n
"
result
+=
"
\\
begin{tabular}{|c|c|
c|c|
}
\n
"
result
+=
"
\\
hline
\n
"
result
+=
"
\\
textbf{Tête de note}
&
\\
textbf{Durée} (s)
\\\\
\n
"
result
+=
"
Graphique &
\\
textbf{Longueur} (cm) &
\\
textbf{Durée} (s) &
\\
textbf{Tête de note}
\\\\
\n
"
result
+=
"
\\
hline
\n
"
for
duree
in
ds
:
result
+=
self
.
nomDuree
(
duree
)
+
"
&
"
+
'
{0:.2f}
'
.
format
(
duree
)
+
"
\\\\\n
"
result
+=
"
\\
begin{tikzpicture}[]
"
result
+=
self
.
noteGraphique
(
0
,
0
,
duree
,
0
)
result
+=
"
\\
end{tikzpicture}
"
result
+=
"
&
"
+
'
{0:.2f}
'
.
format
(
self
.
dureeEnCm
(
duree
))
+
"
&
"
+
'
{0:.2f}
'
.
format
(
duree
)
+
"
&
"
+
self
.
nomDuree
(
duree
)
+
"
\\\\\n
"
result
+=
"
\\
hline
\n
"
result
+=
"
\\
end{tabular}
\n
"
...
...
@@ -148,7 +151,7 @@ class GenerateurExercice(GammeTemperee):
result
+=
"
\\
begin{tabular}{|c||c|c||c|c|}
\n
"
result
+=
"
\\
hline
\n
"
result
+=
"
& \multicolumn{2}{c||}{Transcription} & \multicolumn{2}{c|}{Codage}
\\\\
\n
"
result
+=
"
\\
textbf{Note} &
\\
textbf{Fréquence} (Hz) &
\\
textbf{
Durée
} (
s
) &
\\
textbf{Note} &
\\
textbf{Durée}
\\\\
\n
"
result
+=
"
\\
textbf{Note} &
\\
textbf{Fréquence} (Hz) &
\\
textbf{
Longueur
} (
cm
) &
\\
textbf{Note} &
\\
textbf{Durée}
\\\\
\n
"
result
+=
"
\\
hline
\n
"
for
i
,
note
in
enumerate
(
partition
):
result
+=
str
(
i
+
1
)
+
"
&
"
...
...
@@ -181,15 +184,15 @@ class GenerateurExercice(GammeTemperee):
notes
=
self
.
getOctaveEtIDNoteDansIntervalle
(
self
.
minFrequence
(
partitions
),
self
.
maxFrequence
(
partitions
))
result
+=
"
Fréquences de chacune des notes utilisées sur la partition:
"
result
+=
"
Fréquences de chacune des notes utilisées sur la partition
(arrondies à l
'
entier le plus proche)
:
"
result
+=
"
\\
begin{table}[H]
\n
\centering
\n
"
result
+=
"
\\
begin{tabular}{|c|c|}
\n
"
result
+=
"
\\
hline
\n
"
result
+=
"
\\
textbf{
Note} &
\\
textbf{Fréquence} (Hz)
\\\\
\n
"
result
+=
"
\\
textbf{
Fréquence} (Hz) &
\\
textbf{Note}
\\\\
\n
"
result
+=
"
\\
hline
\n
"
for
note
in
notes
:
result
+=
self
.
toLaTeX
(
note
[
0
],
note
[
1
])
+
"
&
"
+
str
(
int
(
round
(
self
.
note
(
note
[
0
],
note
[
1
]))))
+
"
\\\\\n
"
result
+=
str
(
int
(
round
(
self
.
note
(
note
[
0
],
note
[
1
]))))
+
"
&
"
+
self
.
toLaTeX
(
note
[
0
],
note
[
1
])
+
"
\\\\\n
"
result
+=
"
\\
hline
\n
"
result
+=
"
\\
end{tabular}
\n
"
...
...
@@ -227,16 +230,19 @@ class GenerateurExercice(GammeTemperee):
def
frequenceEnCm
(
self
,
frequence
):
return
(
self
.
margeFrequence
+
frequence
-
self
.
fmin
)
*
self
.
echelleY
def
horodatag
eEnCm
(
self
,
horodatag
e
):
return
(
self
.
margeDuree
+
horodatage
)
*
self
.
echelleX
def
dure
eEnCm
(
self
,
dure
e
):
return
duree
*
self
.
echelleX
# dessine sur le spectrogramme l'accord donné en paramètre,
# à l'horodatage donné
def
noteSpectrogrammePartition
(
self
,
frequence
,
duree
,
horodatage
,
couleur
):
def
noteSpectrogrammePartition
(
self
,
frequence
,
duree
,
horodatage
,
couleur
=
"
black
"
):
y
=
self
.
frequenceEnCm
(
frequence
)
xmin
=
self
.
horodatageEnCm
(
horodatage
)
xmilieu
=
self
.
horodatageEnCm
(
horodatage
+
self
.
dureeFrappe
)
xmax
=
self
.
horodatageEnCm
(
horodatage
+
duree
)
return
self
.
noteGraphique
(
y
,
self
.
margeDuree
,
duree
,
horodatage
,
couleur
)
def
noteGraphique
(
self
,
y
,
decalageDuree
,
duree
,
horodatage
,
couleur
=
"
black
"
):
xmin
=
self
.
dureeEnCm
(
horodatage
+
decalageDuree
)
xmilieu
=
self
.
dureeEnCm
(
horodatage
+
self
.
dureeFrappe
+
decalageDuree
)
xmax
=
self
.
dureeEnCm
(
horodatage
+
duree
+
decalageDuree
)
result
=
"
\draw[
"
+
couleur
+
"
, very thick] (
"
+
str
(
xmin
)
+
"
,
"
+
str
(
y
)
+
"
) -- (
"
+
str
(
xmilieu
)
+
"
,
"
+
str
(
y
)
+
"
);
\n
"
result
+=
"
\draw[
"
+
couleur
+
"
, very thin] (
"
+
str
(
xmilieu
)
+
"
,
"
+
str
(
y
)
+
"
) -- (
"
+
str
(
xmax
)
+
"
,
"
+
str
(
y
)
+
"
);
\n
"
return
result
...
...
@@ -273,7 +279,7 @@ class GenerateurExercice(GammeTemperee):
result
=
""
for
i
in
range
(
0
,
nbGraduations
+
1
):
h
=
i
*
pas
hinc
=
self
.
horodatageEnCm
(
h
)
hinc
=
self
.
dureeEnCm
(
h
+
self
.
margeDuree
)
result
+=
"
\draw[black] (
"
+
str
(
hinc
)
+
"
, -0.1) --
"
;
result
+=
"
(
"
+
str
(
hinc
)
+
"
, 0.)
\n
"
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment