Advanced Scene Switcher

Advanced Scene Switcher 1.28.1

Warmuptill

Active Member
@hammerheaddown Unfortunately identifying tones / frequencies is currently not supported.
The clever approach suggested by @AaronD is also not possible with this plugin at the moment as there is no way to check the volume *after* all filters are applied.
@hammerheaddown I have to correct myself ...
The current implementation seems to already check audio and video sources *after* all filters are applied.

I tested this by simply applying a negative gain filter to an audio source and comparing whether or not an audio condition triggers for the same volume threshold.

So the approach suggested by @AaronD might work.
Basically you would need to create a copy of your audio source on which you apply "aggressive" filters which *only* allow the targeted frequencies.
Then you can proceed with the regular volume check of the audio condition on this filtered audio source.

But to be honest I am not really familiar with audio filters in OBS so I am not sure how easy this would be to set up.
 

AaronD

Active Member
@hammerheaddown I have to correct myself ...
The current implementation seems to already check audio and video sources *after* all filters are applied.

I tested this by simply applying a negative gain filter to an audio source and comparing whether or not an audio condition triggers for the same volume threshold.

So the approach suggested by @AaronD might work.
Basically you would need to create a copy of your audio source on which you apply "aggressive" filters which *only* allow the targeted frequencies.
Then you can proceed with the regular volume check of the audio condition on this filtered audio source.

But to be honest I am not really familiar with audio filters in OBS so I am not sure how easy this would be to set up.
Oh good! I was starting to wonder what that implied about the filters themselves. Specifically, a side-chained compressor, and others that can react to a different signal than the one that they're processing. For example, if I put a noise gate on one signal, and then use that signal as the side-chain to a compressor, does the compressed signal still "duck" even when the gate doesn't open? I've been running that kind of signal flow for a while now, and haven't noticed a problem with it, but you did get me to wondering.

Normally as good practice, you'd want to keep your video processing and audio processing apps separate, and bring the finished audio into the video rig as an unchanged passthrough, plus possibly a few more channels that you use for triggers but nobody hears those. That would eliminate the pre-/post-filter problem because there aren't any (significant*) filters.
(* maybe a low-threshold noise gate because you're using an analog line input from a hardware mixer or something like that, but that's about it)

But one particular rig must run on Windows (yuck) and use minimal hardware, and the cheap audio processor that I found for Windoze is really more of a multi-channel loopback than anything else, in terms of what's actually useful about it. (I wouldn't call it a DAW yet: https://vb-audio.com/Voicemeeter/potato.htm ) So the audio in that rig goes around the loop several times with a lot of the work being done with OBS filters and creative routing. I made a copy of that rig for my own use, on Ubuntu Linux instead, that does follow the good practice and works a LOT better! (using these filters instead of what OBS has: https://lsp-plug.in/ )

I will open a new thread as this is out of scope of this plugin at "this" time but maybe soon! thanks!!
Can you share the link here, so that those of us that are interested can just hop over to it? Thanks!
 
am i correct in thinking if i had the audio/video file saved it could look for it? think you guys went a tiny bit above my paygrade :P

But i have a few ideas i have looked into, seems we should be able to used a named pipe to detect the audio change and write to a file or maybe just launch another Bat file that could trigger a macro or hotkey
 

Warmuptill

Active Member
am i correct in thinking if i had the audio/video file saved it could look for it? think you guys went a tiny bit above my paygrade :P

But i have a few ideas i have looked into, seems we should be able to used a named pipe to detect the audio change and write to a file or maybe just launch another Bat file that could trigger a macro or hotkey
Can you maybe provide an example of you what type of audio you would want to match?
Just to avoid that we are talking about completely different things.
 

AaronD

Active Member
am i correct in thinking if i had the audio/video file saved it could look for it? think you guys went a tiny bit above my paygrade :P

But i have a few ideas i have looked into, seems we should be able to used a named pipe to detect the audio change and write to a file or maybe just launch another Bat file that could trigger a macro or hotkey
My first thought when I read that was: https://xkcd.com/763/

