Exemplo n.º 1
0
 protected ChordBase(Pitch root, ChordType chordType)
 {
     pitches = new List<Pitch>() { root };
     switch (chordType)
     {
         case ChordType.Maj53:
             break;
         case ChordType.Min53:
             break;
         case ChordType.Aug53:
             break;
         case ChordType.Dim53:
             break;
         case ChordType.dominant7:
             break;
         case ChordType.dim7:
             break;
         case ChordType.m7flat5:
             break;
         case ChordType.min7:
             break;
         case ChordType.minMaj7:
             break;
     }
         
     
 }
		public void Serialize_HasDuration()
		{
			var duration = new Duration(5);
			var pitch = new Pitch();
			var note = new Note(pitch, duration);
			var serializer = new DataContractSerializer(typeof(Note));
			serializer.WriteObject(serialized, note);
			Console.WriteLine(SerializeHelper.StreamToUtf8String(serialized));
		}
Exemplo n.º 3
0
        public void ConvertToString(Pitch initial, string expected)
        {
            //ToDo: rewrite test for all cases
            //Subcontra octave == 0
            var Csharp1 = new Pitch(new Step(StepLetter.C), Octaves.Contra, Accidentals.Sharp);
            Assert.AreEqual("C#1", Csharp1.ToString());

            var A4 = new Pitch(new Step(StepLetter.A), Octaves.First, Accidentals.Natural);
            Assert.AreEqual("A4", A4.ToString());

            var Eb2 = new Pitch(new Step(StepLetter.E), Octaves.Great, Accidentals.Flat);
            Assert.AreEqual("Eb2", Eb2.ToString());

            var Dbb3 = new Pitch(new Step(StepLetter.D), Octaves.Small, Accidentals.DoubleFlat);
            Assert.AreEqual("Dbb3", Dbb3.ToString());

            var Fx5 = new Pitch(new Step(StepLetter.F), Octaves.Second, Accidentals.DoubleSharp);
            Assert.AreEqual("Fx5", Fx5.ToString());
        }
