예제 #1
0
        public void TickTempoAsSeconds_117()
        {
            int    bpm = 117;
            double sec = AudioMaths.TickTempoAsSeconds(bpm);

            Assert.AreEqual((60.0 / bpm) / 480.0, sec);
        }
예제 #2
0
        private void InitializeNoteFrequenceTable()
        {
            fA4Frequence = 440.0f; //A4 = 440Hz

            //A0 has distance of -60 => C0 has distance of -57 (-60 + 3)
            int distanceFromA4 = -57;

            //Add from C0 to B9
            for (int i = 0; i <= 9; i++)
            {
                fTable.Add("C" + i.ToString(),
                           AudioMaths.CalculateNoteFrequence(fA4Frequence, distanceFromA4++));
                fTable.Add("C#" + i.ToString(),
                           AudioMaths.CalculateNoteFrequence(fA4Frequence, distanceFromA4));
                fTable.Add("Db" + i.ToString(),
                           AudioMaths.CalculateNoteFrequence(fA4Frequence, distanceFromA4++));
                fTable.Add("D" + i.ToString(),
                           AudioMaths.CalculateNoteFrequence(fA4Frequence, distanceFromA4++));
                fTable.Add("D#" + i.ToString(),
                           AudioMaths.CalculateNoteFrequence(fA4Frequence, distanceFromA4));
                fTable.Add("Eb" + i.ToString(),
                           AudioMaths.CalculateNoteFrequence(fA4Frequence, distanceFromA4++));
                fTable.Add("E" + i.ToString(),
                           AudioMaths.CalculateNoteFrequence(fA4Frequence, distanceFromA4++));
                fTable.Add("F" + i.ToString(),
                           AudioMaths.CalculateNoteFrequence(fA4Frequence, distanceFromA4++));
                fTable.Add("F#" + i.ToString(),
                           AudioMaths.CalculateNoteFrequence(fA4Frequence, distanceFromA4));
                fTable.Add("Gb" + i.ToString(),
                           AudioMaths.CalculateNoteFrequence(fA4Frequence, distanceFromA4++));
                fTable.Add("G" + i.ToString(),
                           AudioMaths.CalculateNoteFrequence(fA4Frequence, distanceFromA4++));
                fTable.Add("G#" + i.ToString(),
                           AudioMaths.CalculateNoteFrequence(fA4Frequence, distanceFromA4));
                fTable.Add("Ab" + i.ToString(),
                           AudioMaths.CalculateNoteFrequence(fA4Frequence, distanceFromA4++));
                fTable.Add("A" + i.ToString(),
                           AudioMaths.CalculateNoteFrequence(fA4Frequence, distanceFromA4++));
                fTable.Add("A#" + i.ToString(),
                           AudioMaths.CalculateNoteFrequence(fA4Frequence, distanceFromA4));
                fTable.Add("Bb" + i.ToString(),
                           AudioMaths.CalculateNoteFrequence(fA4Frequence, distanceFromA4++));
                fTable.Add("B" + i.ToString(),
                           AudioMaths.CalculateNoteFrequence(fA4Frequence, distanceFromA4++));
            }
        }
예제 #3
0
        public void BeatTempoAsSeconds_120()
        {
            double sec = AudioMaths.BeatTempoAsSeconds(120);

            Assert.AreEqual(0.5, sec);
        }
예제 #4
0
        public void BeatTempoAsSeconds_117()
        {
            double sec = AudioMaths.BeatTempoAsSeconds(117);

            Assert.AreEqual(60.0 / 117.0, sec);
        }
예제 #5
0
        public void BeatTempoAsSeconds_60()
        {
            double sec = AudioMaths.BeatTempoAsSeconds(60);

            Assert.AreEqual(1, sec);
        }