Anyway, if I understand correctly, you want to use a touchtone phone to trigger scene switches, as in, "To see the newsreaders, press 1. To see the weatherman, press 2...." Correct?

If that's true, and if you're on Linux so as to use the good plugins that I linked to, then you could feed the phone input to several copies of the parametric EQ that's in there. (not multiple bands of the same copy, but actually multiple copies) Each copy is set for a single tall, narrow boost at a different frequency, according to the DTMF spec. To make it really selective, you might even use several bands of the same copy, all set the same. (probably need to reduce the input gain of each copy, so that it doesn't clip)

Each phone key now corresponds to a different pair of those EQ copies. You can try adding the pair-detection logic in the form of more audio processing, or you can just bring the output of each EQ into OBS as a different source and use the actual boolean logic in Adv-SS so do that:
  • IF freqA>threshold AND freqB>threshold THEN select scene1
  • IF freqA>threshold AND freqC>threshold THEN select scene2
  • etc.
 

AaronD

Active Member
something like this
That's a single-frequency sine wave. For that, you might get away with a single EQ boost, like the set of them that you'd use for DTMF as I described before, but only one of them. If that one is above the threshold, then that's your trigger. (still do the filtering outside of OBS if you can, and bring it in already-processed)

But that kind of logic might get confused by a legitimate source that just happens to have that in it. A guitar solo, for example, might do that for a brief moment, but long enough to trigger the scene switch. A more robust way to do it would be to have a second input and use similar logic as a DTMF pair, except that this second input is a cut of the same frequency range. Now the logic is:
  • IF boost>threshold AND NOT cut>threshold THEN switch scenes
The reason that a guitar solo shouldn't trigger that one is because the guitar probably has harmonics in it that the pure tone doesn't. Those harmonics will get through the "cut" channel and block the "NOT cut>threshold" part.

Now, if a legitimate source does indeed give you a pure sine at that frequency (or close enough) with no harmonics, then there's no way to tell the difference with just audio processing. You just have to know that and not give it that input.
 

FoxKeegan

New Member
something like this
<scrolls back through the posts>

I could be mistaken, but this sounds like a case of getting stuck asking how to build a submarine, without anyone realizing you're just trying to cross a stream.
You just want to switch a scene after an audio file that you created and put into a playlist that plays separately of other files at a set time is played, correct? Or--specifically--as soon as it stops being played?

