Closed KKQ-KKQ closed 10 months ago
If KeyboardMapping is not starts from C, the pitch seems to be incorrect.
The following test case is failed. Am I wrong?
TEST_CASE("Scale shift") { SECTION("Scale starts from D") { auto s = Tunings::readSCLFile(testFile("12-shuffled.scl")); auto shift = 2; Tunings::Tuning t(s, Tunings::startScaleOnAndTuneNoteTo(60 + shift, 69, 440.)); REQUIRE(s.count == 12); REQUIRE(t.frequencyForMidiNote(60 + shift) / 440. == Approx(exp2(shift/12.0)).margin(1e-6)); std::vector<int> order = {{0, 2, 1, 3, 5, 4, 6, 7, 8, 10, 9, 11, 12}}; auto l60s = t.logScaledFrequencyForMidiNote(60 + shift); for (size_t i = 0; i < order.size(); ++i) { auto li = t.logScaledFrequencyForMidiNote(60 + shift + i); auto oi = order[i]; REQUIRE(li - l60s == Approx(oi / 12.0).margin(1e-6)); } } }
Oh I was wrong. It is not an issue.
Tunings::startScaleOnAndTuneNoteTo(60 + shift, 69, 440.) means A4 == 440Hz.
If KeyboardMapping is not starts from C, the pitch seems to be incorrect.
The following test case is failed. Am I wrong?