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
865e257d
Commit
865e257d
authored
7 years ago
by
Jean-Marie FAVREAU
Browse files
Options
Downloads
Patches
Plain Diff
Amélioration du raffinement de la précision, pour essayer de supprimer le bruit contenu
dans le fichier. Mais ça n'est pas concluant.
parent
551ae05a
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/basicsynth.py
+9
-8
9 additions, 8 deletions
musique/basicsynth.py
with
9 additions
and
8 deletions
musique/basicsynth.py
+
9
−
8
View file @
865e257d
...
...
@@ -471,10 +471,9 @@ class Partition:
# enveloppe pour moduler son amplitude au fil du temps.
class
BasicSequenceur
(
GammeTemperee
):
nbOctet
=
2
# taille d'un echantillon : 1 octet = 8 bits
nbOctet
=
4
# taille d'un echantillon : 1 octet = 8 bits
. Possible values: 1, 2 or 4
fech
=
44100
# frequence d'echantillonnage: nombre d'echantillon par seconde
maxVol
=
2
**
15
-
1.0
# constructeur par defaut de la classe.
# Paramètres:
...
...
@@ -540,11 +539,11 @@ class BasicSequenceur(GammeTemperee):
return
BasicNote
(
self
.
generateurDeNote
,
self
.
enveloppe
,
self
.
fech
,
frequence
,
duree
,
self
.
nbHarmoniques
,
self
.
dureeAttaqueEnveloppe
)
# Retourne vrai si la valeur donnee est comprise dans l'intervalle des valeurs representant un son.
def
dansIntervalle
(
self
,
value
):
if
value
<
-
self
.
maxVol
:
return
-
self
.
maxVol
elif
value
>
self
.
maxVol
:
return
self
.
maxVol
def
dansIntervalle
(
self
,
value
,
maxVol
):
if
value
<
-
maxVol
:
return
-
maxVol
elif
value
>
maxVol
:
return
maxVol
else
:
return
value
...
...
@@ -662,7 +661,9 @@ class BasicSequenceur(GammeTemperee):
niveau
=
self
.
niveaux
[
i
]
value
=
values
[
i
]
# et on l'écrit dans le fichier
fichierSon
.
writeframes
(
wave
.
struct
.
pack
(
'
h
'
,
int
(
self
.
dansIntervalle
(
niveau
*
self
.
maxVol
*
value
/
self
.
maxVal
))))
packWrite
=
{
1
:
'
b
'
,
2
:
'
h
'
,
4
:
'
i
'
}
maxVol
=
2
**
(
8
*
self
.
nbOctet
-
1
)
-
1.0
fichierSon
.
writeframes
(
wave
.
struct
.
pack
(
packWrite
[
self
.
nbOctet
],
int
(
self
.
dansIntervalle
(
niveau
*
maxVol
*
value
/
self
.
maxVal
,
maxVol
))))
print
(
'
Export dans le fichier
"'
+
nomFichier
+
'"'
)
# on ferme le fichier pour qu'il soit bien exporte
...
...
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