1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
| --on créé les listes de note en fonction des différentes gammes
--mineur
set do_mineur to {{1, 3, 4, 6, 8, 10, 11, 13, 15, 16, 18, 20, 22, 23}, {1, 3, 4, 6, 8, 9, 11, 13, 15, 16, 18, 20, 21, 23}, {0, 1, 3, 5, 7, 8, 10, 12, 13, 15, 17, 19, 20, 22, 24}, {0, 1, 3, 5, 6, 8, 10, 12, 13, 15, 17, 18, 20, 22, 24}, {1, 3, 5, 6, 8, 10, 11, 13, 15, 17, 18, 20, 22, 23}, {1, 3, 4, 6, 8, 10, 11, 13, 15, 16, 18, 20, 22, 23}}
set do_diese_mineur to {{0, 2, 4, 5, 7, 9, 11, 12, 14, 16, 17, 19, 21, 23, 24}, {0, 2, 4, 5, 7, 9, 10, 12, 14, 16, 17, 19, 21, 22, 24}, {1, 2, 4, 6, 8, 9, 11, 13, 14, 16, 18, 20, 21, 23}, {1, 2, 4, 6, 7, 9, 11, 13, 14, 16, 18, 19, 21, 23}, {0, 2, 4, 6, 7, 9, 11, 12, 14, 16, 18, 19, 21, 23, 24}, {0, 2, 4, 5, 7, 9, 11, 12, 14, 16, 17, 19, 21, 23, 24}}
set re_mineur to {{0, 1, 3, 5, 6, 8, 10, 12, 13, 15, 17, 18, 20, 22, 24}, {1, 3, 5, 6, 8, 10, 11, 13, 15, 17, 18, 20, 22, 23}, {0, 2, 3, 5, 7, 9, 10, 12, 14, 15, 17, 19, 21, 22, 24}, {0, 2, 3, 5, 7, 8, 10, 12, 14, 15, 17, 19, 20, 22, 24}, {0, 1, 3, 5, 7, 8, 10, 12, 13, 15, 17, 19, 20, 22, 24}, {0, 1, 3, 5, 6, 8, 10, 12, 13, 15, 17, 18, 20, 22, 24}}
set re_diese_mineur to {{1, 2, 4, 6, 7, 9, 11, 13, 14, 16, 18, 19, 21, 23}, {0, 2, 4, 6, 7, 9, 11, 12, 14, 16, 18, 19, 21, 23, 24}, {1, 3, 4, 6, 8, 10, 11, 13, 15, 16, 18, 20, 22, 23}, {1, 3, 4, 6, 8, 9, 11, 13, 15, 16, 18, 20, 21, 23}, {1, 2, 4, 6, 8, 9, 11, 13, 14, 16, 18, 20, 21, 23}, {1, 2, 4, 6, 7, 9, 11, 13, 14, 16, 18, 19, 21, 23}}
set mi_mineur to {{0, 2, 3, 5, 7, 8, 10, 12, 14, 15, 17, 19, 20, 22, 24}, {0, 1, 3, 5, 7, 8, 10, 12, 13, 15, 17, 19, 20, 22, 24}, {0, 2, 4, 5, 7, 9, 11, 12, 14, 16, 17, 19, 21, 23, 24}, {0, 2, 4, 5, 7, 9, 10, 12, 14, 16, 17, 19, 21, 22, 24}, {0, 2, 3, 5, 7, 9, 10, 12, 14, 15, 17, 19, 21, 22, 24}, {0, 2, 3, 5, 7, 8, 10, 12, 14, 15, 17, 19, 20, 22, 24}}
--etc etc
--pop-up choix de gamme
set optionsGamme to {"mineur", "majeur", "harmonique_mineure", "diminuee_inverse", "mineure-melodique"}
set gamme to (choose from list optionsGamme with prompt "Création de patterns automatisée:
Quel gamme?" with title "Création de patterns") as text
--pop-up choix de tonalité
set optionsTonalite to {"do", "do#", "re", "re#", "mi", "fa", "fa#", "sol", "sol#", "la", "la#", "si"}
set tonalite to (choose from list optionsTonalite with prompt "Création de patterns automatisée:
Quel gamme?" with title "Création de patterns") as text
if tonalite contains "#" then
set tonalite to findAndReplace("#", "_diese", tonalite)
end if
--création d'un nombre aléatoire
set i to random number
set iBis to (i * (6 - 1)) + 1
set i to round of iBis
--on créé la variable de gamme
set gamme_complete to tonalite & "_" & gamme
--on selectionne la corde
set chord_selected to item i of gamme_complete
---------------------------------------------------------------------------------------------------------------------------------
on findAndReplace(tofind, toreplace, TheString)
set ditd to text item delimiters
set text item delimiters to tofind
set textItems to text items of TheString
set text item delimiters to toreplace
if (class of TheString is string) then
set res to textItems as string
else -- if (class of TheString is Unicode text) then
set res to textItems as Unicode text
end if
set text item delimiters to ditd
return res
end findAndReplace |
Partager