Resource icon

Auto mute/unmute/duck audio volume in Scene 1.3

DCStrato

Member
@Zyr

It looks like a new behavior where unmuting with obs.obs_source_set_muted(audio_source, false) toggles mute back off and sticks around after the call. The opposite, obs.obs_source_set_muted(audio_source, true) will toggle the source off briefly then it it comes back on by itself. I will try to isolate the issue to just those calls and verify its OBS and not the script. If it is a verified OBS issue it make take time to repair. Try using the source volume ducking and see if that works for you until I sort this out.

DC
 

DCStrato

Member
Hi @DCStrato,

I'm currently using OBS Studio 28.1.2 (64-bit). I noticed that the unmute seems to be not working properly.

Scenario 1:
1.) Set the Scene 1 with Mute Scenario
2.) Set the Scene 2 with Unmute Scenario
3.) Closed the OBS application with Scene 1 being the last selected Scene.
4.) Open the OBS Application again and Scene 1 is in Mute status
5.) However, when I switched to Scene 2 for the Unmute it is not working.

Scenario 2:
1.) Set the Scene 1 with Mute Scenario
2.) Set the Scene 2 with Unmute Scenario
3.) Closed the OBS application with Scene 2 being the last selected Scene.
4.) Open the OBS Application again and Scene 2 is still in Mute status
5.) I Unmute Scene 2 manually
6.) When I switch back to Scene 1, it is now in Unmute status.

I've been using your script for a long time now and this was my issue when I updated the OBS again (since I haven't used the application for quite some time now).
Zyr:
Here is a new version 1.2 with some updates. OBS loads a next scene before it unloads the prior scene. The script was restoring the old audio setting from the last scene after the new scene had changed it when loading. That won't happen now. 1. Restore is optional. 2. Restore is ignored if the new scene made a change to the same audio source. You can try this out and let me know how it goes.
D.C.
 

Attachments

  • automute-duck.zip
    2.7 KB · Views: 8

DCStrato

Member
DCStrato updated Auto mute/unmute audio in Scene with a new update entry:

Auto Mute-Duck Audio Source in Scene+

This LUA Source script will mute/unmute or set volume of a source (duck) to a specified level when entering a scene. Option to restore previous level on exit. Manages OBS loading new scene before exiting existing scene by ignoring restore if the new scene is also modifying volume for the same source.

Newest version adds volume level set and managing script exit issues with a few bug fixes.

1. Add source to scene
2. In source properties select Audio source to modify, Unmute if muted...

Read the rest of this update entry...
 

DaemonCross

New Member
Hi!
Epic script! I've been looking for this for quite a while. It's simpler and less faff than using manual audio capture, when you're a variety streamer and juggling multiple games and have to reconfigure for every game.

== FEATURE REQUEST ==
I've noticed that I -CAN NOT- put/drag the mute/unmute source -INSIDE- a group/folder. Is it possible to update your script for that little extra QoL, to Allow that function?
 

DaemonCross

New Member
Addtional:
Also request if there is a way to "Fade-in/Out" To mute/unmute. For a smooth transition back, to avoid abrupt/jarring switch back to higher volumes.
 

DCStrato

Member
Hi!
Epic script! I've been looking for this for quite a while. It's simpler and less faff than using manual audio capture, when you're a variety streamer and juggling multiple games and have to reconfigure for every game.

== FEATURE REQUEST ==
I've noticed that I -CAN NOT- put/drag the mute/unmute source -INSIDE- a group/folder. Is it possible to update your script for that little extra QoL, to Allow that function?
Hey Daemon,
Interesting. I'll take a look at the group issue. Stay tuned.
 

DCStrato

Member
Addtional:
Also request if there is a way to "Fade-in/Out" To mute/unmute. For a smooth transition back, to avoid abrupt/jarring switch back to higher volumes.
I would think a callback could vary the volume towards a target over time. I have done visual fading this way with other scripts, so audio should be similar. I suspect I can repurpose the visual fade code for audio pretty quickly. D.C.
 

DCStrato

Member
Hey Daemon,
Interesting. I'll take a look at the group issue. Stay tuned.
Daemon,

Apparently OBS does not allow "visible" sources that use bold type with <b> source name </b> to be moved. You can verify this by renaming any of your sources to be inside of the html bold tags <b> and </b> . They WILL be bold faced, but they also won't move if visible. Not sure if this is some sort of feature or bug. I will make corrections to use something other than bold face for the audio source being modified. Meanwhile, turn the source visibility OFF, move it, drag it into a group, whatever, then turn its visibility back on.
D.C.
 

DCStrato

Member
Daemon,

Correction.... If I remove the mute source OBS allows bold just fine. I am going to have to do some detail debugging to find out what is going on and how this script is somehow affecting OBS and its tolerance with visible formatted labels. Might be a few days as I get time to dig into it.

D.C.
 

DCStrato

Member
Daemon,

I was able to reset the UI from the View menu and all is working now with dragging visible formatted objects. What I don't know is what is causing it and if it is something in the automute script or just an OBS thing. Can you try that and see what happens? I am now unable to reproduce the issue. Maybe someone else has experienced this same strange UI issue? Working on your fade audio request. Should have it this week.

D.C.
 

DCStrato

Member
DCStrato updated Auto mute/unmute/duck audio volume in Scene with a new update entry:

Auto mute/unmute/duck audio volume in Scene 1.3

Jan 7, 2023

This LUA Source script will mute/unmute or set volume of a source (duck) to a specified level when entering a scene. Option to restore previous level on exit. Manages OBS loading new scene before exiting existing scene by ignoring restore if the new scene is also modifying volume for the same source.

Newest version adds volume level fade in/out and a few more bug fixes.

1. Add source to scene

2. In source properties select Audio source to modify, Unmute if muted, mute if...

Read the rest of this update entry...
 

DCStrato

Member
Hey Daemon,

Looks like khaver may also have you covered! You might want to checkout that script as well. I don't actually use this script and just wrote it because of a request, but I posted an updated v1.3 that has the fade in/out you requested just the same. In and out speeds can be different. No problem dragging it around after the UI reset. Also added it as a zip file here. Let me know how it goes. Cheers!

D.C.
 

Attachments

  • AutoMuteDuck.zip
    3 KB · Views: 3

DaemonCross

New Member
Yo D.C.,

Tried it out, so far so good. That did the trick! Thanks! Except for the dragging part, I tried the reset thing and, no go. Still can't nest it under a group. haha.

#SideIssue
I tried it on a "Media Source (MP3)", but it's not responding to the script. But for Desktop Source it's fine.
 
Top