Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Jazz chords generator
- // par flyinghome83 et lincruste.
- // écrit entre le 31/12/2013 et le 01/01/2014
- public class Accord {
- public static void main (String[] args) {
- // Création d'un tableau de notes fondamentales
- String[] Note = {"A", "B", "C", "D", "E", "F", "G"};
- // Création d'un tableau d'altérations
- String[] Alteration = {"#", "b", ""};
- // Création d'un tableau de natures d'accords
- String[] Nature = {"m", "-7", "-9", "-11", "-Maj7", "7sus4", "7sus4b9", "-6", "-b6", "-7b5", "o", "6", "M9", "Maj7", "Maj7#11", " ", "+", "7", "7b9", "7#11", "7#9", "7#9#11", "13", "13b9", "7add4", "alt", "9", "Maj7sus4"};
- // Extraction du nombre de valeurs de chaque tableau
- int notelength = Note.length;
- int altlength = Alteration.length;
- int naturelength = Nature.length;
- // Choix aléatoire d'un nombre pour chaque tableau en fonction du nombre de valeurs
- int rand1 = (int) (Math.random() * notelength);
- int rand2 = (int) (Math.random() * altlength);
- int rand3 = (int) (Math.random() * naturelength);
- // Création de l'accord par concaténation d'une chaîne de caractères composée de trois
- // éléments des tableaux choisis au hasard
- String accord = Note[rand1] + Alteration[rand2] + Nature[rand3];
- // Affichage de l'accord créé
- System.out.println(accord);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement