Author Topic: Simple Volume command  (Read 1902 times)

Bumble B

  • Jr. Member
  • **
  • Posts: 64
    • Bumble B Gaming
Simple Volume command
« on: October 08, 2018, 03:53:27 AM »
Trying to make a simple volume control command and for some reason sometimes it works other times it doesn't and i cant find the reason why.

I just want to say Volume *number* and whichever ap is running it sets the appilcation audio volume. I had it working and I cant see whats broken with it.

VA v1.7.2

Here is what I've done:
Code: [Select]
Begin Text Compare : [{LASTSPOKENCMD}] Equals '10'
    Set application [Streamlabs Chatbot] audio volume to [10]
    Set application [Pretzel] audio volume to [10]
Else If Text Compare : [{LASTSPOKENCMD}] Equals '20'
    Set application [Streamlabs Chatbot] audio volume to [20]
    Set application [Pretzel] audio volume to [20]
Else If Text Compare : [{LASTSPOKENCMD}] Equals '5'
    Set application [Streamlabs Chatbot] audio volume to [5]
    Set application [Pretzel] audio volume to [5]
Else If Text Compare : [{LASTSPOKENCMD}] Equals '30'
    Set application [Streamlabs Chatbot] audio volume to [30]
    Set application [Pretzel] audio volume to [30]
Else If Text Compare : [{LASTSPOKENCMD}] Equals '40'
    Set application [Streamlabs Chatbot] audio volume to [40]
    Set application [Pretzel] audio volume to [40]
Else If Text Compare : [{LASTSPOKENCMD}] Equals '50'
    Set application [Streamlabs Chatbot] audio volume to [50]
    Set application [Pretzel] audio volume to [50]
Else If Text Compare : [{LASTSPOKENCMD}] Equals '60'
    Set application [Streamlabs Chatbot] audio volume to [60]
    Set application [Pretzel] audio volume to [60]
Else If Text Compare : [{LASTSPOKENCMD}] Contains '70'
    Set application [Streamlabs Chatbot] audio volume to [70]
    Set application [Pretzel] audio volume to [70]
Else If Text Compare : [{LASTSPOKENCMD}] Equals '80'
    Set application [Streamlabs Chatbot] audio volume to [80]
    Set application [Pretzel] audio volume to [80]
Else If Text Compare : [{LASTSPOKENCMD}] Equals 'mute'
    Mute application [*Winamp*] audio
    Mute application [Streamlabs Chatbot] audio
    Mute application [Pretzel] audio
Else If Text Compare : [{LASTSPOKENCMD}] Equals 'unmute'
    Unmute application [*Winamp*] audio
    Unmute application [Streamlabs Chatbot] audio
    Unmute application [Pretzel] audio
End Condition
Play sound, '{VA_SOUNDS}\KICS Sounds\KICS_Beep1.mp3'

Volume [10; 20; 30; 40; 50]

I just say "Volume *number here* "
« Last Edit: October 08, 2018, 04:11:20 AM by Bumble B »
--
CMDR Bumble B ö7
ASUS P6TD Deluxe, Intel i7 960 @ 3.2GHz, 12Gb G.Skill, Windows 7 SP1 (64bit), ASUS Geforce GTX 970 Strix (4Gb), ThrustMaster T-Flight HOTAS X, Cosair Void RGB USB Gaming Headset, TrackIR, EDDI, Voice Attack, ED Engineer

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: Simple Volume command
« Reply #1 on: October 08, 2018, 09:40:27 AM »
There are a several elements that are not going to work in that command.  Gonna shoot from the hip here, as I'm not at my PC.   Essentially, I would try replacing the ENTIRE command's actions with something like this:

Set application [Streamlabs Chatbot] audio volume to [{CMDSEGMENT:1}]
Set application [Pretzel] audio volume to [{CMDSEGMENT:1}]
Play sound, '{VA_SOUNDS}\KICS Sounds\KICS_Beep1.mp3'

This omits the, 'mute, unmute', but those wouldn't have worked anyway (they are not in your spoken phrase).  What this does is it extracts the numeric part of the dynamic command.  The action will convert the token to a number.

Sorry so short...  Hope that helps some, B!

Bumble B

  • Jr. Member
  • **
  • Posts: 64
    • Bumble B Gaming
Re: Simple Volume command
« Reply #2 on: October 08, 2018, 01:09:01 PM »
There are a several elements that are not going to work in that command.  Gonna shoot from the hip here, as I'm not at my PC.   Essentially, I would try replacing the ENTIRE command's actions with something like this:

Set application [Streamlabs Chatbot] audio volume to [{CMDSEGMENT:1}]
Set application [Pretzel] audio volume to [{CMDSEGMENT:1}]
Play sound, '{VA_SOUNDS}\KICS Sounds\KICS_Beep1.mp3'

This omits the, 'mute, unmute', but those wouldn't have worked anyway (they are not in your spoken phrase).  What this does is it extracts the numeric part of the dynamic command.  The action will convert the token to a number.

Sorry so short...  Hope that helps some, B!

Perfect, does what I wanted it to and I can do the mute as separate commands anyways. Been trying to make my scripts more efficient of late.

Once again you guys rock, i come in once in awhile with my little questions and you guys just come up with the goods every time.
--
CMDR Bumble B ö7
ASUS P6TD Deluxe, Intel i7 960 @ 3.2GHz, 12Gb G.Skill, Windows 7 SP1 (64bit), ASUS Geforce GTX 970 Strix (4Gb), ThrustMaster T-Flight HOTAS X, Cosair Void RGB USB Gaming Headset, TrackIR, EDDI, Voice Attack, ED Engineer

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Simple Volume command
« Reply #3 on: October 08, 2018, 03:09:35 PM »


If I may add to that:

You can integrate mute/unmute functionality into the same command:
Volume [1..5,10;mute;unmute]
Code: [Select]
Begin Text Compare : [{CMDSEGMENT:1}] Equals 'mute'
    Mute application [*Winamp*] audio
    Mute application [Streamlabs Chatbot] audio
    Mute application [Pretzel] audio
Else If Text Compare : [{CMDSEGMENT:1}] Equals 'unmute'
    Unmute application [*Winamp*] audio
    Unmute application [Streamlabs Chatbot] audio
    Unmute application [Pretzel] audio
Else
    Set application [Streamlabs Chatbot] audio volume to [{CMDSEGMENT:1}]
    Set application [Pretzel] audio volume to [{CMDSEGMENT:1}]
End Condition
Play sound, '{VA_SOUNDS}\KICS Sounds\KICS_Beep1.mp3'
The command phrase is built so it will extrapolate numeric values from 10 to 50, as in your original example(1..5, multiplied by 10), and adds "mute" and "unmute" to the same segment.

The order of compares is important here, as it's a process of elimination; First you eliminate the options that require separate actions, in this case "mute" and "unmute", once those have 'been checked, the only phrase options remaining should all contain a number, so you can process them without doing additional checks to make sure of that.


The command in the OP cannot work, as you're comparing the spoken phrase to only part of itself:
Code: [Select]
Begin Text Compare : [{LASTSPOKENCMD}] Equals '10'E.G. This would compare "volume 10" to "10", which is not the same literal string.

If you used "Contains" instead, it should work.