bitfocus / companion-module-discord-api

MIT License
5 stars 2 forks source link

[feature requests] Send variable for latest user to chat in a voice channel #27

Open prehprehpreh opened 7 months ago

prehprehpreh commented 7 months ago

I would like to program companion to select a button to switch OBS scenes whenever a specified user chats in the discord.

So for example how I'd use this variable -

Dave is speaking for over 1 seconds, companion then triggers OBS to switch to Dave Talking scene Wesley starts speaking in response to Dave for over 1 second, companion triggers OBS to switch to Wesley talking scene. etc..

You could also use this variable to create cool custom animations within obs for whatever. I wish we had this already!

thedist commented 7 months ago

I like the idea! One potential issue I can see is what if User A starts talking, User B then starts talking while A also is, and then User B stops talking so it's only user A talking again. In that situation the variable would be indicating User B, despite the fact that User A is the one talking at the end it's just they didn't stop/start again.

prehprehpreh commented 7 months ago

I like the idea! One potential issue I can see is what if User A starts talking, User B then starts talking while A also is, and then User B stops talking so it's only user A talking again. In that situation the variable would be indicating User B, despite the fact that User A is the one talking at the end it's just they didn't stop/start again.

That is a good point though.

I wonder if it's possible to detect when they START talking rather than to detect when they ARE talking. That could make triggering stuff a little more linear and not as conflicting.

I could see in my use case, id need some filtering done to keep things from being crazy.

I think regardless of it's use case, being able to fetch the variable "user/Dave/istalking=true or false would be SUPER useful in creating triggers within companion.

I noticed that the there is a voice indicator within the feedbacks when a user talks. I was trying so hard to somehow figure out how to grab that value and use it as a trigger.

Dude also thanks so much for getting back so quick!

thedist commented 6 months ago

I've been trying a few different ideas, and have pushed an update that will be in the next Companion beta build, that you may want to try out and see if it meets your needs.

There's now the variables voice_current_speaker_id, voice_current_speaker_nick, voice_current_speaker_number, as well as the user specific variables voice_user_X_volume, voice_user_X_mute, voice_user_X_self_mute, voice_user_X_self_deaf, voice_user_X_speaking (where X is the index, nick, or ID).

There's also a Speaker Delay option in the settings, which will be the delay before a new speaker is updated on the speaking variables. For example, if Speaker Delay is 0, the moment a user presses their mic the voice_curent_speaker_... will update to them. If they release their mic it'll return to the last recent speaker who's still speaking, and empty when no one is speaking. If I was to set the delay to 500 that would stop someone who just tapped their mic on/off (frequent if using sound activated rather than PTT). If you want to also prevent people who speak just for a 1 word answer like 'yes', 'no', 'uh huh', etc... then you may need a slightly longer delay.

prehprehpreh commented 6 months ago

I've been trying a few different ideas, and have pushed an update that will be in the next Companion beta build, that you may want to try out and see if it meets your needs.

There's now the variables voice_current_speaker_id, voice_current_speaker_nick, voice_current_speaker_number, as well as the user specific variables voice_user_X_volume, voice_user_X_mute, voice_user_X_self_mute, voice_user_X_self_deaf, voice_user_X_speaking (where X is the index, nick, or ID).

There's also a Speaker Delay option in the settings, which will be the delay before a new speaker is updated on the speaking variables. For example, if Speaker Delay is 0, the moment a user presses their mic the voice_curent_speaker_... will update to them. If they release their mic it'll return to the last recent speaker who's still speaking, and empty when no one is speaking. If I was to set the delay to 500 that would stop someone who just tapped their mic on/off (frequent if using sound activated rather than PTT). If you want to also prevent people who speak just for a 1 word answer like 'yes', 'no', 'uh huh', etc... then you may need a slightly longer delay.

Dude! Awesome!! I'm gonna try it out now!! Thank you so much for implementing this!!