Beispiel #1
0
		public Pitch TransposeOctaves(int oct)
		{
			var probablyOctave = ((int)Octaves + oct);
			if (probablyOctave > Octaves.Max() || probablyOctave < Octaves.Min())
				throw new ArgumentOutOfRangeException("probablyOctave", probablyOctave, "Resulting octave is out of range");
			var octave = (Octaves)probablyOctave;
			Octaves = octave;
			return new Pitch(this.Step, octave, this.Accidental);
		}
Beispiel #2
0
		public Pitch(Step step = null, Octaves octaves = Octaves.First, Accidentals accidental = Accidentals.Natural)
		{
			this.Step = step ?? new Step();
			this.Octaves = octaves;
			this.Accidental = accidental;
		}
Beispiel #3
0
 public Pitch(Notes note, Octaves ocatave)
 {
     _note = note;
     _oct = ocatave;
 }
		public DisplayStepOctave(Step step = null, Octaves octave = Octaves.First)
		{
			DisplayOctave = octave;
			DisplayStep = step ?? new Step();
		}
Beispiel #5
0
 public Note(Letters l, Octaves o, int d)
 {
     Init(l, o, d);
 }
Beispiel #6
0
 public static uint GetFrequencyFor(Notes n, Octaves o = Octaves.O4)
 {
     double offset = ((int)o * 12) + n.IndexOf<Notes>();
     return (uint)(__rootpitch * Math.Pow(__a, offset));
 }
Beispiel #7
0
        private void Init(Letters l, Octaves o, int d)
        {
            int letter_shift = (int)l - (int)Letters.A;
            int octave_shift = (int)o - (int)Octaves.One;
            int shift = letter_shift + octave_shift * 12;
            double f = ETALON_FREQ * Math.Pow(2.0, (double)shift / 12);

            freq = f;
            dur = d;
            let = l;
            oct = o;
        }
Beispiel #8
0
 public Note(Letters l, Octaves o)
 {
     Init(l, o, DEFAULT_DUR);
 }
Beispiel #9
0
 public Octave(Octaves value)
 {
     Value = value;
 }
Beispiel #10
0
 public Note(Keys key, Octaves octave)
 {
     Key    = key;
     Octave = octave;
 }
Beispiel #11
0
        public void PlayScale(uint[] scale, Notes n, uint duration, Octaves o = Octaves.O4)
        {
            var notes = EnumExtensions.GetArray<Notes>();

            for (uint i = 0; i < scale.Count(); i++)
            {
                var p = new Pitch(n, o) + scale[i];
                _sound.PlaySound(p, duration);
            }
        }
Beispiel #12
0
 public void PlayKey(uint[] scale, Notes n, uint duration, Octaves o = Octaves.O4)
 {
     var key = Key.KeyOf(scale, n);
     foreach (var p in key)
         _sound.PlaySound(p, duration);
 }
Beispiel #13
0
		public Unpitched(Step step = null, Octaves octave = Octaves.First)
		{
			var step1 = step ?? new Step();
			DisplayStepOctave = new DisplayStepOctave(step1, octave);
		}