remix surround channel levels (original) (raw)

@bitingsock

Clone this repository at <script src="https://gist.github.com/bitingsock/1e7ef04a151963b38e347a723d7e3201.js"></script>

Save bitingsock/1e7ef04a151963b38e347a723d7e3201 to your computer and use it in GitHub Desktop.

remix surround channel levels

This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

cmCenter = 1
local defCenter = 1
cmFront = 0.707
local defFront = 0.707
cmSide = 0.707
local defSide = 0.707
cmBack = 0.707
local defBack = 0.707
cmLFE = 0
local defLFE = 0
local function mix(channel, adjustment)
if channel == "reset" then
cmCenter = defCenter
cmFront = defFront
cmSide = defSide
cmBack = defBack
cmLFE = defLFE
else
_G[channel] = _G[channel] + adjustment
if _G[channel] < 0.001 then _G[channel] = 0 end
end
mp.set_property("af", "lavfi=[pan=stereo|FL="..cmCenter.."FC+"..cmFront.."FL+"..cmSide.."SL+"..cmBack.."BL+"..cmLFE.."LFE
mp.osd_message("lavfi=[pan=stereo|\nFL="..cmCenter.."FC+"..cmFront.."FL+"..cmSide.."SL+"..cmBack.."BL+"..cmLFE.."LFE
end
mp.add_key_binding("Ctrl+Shift+F8", "mReset", function() mix("reset") end)
mp.add_key_binding("Shift+F8", "cUp", function() mix("cmCenter",0.1) end)
mp.add_key_binding("Ctrl+F8", "cDown", function() mix("cmCenter",-0.1) end)
mp.add_key_binding("Shift+F9", "fUp", function() mix("cmFront",0.1) end)
mp.add_key_binding("Ctrl+F9", "fDown", function() mix("cmFront",-0.1) end)
mp.add_key_binding("Shift+F10", "sUp", function() mix("cmSide",0.1) end)
mp.add_key_binding("Ctrl+F10", "sDown", function() mix("cmSide",-0.1) end)
mp.add_key_binding("Shift+F11", "bUp", function() mix("cmBack",0.1) end)
mp.add_key_binding("Ctrl+F11", "bDown", function() mix("cmBack",-0.1) end)
mp.add_key_binding("Shift+F12", "lUp", function() mix("cmLFE",0.1) end)
mp.add_key_binding("Ctrl+F12", "lDown", function() mix("cmLFE",-0.1) end)