# Audio based scene switching



## sleeper (Dec 4, 2019)

I currently use the obs-websocket plugin and a discord bot to create audio based scene switching based upon who is talking in a discord server. Since around the beginning of September an api change lead to a Discord client speaking event not working so I could not switch scenes based off audio.

Does anybody know of any work around via the OBS Path in terms of a plugin or some call in obs-websocket?


----------



## Filip S (Jan 4, 2020)

sleeper said:


> I currently use the obs-websocket plugin and a discord bot to create audio based scene switching based upon who is talking in a discord server. Since around the beginning of September an api change lead to a Discord client speaking event not working so I could not switch scenes based off audio.
> 
> Does anybody know of any work around via the OBS Path in terms of a plugin or some call in obs-websocket?



A solution that select a scene depending on audio would be cool - so when you set up a interview with maybe 3 cams it can follow audio source so when audio is from cam1 source it select cam1 scene and when audio from cam2 it switch to cam2 scene and if no audio it select a default standby scene - the slingstudio have simular function so making a interview with a robot obs operator is possible.
I don't know why discord is needed .


----------



## dodemo (Jul 20, 2020)

there is a project...








						GitHub - EsteveSegura/SwitchSceneOnAudioOBS: Small project that changes the scene in OBS automatically depending on the audio from the specified microphones
					

Small project that changes the scene in OBS automatically depending on the audio from the specified microphones - GitHub - EsteveSegura/SwitchSceneOnAudioOBS: Small project that changes the scene i...




					github.com
				



It works but needs some previous knowledge.


----------



## dodemo (Jul 20, 2020)

It worked for me but there is an issue with "autoleveling of audio inputs" by Windows


----------



## coolrey3 (Jul 26, 2020)

dodemo said:


> It worked for me but there is an issue with "autoleveling of audio inputs" by Windows




how did you get this to work? i installed all requirements and websocket works with remote control but when i launch the audio page i just get 5 columns with master and slave but i dont get any further options.

Did you need to change anything in the code?


----------



## coolrey3 (Jul 26, 2020)

i get OverconstrainedError {name: "OverconstrainedError", message: "", constraint: "deviceId"} in the console log when i hit the start button


----------



## corc0 (Aug 3, 2020)

coolrey3 said:


> i get OverconstrainedError {name: "OverconstrainedError", message: "", constraint: "deviceId"} in the console log when i hit the start button


Hey -- I was dealing with the same issue last week. 

In my case, the problem was that the browser (Firefox) never asked for permission to access my computer's audio devices. As a result, SwitchSceneOnAudio wasn't able to get a list of Device IDs. I solved this by granting the page (http://localhost:3000) permanent access to all audio devices. In Firefox, those steps were:

Right click on the page; choose View Page Info
Select the Permissions tab
Scroll down to Microphones. Uncheck "Use Default" and click the "Allow" radio button
I'm guessing it's not a good practice to grant these sorts of permissions permanently, but this got me up and running. Hope it solves your problem, too.


----------



## dodemo (Aug 6, 2020)

It works on Chrome only I think


----------



## dodemo (Aug 6, 2020)

You need to give  permission on this localhost to microphones the same way as web based Zoom calls.


----------



## WirelessIRE_Eng (Dec 10, 2020)

dodemo said:


> You need to give  permission on this localhost to microphones the same way as web based Zoom calls.



Hi, thanks for alerting me to this project. Can you assist me a little further as I'm an OBS novice. I've got my websocket and localhost working and my host recognises the audio for each scene. What I now need is to figure out how to then make this function in OBS to then switch these scenes as I wish based on the audio. 

Thanks.


----------

