Nantes Université

Skip to content
Extraits de code Groupes Projets
Valider 6f3745c2 rédigé par Julien Cohen's avatar Julien Cohen
Parcourir les fichiers

Refactoring.

parent 36be94ec
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -15,8 +15,8 @@ let wait t s = match s with ...@@ -15,8 +15,8 @@ let wait t s = match s with
let rec compile_melodie i s vol = match s with let rec compile_melodie i s vol = match s with
| [] -> [] | [] -> []
| (d, Note h) :: r -> (0, NoteOn(h,i,vol)) :: (duree d, NoteOff(h,i,vol)) :: compile_melodie i r vol | (Note h,d) :: r -> (0, NoteOn(h,i,vol)) :: (duree d, NoteOff(h,i,vol)) :: compile_melodie i r vol
| (d, Silence) :: r -> wait (duree d) (compile_melodie i r vol) ;; | (Silence,d) :: r -> wait (duree d) (compile_melodie i r vol) ;;
(** L'entier indique le tempo en BPM. *) (** L'entier indique le tempo en BPM. *)
let rec compile : int -> Solfege.partition -> SimpleMIDI.sequence = let rec compile : int -> Solfege.partition -> SimpleMIDI.sequence =
......
...@@ -5,10 +5,24 @@ open SimpleMIDI ...@@ -5,10 +5,24 @@ open SimpleMIDI
open Compilation open Compilation
let ma_partition1 = (Flute, (Noire, Note 60) :: (Noire, Note 64) :: (Noire, Note 67) :: []) ;; let ma_partition1 =
(Flute,
(Note 60, Noire)
:: (Note 64, Noire)
:: (Note 67, Noire)
:: []) ;;
let ma_partition2 = (Guitare, (Croche, Note 60) :: (Croche, Note 60) :: (Croche, Note 64) :: (Croche, Note 64) ::(Croche, Note 67)::(Croche, Note 67) :: []) ;; let ma_partition2 =
(Guitare,
(Note 60, Croche)
:: (Note 60, Croche)
:: (Note 64, Croche)
:: (Note 64, Croche)
:: (Note 67, Croche)
:: (Note 67, Croche)
:: []) ;;
let _ = write_sequence (compile 80 ma_partition1) "test_solo.mid";; let _ = write_sequence (compile 80 ma_partition1) "test_solo.mid";;
let _ = write_sequence (compile_avec_accompagnement 80 ma_partition1 ma_partition2) "test_acc.mid";; let _ = write_sequence (compile_avec_accompagnement 80 ma_partition1 ma_partition2) "test_acc.mid";;
...@@ -7,12 +7,10 @@ type valeur = Noire | Croche ...@@ -7,12 +7,10 @@ type valeur = Noire | Croche
type signe = Note of hauteur | Silence type signe = Note of hauteur | Silence
type melodie = (valeur * signe) list type melodie = (signe * valeur) list
type instrument = Piano | Violon | Guitare | GuitareSat | Basse | Flute | Harmonica type instrument = Piano | Violon | Guitare | GuitareSat | Basse | Flute | Harmonica
type partition = instrument * melodie type partition = instrument * melodie
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter