diff --git a/tests/FilesT.cpp b/tests/FilesT.cpp
index d0d0b064..f4662417 100644
--- a/tests/FilesT.cpp
+++ b/tests/FilesT.cpp
@@ -684,3 +684,21 @@ TEST_CASE("[Files] Duplicate labels")
REQUIRE(xmlMidnam.find("") != xmlMidnam.npos);
REQUIRE(xmlMidnam.find("") != xmlMidnam.npos);
}
+
+TEST_CASE("[Files] Key center from audio file")
+{
+ sfz::Synth synth;
+ synth.loadSfzString(fs::current_path() / "tests/TestFiles/sample_keycenter.sfz", R"(
+ pitch_keycenter=sample
+ sample=root_key_38.wav
+ sample=root_key_62.wav
+ sample=root_key_38.flac
+ sample=root_key_62.flac
+ )");
+
+ REQUIRE(synth.getNumRegions() == 4);
+ REQUIRE(synth.getRegionView(0)->pitchKeycenter == 38);
+ REQUIRE(synth.getRegionView(1)->pitchKeycenter == 62);
+ REQUIRE(synth.getRegionView(2)->pitchKeycenter == 38);
+ REQUIRE(synth.getRegionView(3)->pitchKeycenter == 62);
+}
diff --git a/tests/TestFiles/root_key_38.flac b/tests/TestFiles/root_key_38.flac
new file mode 100644
index 00000000..d8eefb36
Binary files /dev/null and b/tests/TestFiles/root_key_38.flac differ
diff --git a/tests/TestFiles/root_key_38.wav b/tests/TestFiles/root_key_38.wav
new file mode 100644
index 00000000..e7a27089
Binary files /dev/null and b/tests/TestFiles/root_key_38.wav differ
diff --git a/tests/TestFiles/root_key_62.flac b/tests/TestFiles/root_key_62.flac
new file mode 100644
index 00000000..10006b58
Binary files /dev/null and b/tests/TestFiles/root_key_62.flac differ
diff --git a/tests/TestFiles/root_key_62.wav b/tests/TestFiles/root_key_62.wav
new file mode 100644
index 00000000..658d5bd4
Binary files /dev/null and b/tests/TestFiles/root_key_62.wav differ