diff --git a/hosts/common/programs/mpv/default.nix b/hosts/common/programs/mpv/default.nix index 5466034a0..271317cfc 100644 --- a/hosts/common/programs/mpv/default.nix +++ b/hosts/common/programs/mpv/default.nix @@ -41,6 +41,7 @@ let cfg = config.sane.programs.mpv; + myHrtf = "${pkgs.sofacoustics.listen.irc_1052}/share/sofa/listen-irc_1052.sofa"; uosc = pkgs.mpvScripts.uosc.overrideAttrs (upstream: { version = "5.2.0-unstable-2024-03-13"; src = lib.warnIf (lib.versionOlder "5.2.0" upstream.version) "uosc outdated; remove patch?" pkgs.fetchFromGitHub { @@ -144,6 +145,8 @@ in # i use enable52Compat in order to get `table.unpack`. # i think using `luajit` here instead of `lua` is optional, just i get better perf with it :) lua = pkgs.luajit.override { enable52Compat = true; self = lua; }; + # ship a ffmpeg with sofa enabled, for surround-sound downmixing + ffmpeg = pkgs.ffmpeg-full; }; scripts = [ pkgs.mpvScripts.mpris @@ -221,6 +224,7 @@ in fs.".config/mpv/scripts/sane_cast/main.lua".symlink.target = ./sane_cast/main.lua; fs.".config/mpv/scripts/sane_sysvol/main.lua".symlink.target = ./sane_sysvol/main.lua; fs.".config/mpv/scripts/sane_sysvol/non_blocking_popen.lua".symlink.target = ./sane_sysvol/non_blocking_popen.lua; + fs.".config/mpv/hrtf.sofa".symlink.target = myHrtf; fs.".config/mpv/input.conf".symlink.target = ./input.conf; fs.".config/mpv/mpv.conf".symlink.target = ./mpv.conf; fs.".config/mpv/script-opts/osc.conf".symlink.target = ./osc.conf; diff --git a/hosts/common/programs/mpv/mpv.conf b/hosts/common/programs/mpv/mpv.conf index 3618380b4..eebb09888 100644 --- a/hosts/common/programs/mpv/mpv.conf +++ b/hosts/common/programs/mpv/mpv.conf @@ -26,3 +26,10 @@ border=no # # with `ao-volume`, the max actually is 100. # # to go higher you'll have to use the system's native controls. # volume-max=100 + +# libmysofa Head Related Transfer Function file to use to downmix surround -> stereo +# for specifically my skull +# see: +# TODO: this maybe belongs in pipewire instead of mpv. +# at least, provide a way to disable the downmixing, so i can still output 5.1 over HDMI? +af=sofalizer=sofa=/home/colin/.config/mpv/hrtf.sofa