Exemplo n.º 4
0
        public static Interval GetC4BasedInterval(IntervalQuality quality, IntervalQuantity quantity)
        {
            var C4 = new Pitch(new Step(StepLetter.C));
            switch (quantity)
            {
                case IntervalQuantity.Unison:
                    if (quality == IntervalQuality.Perfect) return new Interval(C4, C4);
                    else throw new ArgumentException(string.Format(exceptionFormatString, quantity, quality));
                    break;
                case IntervalQuantity.Second:
                    if (quality == IntervalQuality.Minor) return new Interval(C4, new Pitch(new Step(StepLetter.D), accidental: Accidentals.Flat));
                    if (quality == IntervalQuality.Major) return new Interval(C4, new Pitch(new Step(StepLetter.D)));
                    if (quality == IntervalQuality.Augmented) return new Interval(C4, new Pitch(new Step(StepLetter.D), accidental: Accidentals.Sharp));
                    if (quality == IntervalQuality.Diminished) return new Interval(C4, new Pitch(new Step(StepLetter.D), accidental: Accidentals.DoubleFlat));
                    else throw new ArgumentException(string.Format(exceptionFormatString, quantity, quality));
                    break;
                case IntervalQuantity.Third:
                    if (quality == IntervalQuality.Minor) return new Interval(C4, new Pitch(new Step(StepLetter.E), accidental: Accidentals.Flat));
                    if (quality == IntervalQuality.Major) return new Interval(C4, new Pitch(new Step(StepLetter.E)));
                    if (quality == IntervalQuality.Augmented) return new Interval(C4, new Pitch(new Step(StepLetter.E), accidental: Accidentals.Sharp));
                    if (quality == IntervalQuality.Diminished) return new Interval(C4, new Pitch(new Step(StepLetter.E), accidental: Accidentals.DoubleFlat));
                    else throw new ArgumentException(string.Format(exceptionFormatString, quantity, quality));
                    break;
                case IntervalQuantity.Fourth:
                    if (quality == IntervalQuality.Perfect) return new Interval(C4, new Pitch(new Step(StepLetter.F)));
                    if (quality == IntervalQuality.Augmented) return new Interval(C4, new Pitch(new Step(StepLetter.F), accidental: Accidentals.Sharp));
                    if (quality == IntervalQuality.Diminished) return new Interval(C4, new Pitch(new Step(StepLetter.F), accidental: Accidentals.Flat));
                    else throw new ArgumentException(string.Format(exceptionFormatString, quantity, quality));
                    break;
                case IntervalQuantity.Fifth:
                    if (quality == IntervalQuality.Perfect) return new Interval(C4, new Pitch(new Step(StepLetter.G)));
                    if (quality == IntervalQuality.Augmented) return new Interval(C4, new Pitch(new Step(StepLetter.G), accidental: Accidentals.Sharp));
                    if (quality == IntervalQuality.Diminished) return new Interval(C4, new Pitch(new Step(StepLetter.G), accidental: Accidentals.Flat));
                    else throw new ArgumentException(string.Format(exceptionFormatString, quantity, quality));
                    break;
                case IntervalQuantity.Sixth:
                    if (quality == IntervalQuality.Minor) return new Interval(C4, new Pitch(new Step(StepLetter.A), accidental: Accidentals.Flat));
                    if (quality == IntervalQuality.Major) return new Interval(C4, new Pitch(new Step(StepLetter.A)));
                    if (quality == IntervalQuality.Augmented) return new Interval(C4, new Pitch(new Step(StepLetter.A), accidental: Accidentals.Sharp));
                    if (quality == IntervalQuality.Diminished) return new Interval(C4, new Pitch(new Step(StepLetter.A), accidental: Accidentals.DoubleFlat));
                    else throw new ArgumentException(string.Format(exceptionFormatString, quantity, quality));
                    break;
                case IntervalQuantity.Seventh:
                    if (quality == IntervalQuality.Minor) return new Interval(C4, new Pitch(new Step(StepLetter.B), accidental: Accidentals.Flat));
                    if (quality == IntervalQuality.Major) return new Interval(C4, new Pitch(new Step(StepLetter.B)));
                    if (quality == IntervalQuality.Augmented) return new Interval(C4, new Pitch(new Step(StepLetter.A), accidental: Accidentals.Sharp));
                    if (quality == IntervalQuality.Diminished) return new Interval(C4, new Pitch(new Step(StepLetter.A), accidental: Accidentals.DoubleFlat));
                    else throw new ArgumentException(string.Format(exceptionFormatString, quantity, quality));
                    break;
                case IntervalQuantity.Octave:
					var tempInterval = GetC4BasedInterval(quality, IntervalQuantity.Unison);
		            if (quality == IntervalQuality.Perfect) return new Interval(tempInterval.Root, tempInterval.Top.TransposeOctaves(1));
                    if (quality == IntervalQuality.Augmented) return new Interval(C4, new Pitch(new Step(StepLetter.A), accidental: Accidentals.Sharp));
                    if (quality == IntervalQuality.Diminished) return new Interval(C4, new Pitch(new Step(StepLetter.A), accidental: Accidentals.DoubleFlat));
                    else throw new ArgumentException(string.Format(exceptionFormatString, quantity, quality));
		            
		            break;
                case IntervalQuantity.Ninth:
                    break;
                case IntervalQuantity.Tenth: break;
                case IntervalQuantity.Eleventh: break;
                case IntervalQuantity.Twelfth: break;
                case IntervalQuantity.Thirteenth: break;
                case IntervalQuantity.Fourteenth: break;
                case IntervalQuantity.Fifteenth: break;
                default: break;
            }
            return default(Interval);
        }
Exemplo n.º 5
0
 public Scale(Pitch root, ScaleType scaleType)
 {
     this.Root = root;
     this.scaleType = scaleType;
 }
Exemplo n.º 6
0
 public void TransposeOctaves_AddNumberOfOctavesWithoutOverflow_ReturnsValidPitch(Pitch initial, int addOctCount, Pitch expected)
 {
     var actual = initial.TransposeOctaves(addOctCount);
     actual.ShouldBeEquivalentTo(expected);
 }