Beispiel #1
0
    public void Play()
    {
        int[]            melody;
        PerlinParameters perlinParameters;
        MelodyParameters melodyParameters;

        perlinParameters        = new PerlinParameters();
        perlinParameters.range  = 2 * 8;
        perlinParameters.length = 2;
        perlinParameters.width  = 4;
        melody = MelodyProvider.GenerateMelody(perlinParameters);
        MelodyProvider.PrintMelodyData(melody);
        StartCoroutine(PlayMelody(melody));

        perlinParameters.range  = 1 * 8;
        perlinParameters.length = 1;
        perlinParameters.width  = 4;
        melodyParameters        = new MelodyParameters();
        melodyParameters.octave = 4;
        melody = MelodyProvider.GenerateMelody(perlinParameters, melodyParameters);
        StartCoroutine(PlayMelody(melody: melody, initialWait: 4, noteDuration: 2));

        perlinParameters.range  = 1 * 8;
        perlinParameters.length = 1;
        perlinParameters.width  = 8;
        perlinParameters.seed   = 44;
        melodyParameters        = new MelodyParameters();
        melodyParameters.octave = 6;
        melody = MelodyProvider.GenerateMelody(perlinParameters, melodyParameters);
        StartCoroutine(PlayMelody(melody: melody, initialWait: 8, noteDuration: 4));
    }
Beispiel #2
0
        public void GenerateMelody()
        {
            int[] melody = Mapper.GetNotesFromMelody(
                MelodyProvider.GenerateMelody(perlinParameters),
                notes,
                scale
                );

            // Visual feedback
            if (visualConstructor != null)
            {
                visualConstructor.ApplyMelody(melody);
                return;
            }

            melodies.Add(melody);
        }