Basic Automatic Volume Control
I am trying to recreate a basic automatic volume control within Max. I am using a eternal mic input to pick up the noise in the room routed into a live.gain~ . On another channel I have a track playing off an play~ and buffer~ into a live.gain~.
What I am trying to achieve is to increase the music volume if the noise inside the room increases.
What I’d like to know is if I can take the output of the 5th outlet of both live.gain~ (which outputs dBs values) and feed it into a IF and create a statement like
"if ch1 is xdB louder than ch2 then increase ch2 of ndBs" and vice versa "if ch2 is xdB louder than ch1 then reduce ch1 of ndBs"
Is that even humanly possible? Unfortunately I am not a ninja in Max but when it comes to maths I’m a real donkey :/
Any ideas out there?
is it the topic not interesting enough? or it is incomprehensible way I have explained?
Automatic gain control is possible, although it’s tricky if you’re outputting the sound into the room. If you turn up the sound, the room gets louder, so you turn up the sound some more, and …hilarity ensues.
I think your live gain idea is ok, although one object doesn’t allow you to the gain of each channel individually. I might do something like this:
----------begin_max5_patcher---------- 639.3oc2V0saaBCF8Z3ovhKmxhrABP1c64Xppx.tItBrQFm1jT07rO+SHk0l PbRSYZ6Fi7mM1muiOeG6W78Bx4qIsAfe.9Evy6EeOOSHc.u888BpwqKpvslo EvHOyyeLXhcHIYszDtnh1rC.mh.nocC1fkEKorE2KHER6dDlMaJbBHFFp+jL W2FBmBA2s+enklkSsEeGE0sPOvYRFtlXF5mBJtpaD1pZJqhHMXK5sf7Uxtnn dKRKcqYQP5s2F1NS4lFhEgAszEL0F.tSO9q995lINRNE75ZBS9A1oQvyw4Ua .OiYRfjCZKvUDfbIsc.xJJLUyOQIH8GzL3GXqGDKx0yEdHc5yegWH+gNJ+AO A+cEzyCUb0ZOTFCyLYbjQdbjDte5AOe50fEp3Rh3dBSw+j94iCod3EJcT4GV c3CBxwrEWmB5DkWeamptBc9Bq8Zk3vgXtrKTWD9Wut5DrRSEdytAHEzbqBJM xZ5LDojdSJVBuNR4SIYHaKwECQCg1LOdt068P6wngjKPA.uo5a3zYNjCQomW eO6+E8sx7poslykK2AhiQPSiCl.vXyEFwwCwRw+yc6JYKtbXgtM+QyyNuPO5 JppGn78K3zG+DQfWPTN+PnCm56c4liF7RyahK2s3P2ftfJJ68O+zjg53+Ii0 xWIJ5VvtmGBdKIKIsRJCKobVuIorB.nCyYIsrjv5+HfRZq9cAkm1NyU3j4.Z dGj+Jgi1m3r3IazXmXGQy3PNoNpbFGzLyAzjLZmTthlQRF6.ZhGMz3hiC5JQ i0OD2znb8a2ujFfntq3QtP2MYhoKkY6ZbgCDjmncyO0DAKT2PHUWOrRXs2Wm kD3q2mW8+M.vMtJz -----------end_max5_patcher-----------
Probably you’ll need more features to get the result you’re after.
Hi MZED, thank you very much for your feedback.
Here you can see where I am with this patch. But as you already guessed, what I am struggling with is the music played in the room being picked up as the actual noise to be compensated
What do you think about the use of the IF? Although, I guess the result would be the same just tackled from a different angle..?!
You could try removing some of the sound amplitude you’re putting into the room from the amplitude you’re evaluating, like:
----------begin_max5_patcher---------- 838.3ocyX0raiCBD9bxSAxGWkFA1F+yda09BrR6wUqpH1zDpb.KLoMsUMO6K FrSb+IMzDau8BHOFF+MeyLLC9ooS7VH1Rq7.eG7GvjIOMcxDinZASZddh2Zx 1rBRkYYdb58hE25My9JEcqxH9pc.37Vo2H3pJ1iz52f7mCaDy2rlwKnJih7a DVRTYqX7kWKoYJKP7iBz6ADBwlo35QesZ.+8fhDaTsZB0H0JR8PI0pFuJ1RN ova+1X4Fnpg+UnntXkSVa1i2uEajYTvOE4TvujBu5k77zo0CybjexDqWS4p2 PPkRwBxhhG.2S3JfR.pxHETfZEqZOTjKWTuV3dFqTRqzJinXBdGBB6aXl.bZ 8DrYXuc5B8iNN82p8HihQXyjO7n7O7szq+6xt+PxztiyfSuoPn+jdmfTfQFX G.GDRoU6n5oSxIGhtkZqWQkWS4ZuOsKe8l3UsYRzAN.uED9x2MrMse40ijK+ s5bY+dJYNLInSzTn+IHtyJYFMJzh1SVVsVHTq1ABCQPyvIBJasdn+YGTFbZt EZlPggCA4FNJjK4NpjrjtCffPGIU+XzPjouW6FWVJZH3T7nvoYErx5TYD.8o JMGb5RyglJOQoCA4DzujSuVP9BisBfWboUzfVa8BsO+juBUIObp7PWlDMG0u 87NjkISFEVorf7vtdJbBkZifhatOfigSGiT9nXl39kbnOlSx1SCKDxbpLSTH jVDAmim0Y.8RSxs.FKcfSRLbCtcz8SRh56VFw8Utf0zBSvCVt.9+eGi8Sk3A s2uv9NofjeHov4ZJVCEkF6TftCGB7AVbvP2R6kVfMZ3aN0MmtYqdEL9q+8QF TWK+kLVk4Wqz74auXA3.vyoUJF2zpe2EgdwhVwxyo7tmmkypp6Xv.e3656bE OotBGzn.mWY4GAOQiGdhbAOAil6JwU5YbfC1E3fOAbVyxKELtpIiJJ0dXmMM ONzzasu85oXjsrne2dG5QusS1S3nQuAt.mQCMtjZF9kJzK5KGZFmSshc.M3Q iabohWx3EECcDNiTAl.G8UmCbrcqPJK08jU0nRCRzcxcq8VYQyLOx31GMsN4 Io2wZWerQBQp6ISoaHaiz1Yz1j5KRo+NOO8e2+mROC -----------end_max5_patcher-----------
This is rather hack-ish, but it might get you there. Filters on the input signal might be another possibility. It will be very difficult to get a scientifically precise result, but a little gain boost if the room gets loud should be possible.