Honestly, if that's correct, what you're describing is actually better suited to be implemented as a transition in OBS. You want to emulate the idea of a broadcaster ending transmissions by displaying the test card pattern and then resuming with different content. (Again, if I'm understanding this correctly.) Not only can this plugin do what you're asking, it can do it better if you turn the test card into its own transition. I'll let you google the tutorial on that, but what you (probably) want is called a 'Stinger' transition, which is pretty self-explanatory if you open scene transitions, create a new one, and click "Stinger".

Even if you don't do that, it's still possible. (It's just more work) Looking at your previous posts, I will say I'm not aware of any way for it to run conditional statements of media in a playlist, as there is no 'switching to next song' state, or any way to specify the media in the list. However, if you plan to run the same files each time, you could break them up into different playlists at the points where you intended to play the test card and switch scenes. If your playlist is videos "A, B, C, D, test card, E, F, G, H, test card, I, J K, test card" instead make 3 playlists, and simply tell Scene Switcher to change to a different scene at the end of the new, shorter playlist. If you create a stinger transition with the test card, you can remove it from the playlists, and simply tell Scene Switcher to switch scenes using that transition.

If none of those solutions will work for your unique situation, you probably really want to be using a macro that scans video rather than audio. If you're displaying the test card with the 1khz tone, you can just pick the source and either select the file specifically, or pattern match. I've not had reason to play with this one specifically, but it looks pretty straightforward. That one would trigger even if the test card was in the middle of a video file you were playing rather than being its own file. I wouldn't use this option unless I had to, though. It's gonna put more stress on your CPU.

If none of that solves your problem, I'd be very curious to hear the original problem you're trying to solve, rather than the problems you're having attempting to implement a solution.
 

FoxKeegan

New Member
This one is for Warmuptill, (and anyone else with a good solution for this problem!)

What's your suggested "Best Practice" for implementing a simple trigger that plays an audio file, every hour, starting at a specific hour? In this case, a clock bell chime.

I've listed my current attempt below, but there are some issues:

1649475829007.png


The execution is a bit clunky, but it works. The source has to remain hidden, because I cannot figure out a way to prevent media from automatically playing the first time it appears in a scene, and I don't want to start my stream off with the chime. So, it's made visible, set to restart playback when made visible again, plays, SS waits for it to finish, and then hides it again. Cumbersome, but it works.

The real problem I'm having is that while the setting to repeat is convenient, it does so by altering the time of the macro itself. While this functions perfectly during the first stream, it means that the next stream I start won't play the chime at 21:00, because it will still be set for 1-60 minutes past the time I last ended my stream. (E.g. 23:00) I can manually update this each time, but that flies in the face of the "Automatic" part of the name. :)

Now, there's two obvious solutions to this:
1. Create 22 conditional "or" statements, one for each hour of the day
2. Create a 1 hour timer macro that is unpaused by a different macro which triggers at 20:00. Then, add another command in the "End Streaming" macro to pause the 1 hour timer macro so it doesn't start the timer automatically when OBS opens. (Or to the startup macro to pause it. Or both, for redundancy!)

Now, #1 is probably less likely to fail, but my programming background makes me shudder at the idea of manually entering what should be a loop. :) #2 is less clunky, but if something goes wrong the timer won't be synced up to the clock.
Is there a better option?

Thanks for your time, and awesome plugin.
 

FoxKeegan

New Member
2. Create a 1 hour timer macro that is unpaused by a different macro which triggers at 20:00. Then, add another command in the "End Streaming" macro to pause the 1 hour timer macro so it doesn't start the timer automatically when OBS opens. (Or to the startup macro to pause it. Or both, for redundancy!)
After some trial and error, I'm updating this one with skipping all the pausing bits and simply making it reset the timer at 20:00 so it's synced up, since (I've learned) pausing doesn't stop the timer :)
 

Warmuptill

Active Member
After some trial and error, I'm updating this one with skipping all the pausing bits and simply making it reset the timer at 20:00 so it's synced up, since (I've learned) pausing doesn't stop the timer :)
Glad to hear that you found a solution!

Just to clarify regarding "pausing doesn't stop the timer":
You are referring to pausing the *macro* itself and not the "Timer" action to pause another timer, right?
PauseTimer.PNG

If the latter does not work that would be a bug.

Do makes sense still to add an option to the date condition which allows you to toggle the automatic overwriting of the selected date on repeat?
If so I would see if I can try to implement something similar to this:
Repeat.PNG
 

AaronD

Active Member
What's your suggested "Best Practice" for implementing a simple trigger that plays an audio file, every hour, starting at a specific hour? In this case, a clock bell chime.
As more of an audio guy that got started in the analog world, the way that *I* would do that is with an audio source that is normally silent, except to play that sound. Then the device (or software via loopback or Jack/PipeWire) that you connect it to, and its timing, is a completely separate problem.

(don't know if it works in context, but this one might be funny instead of a "boring" chime)
 
<scrolls back through the posts>

I could be mistaken, but this sounds like a case of getting stuck asking how to build a submarine, without anyone realizing you're just trying to cross a stream.
You just want to switch a scene after an audio file that you created and put into a playlist that plays separately of other files at a set time is played, correct? Or--specifically--as soon as it stops being played?

Honestly, if that's correct, what you're describing is actually better suited to be implemented as a transition in OBS. You want to emulate the idea of a broadcaster ending transmissions by displaying the test card pattern and then resuming with different content. (Again, if I'm understanding this correctly.) Not only can this plugin do what you're asking, it can do it better if you turn the test card into its own transition. I'll let you google the tutorial on that, but what you (probably) want is called a 'Stinger' transition, which is pretty self-explanatory if you open scene transitions, create a new one, and click "Stinger".

Even if you don't do that, it's still possible. (It's just more work) Looking at your previous posts, I will say I'm not aware of any way for it to run conditional statements of media in a playlist, as there is no 'switching to next song' state, or any way to specify the media in the list. However, if you plan to run the same files each time, you could break them up into different playlists at the points where you intended to play the test card and switch scenes. If your playlist is videos "A, B, C, D, test card, E, F, G, H, test card, I, J K, test card" instead make 3 playlists, and simply tell Scene Switcher to change to a different scene at the end of the new, shorter playlist. If you create a stinger transition with the test card, you can remove it from the playlists, and simply tell Scene Switcher to switch scenes using that transition.

If none of those solutions will work for your unique situation, you probably really want to be using a macro that scans video rather than audio. If you're displaying the test card with the 1khz tone, you can just pick the source and either select the file specifically, or pattern match. I've not had reason to play with this one specifically, but it looks pretty straightforward. That one would trigger even if the test card was in the middle of a video file you were playing rather than being its own file. I wouldn't use this option unless I had to, though. It's gonna put more stress on your CPU.

If none of that solves your problem, I'd be very curious to hear the original problem you're trying to solve, rather than the problems you're having attempting to implement a solution.


ha not gonna lie i am super confused by your post, but it may be because it is not what i am wanting to do. you def explained well just not what i was looking for.

i have a live feed that will play a tone like above, and this where a ad break goes. i want that ad break to then play some ads
 
Created a new thread about the cue tones... i created a .bat file, yes no laughing lol

It is doing a decent job so far but def needs tweaked

 

AaronD

Active Member
ha not gonna lie i am super confused by your post, but it may be because it is not what i am wanting to do. you def explained well just not what i was looking for.

i have a live feed that will play a tone like above, and this where a ad break goes. i want that ad break to then play some ads
I'm guessing that the live feed is not produced by this copy of OBS, and so you can't just take the test card out of the system altogether and replace it with the ads?

Also consider that there will probably be a short delay (at least a handful of cycles at that audio frequency), for the trigger to figure out that it even has a valid condition (the more selective an audio filter is, the longer it takes to figure that out, so there's a tradeoff there), and that you should probably have even more delay on purpose just to avoid a false trigger. Meanwhile, during those delays, the audience sees and hears the test card. I wonder if you still need a different solution.

Maybe you can delay the live feed enough that a decently selective and well-debounced filter (that acts on the un-delayed version) can still catch it in time to switch the delayed feed? (similar to a censor beep on live TV, which has the feed delayed enough that a human can still push the button in time)
 

AaronD

Active Member
Created a new thread about the cue tones... i created a .bat file, yes no laughing lol

It is doing a decent job so far but def needs tweaked

Oh, and "The requested thread could not be found," following that link.
 

AaronD

Active Member
appears to be awaiting moderation, it wasnt now it is showing that, which is weird


and it would be a live TV feed actually
A live TV feed has a test card instead of ads? What self-respecting station does that?

Or are YOU the live TV feed? If so, then I'm asking about your input side, not your output.

Maybe we'd better wait until that other thread comes up. This is getting way off topic for the plugin. Sorry to the rest of you!
 
A live TV feed has a test card instead of ads? What self-respecting station does that?

Or are YOU the live TV feed? If so, then I'm asking about your input side, not your output.

Maybe we'd better wait until that other thread comes up. This is getting way off topic for the plugin. Sorry to the rest of you!
seems to be up now, of course on my side... i got a solution that i hope i can work into this plugin
 

AaronD

Active Member
seems to be up now, of course on my side... i got a solution that i hope i can work into this plugin
Works for me too. See you there! I wonder if the mods can move the relevant comments over there and clean this up a bit?

 
Top