Exemplo n.º 1
0
    private void MakeScale(int startMidiNumber, ScalesAndModes scalesAndModes)
    {
        currentScale.Clear();
        _currentScaleMode      = scalesAndModes;
        _currentRootMidiNumber = startMidiNumber;

        GetMidiNoteFromNumber(startMidiNumber);

        switch (scalesAndModes)
        {
        case ScalesAndModes.Aeolian:
            _currentInterval = _aeolianSteps;
            break;

        case ScalesAndModes.Dorian:
            _currentInterval = _dorianSteps;
            break;

        case ScalesAndModes.Ionian:
            _currentInterval = _ionianSteps;
            break;

        case ScalesAndModes.Locrian:
            _currentInterval = _locrianSteps;
            break;

        case ScalesAndModes.Lydian:
            _currentInterval = _lydianSteps;
            break;

        case ScalesAndModes.Minor:
            _currentInterval = _minorSteps;
            break;

        case ScalesAndModes.Mixolydian:
            _currentInterval = _mixolydianSteps;
            break;

        case ScalesAndModes.Phrygian:
            _currentInterval = _phrygianSteps;
            break;

        default:
            _currentInterval = _majorSteps;
            break;
        }

        var stepCounter      = 0;
        var midiNoteCounter  = startMidiNumber;
        var scaleMidiNumbers = new List <int>();

        scaleMidiNumbers.Add(midiNoteCounter);
        while (stepCounter < _currentInterval.Length)
        {
            if (midiNoteCounter + _currentInterval[stepCounter] >= 127)
            {
                continue;
            }
            midiNoteCounter += _currentInterval[stepCounter];
            scaleMidiNumbers.Add(midiNoteCounter);
            ++stepCounter;
        }

        GetMidiNotesFromNumbers(scaleMidiNumbers);
    }
Exemplo n.º 2
0
 public void SetCurrentScaleMode(ScalesAndModes scaleMode)
 {
     MakeScale(_currentRootMidiNumber, scaleMode);
 }