summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Heinrich <christoph.heinrich@student.tugraz.at>2023-10-06 21:41:42 +0200
committerDudemanguy <random342@airmail.cc>2023-10-15 13:39:59 +0000
commitf5d4f2aea46c32d7fd45dcc4a4afee81c39b5aa5 (patch)
tree5547e777dc5760779b791e9464f5070b140e80d2
parent4a88e3d5c07d1c06595b724a1a98c5a212d81ab4 (diff)
downloadmpv-f5d4f2aea46c32d7fd45dcc4a4afee81c39b5aa5.tar.bz2
mpv-f5d4f2aea46c32d7fd45dcc4a4afee81c39b5aa5.tar.xz
af_scaletempo2: better defaults
Why a bigger search-interval is required: scaletempo2 doesn't do a good job when the signal contains frequencies less then 1/search_interval. With a search interval of 30ms that means anything below 33.333Hz sounds bad. Depending on the genre it's very for music to contain frequencies down to 30Hz, and sometimes even a little bit below that. Therefore a higher default value is needed to handle such cases. Based on that an argument can be made for a value of 50, as that should work down to 20Hz, or something even higher because movies sometimes have some infrasonic content. However the downside of big search intervals is increased CPU usage and intelligibility at higher speeds, as it effectively leads to parts of the audio being skipped. A value of 40 can handle frequencies down to 25Hz, enough for all music except very rare edge cases, while still providing decent intelligibility. Why a smaller window-size is required: Large values reduce intelligibility at high speeds and therefore small values are preferred. However when values get too small it starts to sound weird (similar to librubberband). In my testing a value of 10 already works well, but adding a small safety margin seems like a good idea, especially since it made no noticeable difference to intelligibility, which is why 12 was chosen.
-rw-r--r--DOCS/man/af.rst4
-rw-r--r--audio/filter/af_scaletempo2.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/DOCS/man/af.rst b/DOCS/man/af.rst
index d9c184e9c5..77abd2ff15 100644
--- a/DOCS/man/af.rst
+++ b/DOCS/man/af.rst
@@ -182,10 +182,10 @@ Available filters are:
and ``<speed> != 0``. (default: 8.0)
``search-interval=<amount>``
- Length in milliseconds to search for best overlap position. (default: 30)
+ Length in milliseconds to search for best overlap position. (default: 40)
``window-size=<amount>``
- Length in milliseconds of the overlap-and-add window. (default: 20)
+ Length in milliseconds of the overlap-and-add window. (default: 12)
``rubberband``
High quality pitch correction with librubberband. This can be used in place
diff --git a/audio/filter/af_scaletempo2.c b/audio/filter/af_scaletempo2.c
index 1aa656dc54..7ad8e3566d 100644
--- a/audio/filter/af_scaletempo2.c
+++ b/audio/filter/af_scaletempo2.c
@@ -235,8 +235,8 @@ const struct mp_user_filter_entry af_scaletempo2 = {
.priv_defaults = &(const OPT_BASE_STRUCT) {
.min_playback_rate = 0.25,
.max_playback_rate = 8.0,
- .ola_window_size_ms = 20,
- .wsola_search_interval_ms = 30,
+ .ola_window_size_ms = 12,
+ .wsola_search_interval_ms = 40,
},
.options = (const struct m_option[]) {
{"search-interval",