protected Scale(Mode mode, int startingMidiPitch, Pitch.MidiPitchTranslationMode translationMode) { Mode = mode; StartingMidiPitch = startingMidiPitch; MidiPitchTranslationMode = translationMode; FullScale = BuildScale(1, Mode.Intervals.Count()).Select(p => p.ToStep()).ToList(); }
public IEnumerable <Pitch> BuildScale(int startingMidiPitch, Pitch.MidiPitchTranslationMode translationMode, int startingStep, int numberOfSteps) { if (startingStep < 1) { throw new ArgumentException("Starting step must be greater than 0.", "startingStep"); } if (numberOfSteps < 1) { throw new ArgumentException("Number of steps must be greater than 0.", "numberOfSteps"); } var pitches = new List <Pitch>(); var midiPitch = startingMidiPitch; for (int step = startingStep; step < startingStep + numberOfSteps; step++) { pitches.Add(Pitch.FromMidiPitch(midiPitch, translationMode)); midiPitch = midiPitch + GetIntervalAfterStep(step); } return(pitches); }
/// <summary> /// Initializes a new instance of BoundInterval which is generated by translation of specific pitch by specific interval. /// </summary> /// <param name="pitch">Pitch to translate</param> /// <param name="interval">Interval</param> /// <param name="translationMode">Translation mode</param> public BoundInterval(Pitch pitch, Interval interval, Pitch.MidiPitchTranslationMode translationMode) : base(interval.Steps, interval.Halftones) { StartingPitch = pitch; EndingPitch = pitch.Translate(interval, translationMode); }