The details depend a bit on the audiostack of your distro, but they all have a cli program with which you can change inputs/outputs and volume; e.g. pactl
for pulseaudio and wpctl
for wireplumber.
You’ll need a mechanism to find your triggers (I create a firefox tab with youtube/spotify, I have a music player active) and then you can act on it.
Detecting voice in an audiostream is probably technically possible, but that sounds pretty hard to setup.
Yes, a quick web search later I haven’t found a readymade solution.
Setting the volume for specific outputs is not very hard, so maybe a middleground solution is to have two shortcuts. One for “game mode” and one for “music mode” or whatever.