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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jean-Marie FAVREAU
basicsynth
Commits
f8903326
Commit
f8903326
authored
6 years ago
by
Jean-Marie Favreau
Browse files
Options
Downloads
Patches
Plain Diff
Début de prise en charge des partitions graphiques
parent
b965fdaf
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
musique/exercice.py
+36
-1
36 additions, 1 deletion
musique/exercice.py
musique/gamme.py
+16
-0
16 additions, 0 deletions
musique/gamme.py
with
52 additions
and
1 deletion
musique/exercice.py
+
36
−
1
View file @
f8903326
...
@@ -233,6 +233,39 @@ class GenerateurExercice(GammeTemperee):
...
@@ -233,6 +233,39 @@ class GenerateurExercice(GammeTemperee):
result
+=
"
\\
end{table}
\n
"
result
+=
"
\\
end{table}
\n
"
return
result
return
result
def
estDessinable
(
self
,
partitions
):
if
len
(
partitions
)
!=
1
:
print
"
plus d
'
une partition
"
return
False
if
self
.
contientNoteAlteree
(
partitions
):
print
"
note alteree
"
return
False
notes
=
[
self
.
getOctaveEtIDNote
(
p
)
for
p
in
self
.
notesDansPartition
(
partitions
)
]
minNote
=
min
(
notes
)
maxNote
=
max
(
notes
)
print
notes
# si les notes sont dans une même gamme
# ou qu'elles sont sur deux gammes, avec le do dans la gamme suivante
return
minNote
[
0
]
==
maxNote
[
0
]
or
(
minNote
[
0
]
==
maxNote
[
0
]
+
1
and
maxNote
[
1
]
==
0
)
def
partitionGraphique
(
self
,
partitions
):
result
=
""
frequences
=
self
.
notesDansPartition
(
partitions
)
if
self
.
estDessinable
(
partitions
):
p
=
partitions
[
0
]
# TODO
result
+=
"
On peut la dessiner.
"
else
:
result
+=
"
Cette partition n
'
est pas représentable sous forme de partition pour boomwhackers diatoniques.
"
return
result
# cette fonction écrit la fin de l'exercice spectrogramme
# cette fonction écrit la fin de l'exercice spectrogramme
def
finExerciceSpectrogramme
(
self
,
partitions
):
def
finExerciceSpectrogramme
(
self
,
partitions
):
...
@@ -261,6 +294,9 @@ class GenerateurExercice(GammeTemperee):
...
@@ -261,6 +294,9 @@ class GenerateurExercice(GammeTemperee):
# on écrit le tableau solution de l'exercice
# on écrit le tableau solution de l'exercice
result
+=
self
.
tableauNotesBrutes
(
partitions
,
True
)
result
+=
self
.
tableauNotesBrutes
(
partitions
,
True
)
result
+=
"
\\
section{Partition graphique}
\n
"
# on écrit le tableau solution de l'exercice
result
+=
self
.
partitionGraphique
(
partitions
)
return
result
return
result
...
@@ -288,7 +324,6 @@ class GenerateurExercice(GammeTemperee):
...
@@ -288,7 +324,6 @@ class GenerateurExercice(GammeTemperee):
# à l'horodatage donné
# à l'horodatage donné
def
accordSpectrogrammePartition
(
self
,
accord
,
horodatage
,
couleur
):
def
accordSpectrogrammePartition
(
self
,
accord
,
horodatage
,
couleur
):
if
isinstance
(
accord
[
0
],
float
):
if
isinstance
(
accord
[
0
],
float
):
print
"
duree
"
,
accord
[
1
],
self
.
nomDuree
(
accord
[
1
])
return
self
.
noteSpectrogrammePartition
(
accord
[
0
],
accord
[
1
],
horodatage
,
couleur
)
return
self
.
noteSpectrogrammePartition
(
accord
[
0
],
accord
[
1
],
horodatage
,
couleur
)
else
:
else
:
return
''
.
join
([
self
.
noteSpectrogrammePartition
(
note
,
accord
[
1
],
horodatage
,
couleur
)
for
note
in
accord
[
0
]])
return
''
.
join
([
self
.
noteSpectrogrammePartition
(
note
,
accord
[
1
],
horodatage
,
couleur
)
for
note
in
accord
[
0
]])
...
...
This diff is collapsed.
Click to expand it.
musique/gamme.py
+
16
−
0
View file @
f8903326
...
@@ -125,6 +125,22 @@ class GammeTemperee:
...
@@ -125,6 +125,22 @@ class GammeTemperee:
l
=
[[
x
for
x
in
[
note
[
0
]
if
isinstance
(
note
[
0
],
float
)
else
note
[
0
]
for
note
in
partition
]
if
x
!=
0.
]
for
partition
in
partitions
]
l
=
[[
x
for
x
in
[
note
[
0
]
if
isinstance
(
note
[
0
],
float
)
else
note
[
0
]
for
note
in
partition
]
if
x
!=
0.
]
for
partition
in
partitions
]
return
list
(
set
([
j
for
i
in
l
for
j
in
i
]))
return
list
(
set
([
j
for
i
in
l
for
j
in
i
]))
def
isNoteAlteree
(
self
,
frequence
):
(
o
,
i
)
=
self
.
getOctaveEtIDNote
(
frequence
)
return
i
in
[
1
,
3
,
6
,
8
,
10
]
def
contientNoteAlteree
(
self
,
partitions
):
for
partition
in
partitions
:
for
note
in
partition
:
if
isinstance
(
note
[
0
],
float
):
if
self
.
isNoteAlteree
(
note
[
0
]):
return
True
else
:
for
n
in
note
:
if
self
.
isNoteAlteree
(
n
[
0
]):
return
True
return
False
# retourne la fréquence minimum utilisée dans les partitions
# retourne la fréquence minimum utilisée dans les partitions
def
minFrequence
(
self
,
partitions
):
def
minFrequence
(
self
,
partitions
):
...
...
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