Author Topic: Soft Mute Only if media is playing?  (Read 3427 times)

0 Members and 1 Guest are viewing this topic.

ddl

  • Sr. Member
  • ****
  • Posts: 118
  • Karma: 0
    • View Profile
Soft Mute Only if media is playing?
« on: November 29, 2013, 11:25:21 PM »
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

Code: [Select]
<?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>
« Last Edit: November 30, 2013, 11:29:54 AM by ddl »

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Soft Mute Only if media is playing?
« Reply #1 on: November 30, 2013, 02:08:45 AM »
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
« Last Edit: November 30, 2013, 07:26:21 AM by Kalle »
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Soft Mute Only if media is playing?
« Reply #2 on: November 30, 2013, 09:53:15 AM »
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.
« Last Edit: November 30, 2013, 11:12:55 AM by jitterjames »

ddl

  • Sr. Member
  • ****
  • Posts: 118
  • Karma: 0
    • View Profile
Re: Soft Mute Only if media is playing?
« Reply #3 on: November 30, 2013, 11:30:31 AM »
Thanks all for the quick response.  I will try the suggested and report back if necessary.  Thanks again.


ddl

  • Sr. Member
  • ****
  • Posts: 118
  • Karma: 0
    • View Profile
Re: Soft Mute Only if media is playing?
« Reply #4 on: November 30, 2013, 12:29:14 PM »
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.

Code: [Select]
<?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

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Soft Mute Only if media is playing?
« Reply #5 on: November 30, 2013, 01:23:42 PM »
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

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Soft Mute Only if media is playing?
« Reply #6 on: November 30, 2013, 01:36:31 PM »
Tried the suggestion but can't seem to get it to work.

Please tell us what you mean by this.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Soft Mute Only if media is playing?
« Reply #7 on: November 30, 2013, 01:39:37 PM »
XBMC actions are for EDEN only, if you are using Frodo you should use XJson.SoftMute

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Soft Mute Only if media is playing?
« Reply #8 on: November 30, 2013, 02:13:20 PM »
sorry my fault  :bonk
***********  get excited and make things  **********

ddl

  • Sr. Member
  • ****
  • Posts: 118
  • Karma: 0
    • View Profile
Re: Soft Mute Only if media is playing?
« Reply #9 on: November 30, 2013, 03:58:27 PM »
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

  • Sr. Member
  • ****
  • Posts: 118
  • Karma: 0
    • View Profile
Re: Soft Mute Only if media is playing?
« Reply #10 on: November 30, 2013, 04:37:20 PM »
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

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Soft Mute Only if media is playing?
« Reply #11 on: November 30, 2013, 04:46:21 PM »
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?
« Last Edit: November 30, 2013, 09:57:58 PM by jitterjames »

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Soft Mute Only if media is playing?
« Reply #12 on: December 01, 2013, 10:02:48 AM »
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.
« Last Edit: December 01, 2013, 11:12:47 AM by nime5ter »
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)