Skip to content

Instantly share code, notes, and snippets.

@laamalif
Created April 8, 2025 13:35
Show Gist options
  • Save laamalif/ef1a93358f8ac6ddc8932abeb58a1812 to your computer and use it in GitHub Desktop.
Save laamalif/ef1a93358f8ac6ddc8932abeb58a1812 to your computer and use it in GitHub Desktop.
MPV Perfect EQ Script
local mp = require 'mp'
-- Track which EQ preset is active
local active_preset = nil
-- Helper function to apply an EQ preset
local function apply_eq(name, filters)
if active_preset == name then
mp.commandv("af", "clr")
mp.osd_message("πŸ”„ EQ Reset (Flat)", 3)
active_preset = nil
return
end
mp.commandv("af", "clr")
for _, filter in ipairs(filters) do
mp.commandv("af", "add", filter)
end
mp.osd_message("🎢 " .. name .. " EQ Activated", 3)
active_preset = name
end
-- 🎢 Perfect EQ (Ctrl+1)
mp.add_key_binding("ctrl+1", "perfect_eq", function()
apply_eq("Perfect", {
"equalizer=f=32:width_type=q:w=1.50:g=4.0",
"equalizer=f=64:width_type=q:w=1.50:g=2.0",
"equalizer=f=125:width_type=q:w=1.50:g=1.0",
"equalizer=f=250:width_type=q:w=1.50:g=0.0",
"equalizer=f=500:width_type=q:w=1.50:g=-1.0",
"equalizer=f=1000:width_type=q:w=1.50:g=-2.0",
"equalizer=f=2000:width_type=q:w=1.50:g=0.0",
"equalizer=f=4000:width_type=q:w=1.50:g=2.0",
"equalizer=f=8000:width_type=q:w=1.50:g=3.0",
"equalizer=f=16000:width_type=q:w=1.50:g=3.0"
})
end)
-- 🎢 Bollywood 80s–90s EQ (Ctrl+2)
mp.add_key_binding("ctrl+2", "bollywood_eq", function()
apply_eq("Bollywood 80s–90s", {
"equalizer=f=32:width_type=q:w=1.50:g=2.0",
"equalizer=f=64:width_type=q:w=1.50:g=2.0",
"equalizer=f=125:width_type=q:w=1.50:g=1.0",
"equalizer=f=250:width_type=q:w=1.50:g=0.0",
"equalizer=f=500:width_type=q:w=1.50:g=-1.0",
"equalizer=f=1000:width_type=q:w=1.50:g=-1.0",
"equalizer=f=2000:width_type=q:w=1.50:g=0.0",
"equalizer=f=4000:width_type=q:w=1.50:g=2.0",
"equalizer=f=8000:width_type=q:w=1.50:g=2.0",
"equalizer=f=16000:width_type=q:w=1.50:g=2.0"
})
end)
-- 🎢 Bass Enhancing + Perfect (Ctrl+3)
mp.add_key_binding("ctrl+3", "bass_eq", function()
apply_eq("Bass Enhancing + Perfect", {
"equalizer=f=32:t=bell:w=1.0:g=4",
"equalizer=f=64:t=bell:w=1.0:g=2",
"equalizer=f=125:t=bell:w=1.0:g=1",
"equalizer=f=250:t=bell:w=1.0:g=0",
"equalizer=f=500:t=bell:w=1.0:g=-1",
"equalizer=f=1000:t=bell:w=1.0:g=-2",
"equalizer=f=2000:t=bell:w=1.0:g=0",
"equalizer=f=4000:t=bell:w=1.0:g=2",
"equalizer=f=8000:t=bell:w=1.0:g=3",
"equalizer=f=16000:t=bell:w=1.0:g=3"
})
end)
-- πŸ”„ Reset EQ (Ctrl+0)
mp.add_key_binding("ctrl+0", "reset_eq", function()
mp.commandv("af", "clr")
active_preset = nil
mp.osd_message("πŸ”„ EQ Reset (Flat)", 3)
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment