News:

If you have an Android device, check out VoxWav!

Main Menu

Soft Mute Only if media is playing?

Started by ddl, November 29, 2013, 11:25:21 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ddl

I have the following greeting setup in VC.  I would like to modify this greeting so that a softmute will only take place if XBMC or WMC is active.  Can someone help me with the logic if this can be done?

Thanks

<?xml version="1.0" encoding="utf-16"?>
<command id="367" name="Greet computer" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)Contains(B)</ifType>
    <ifParams>{1}&amp;&amp;morning</ifParams>
    <then>
      <action>
        <cmdType>TTS.SpeakSync</cmdType>
        <cmdString>Good morning.  who am I speaking to?</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)Contains(B)</ifType>
    <ifParams>{1}&amp;&amp;afternoon</ifParams>
    <then>
      <action>
        <cmdType>TTS.SpeakSync</cmdType>
        <cmdString>Good afternoon. who am I speaking to?</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)Contains(B)</ifType>
    <ifParams>{1}&amp;&amp;evening</ifParams>
    <then>
      <action>
        <cmdType>TTS.SpeakSync</cmdType>
        <cmdString>Good evening. who am I speaking to?</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)Contains(B)</ifType>
    <ifParams>{1}&amp;&amp;hi</ifParams>
    <then>
      <action>
        <cmdType>TTS.SpeakSync</cmdType>
        <cmdString>Hello ddl! how may i help you?| Hello ddl! whats up| Yes, ddl| ddl, whats up!</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <action>
    <cmdType>VC.EnableGroup</cmdType>
    <cmdString>Program one</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <payloadList optional="true">good morning, good afternoon, good evening, hi, hey, whats up</payloadList>
  <phrase>kathy</phrase>
</command>

Kalle

#1
Hi ddl, here a example:

create this two logic blocks at the begin of your command

IF (ProcessRunning) ->xbmc.exe
THEN -> (action)XBMC.SoftMute - (parameter) the percent of the current XBMC volume to wish reduce (for example 30)

IF (ProcessRunning) ->wmc.exe
THEN -> (action)WMC - (parameter) volume Mute

and at the end of your whole command the next two actions

(action)XBMC.SoftUnMute

(action)WMC - (parameter) volume UnMute

(I think for WMC is no softmute available, but you can simulate this with one of following parameters in the action for WMC above: volume 0-50|Up|Down|Mute|UnMute

Please take also a look here in our Wiki: http://voxcommando.com/mediawiki/index.php?title=Logic_Block

I hope this will help you a bit
***********  get excited and make things  **********

jitterjames

#2
I think WMC volume is locked to system volume, so you would be able to use the Sound.PartialMute but of course this would also mute your TTS.  If possible then it would probably be better to pause the WMC audio.  Or if your TTS uses a different output you are probably OK since system sound only affects the default audio output.

ddl

Thanks all for the quick response.  I will try the suggested and report back if necessary.  Thanks again.


ddl

Hi all,

Tried the suggestion but can't seem to get it to work.  Did I leave something out?  I also verified the Media names as suggested in the wiki.  Please advise.

<?xml version="1.0" encoding="utf-16"?>
<command id="367" name="Greet computer" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>ProcessRunning</ifType>
    <ifParams>XBMC&amp;&amp;</ifParams>
    <then>
      <action>
        <cmdType>XBMC.SoftMute</cmdType>
        <cmdString>20</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>ProcessRunning</ifType>
    <ifParams>ehshell&amp;&amp;</ifParams>
    <then>
      <action>
        <cmdType>WMC</cmdType>
        <cmdString>Volume Mute</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)Contains(B)</ifType>
    <ifParams>{1}&amp;&amp;morning</ifParams>
    <then>
      <action>
        <cmdType>TTS.SpeakSync</cmdType>
        <cmdString>Good morning.  who am I speaking to?</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)Contains(B)</ifType>
    <ifParams>{1}&amp;&amp;afternoon</ifParams>
    <then>
      <action>
        <cmdType>TTS.SpeakSync</cmdType>
        <cmdString>Good afternoon. who am I speaking to?</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)Contains(B)</ifType>
    <ifParams>{1}&amp;&amp;evening</ifParams>
    <then>
      <action>
        <cmdType>TTS.SpeakSync</cmdType>
        <cmdString>Good evening. who am I speaking to?</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)Contains(B)</ifType>
    <ifParams>{1}&amp;&amp;hi</ifParams>
    <then>
      <action>
        <cmdType>TTS.SpeakSync</cmdType>
        <cmdString>Hello ddl! how may i help you?| Hello ddl! whats up| Yes, ddl| ddl, whats up!</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>ProcessRunning</ifType>
    <ifParams>XBMC&amp;&amp;</ifParams>
    <then>
      <action>
        <cmdType>XBMC.SoftUnMute</cmdType>
        <cmdString />
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>ProcessRunning</ifType>
    <ifParams>ehshell&amp;&amp;</ifParams>
    <then>
      <action>
        <cmdType>WMC</cmdType>
        <cmdString>Volume Unmute</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <action>
    <cmdType>VC.EnableGroup</cmdType>
    <cmdString>Program one</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <payloadList optional="true">good morning, good afternoon, good evening, hi, hey, whats up</payloadList>
  <phrase>kathy</phrase>
</command>

Kalle

What shows the history in VC after execute this command?
I'm not sure but please test it with xbmc.exe and ehshell.exe and let us know if it works.
***********  get excited and make things  **********

jitterjames

Quote from: ddl on November 30, 2013, 12:29:14 PM
Tried the suggestion but can't seem to get it to work.

Please tell us what you mean by this.

jitterjames

XBMC actions are for EDEN only, if you are using Frodo you should use XJson.SoftMute

Kalle

***********  get excited and make things  **********

ddl

JitterJames,

The XJSON command for XBMC did the trick.  It now works for XBMC.  However, still unable to get the command to work for WMC. 

ddl

If someone tell me how to take a screen shot of the history.  I will.  When I press the CTRL + Print Screen button and try to paste it in this thread.  Nothing happens.

jitterjames

#11
You need to create an image that is saved to a jpg file and then upload that as an attachment.

It would be easier and better to upload a log.

Stop saying "it does not work" without explaining what you mean! Stop stop stop doing that!!!  Explain in detail what you are doing and what happens. What do you expect to happen, what happens instead, do you see an error in the log etc.

Read the forum rules!!!

Do you generally have wmc commands set up and working correctly in other commands?

nime5ter

#12
I have tested your command and it works exactly as expected for me, based on what James mentioned earlier about WMC using the system volume.

What happens for me with your command is that when music is playing in WMC the command mutes the (system) volume entirely, so the music is muted and the TTS is also muted. At the end of the command the volume is unmuted and I can hear my music again.

To test that the command is working, I added an OSD.ShowText to the TTS, and when the volume is muted I can still see this message.

For this reason, James made various suggestions above about alternative options apart from using mute. In general, I know he has recommended to other users that it's best when TTS uses a different audio output from media players (for example, see his post here: http://voxcommando.com/forum/index.php?topic=1280.msg11054;topicseen#msg11054).

WMC's functionality is generally quite limited compared to other media players, so there may not be a lot of VC users with experience getting around its quirks.

If the command is working for you as I described above, then it is technically "working". It's just not doing what you would like because of the limitation of WMC.

If it's *not* functioning as above, one key question is whether you have WMC set up properly with VC. As James asked previously: do other WMC commands work for you in VoxCommando? That is, have you installed the VMC Controller plugin for WMC, as per the instructions on the VoxCommando wiki? (http://voxcommando.com/mediawiki/index.php?title=Installation_WMC)

Edit: I forgot to say that I tried James's suggestion earlier in this thread of using a 'pause'/'play' (playrate pause, playrate play) instead of mute, since I am using a laptop and don't have different audio output options. This works, but isn't perfect because play/pause turns out to be a toggle in WMC, not a genuine play or pause action. This means that if music is playing when you issue your Greet Computer command, the song will pause, you get your appropriate tts, then the music plays again exactly as desired. However, if WMC is running but a song is not currently playing, this action will cause a queued track to *start* playing, even if it wasn't before. You may not mind that. If so, that may be the easiest compromise solution.
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)