WSR Macro: Control Windows Media Player with your voice!

Have you ever wanted to control your media player with your voice? Well now you can! With today’s Macro of the Day, you can say things like “Play Hotel California”, or “Play The Eagles”, or, “Play Genre Rock”, and even “Play something by The Eagles”. Rob Chambers created a WSR Macros, that demonstrates some neat concepts like clarification, […]

Have you ever wanted to control your media player with your voice? Well now you can! With today’s Macro of the Day, you can say things like “Play Hotel California”, or “Play The Eagles”, or, “Play Genre Rock”, and even “Play something by The Eagles”. Rob Chambers created a WSR Macros, that demonstrates some neat concepts like clarification, using named states, Jscript, and for the first time, it demonstrates the wmpMediaControl, wmpMediaPlay, and wmpMediaItems XML elements from the WSR Macro schema.

Let’s take a look at the first command in the macro, and the one I use the most:

<command> 
    <listenFor>play ?the artist [Artists]</listenFor> 
    <listenFor>play ?the band [Artists]</listenFor>
    <listenFor>play ?the group [Artists]</listenFor>
    <setTextFeedback>Playing Artist {[*Artist]}</setTextFeedback> 
    <wmpMediaControl command="pause"/>
    <disambiguate title="Which artist do you want to play?" prompt="Choose an Artist" timeout="25" propname="Artist"/>
    <setState name="playMediaTypeName" value="Artist"/> 
    <setState name="playMediaTypeValue" value="{[*Artist]}"/>
    <setState name="playMediaAttrName" value="WM/AlbumArtist"/>
    <setState name="playMediaAttrValue" value="{[Artist]}"/>
    <emulateRecognition>Play what I asked for</emulateRecognition>
</command>

This command listens for a few different ways to say “Play the artist [artist]”. When that, or one if it’s alternatives is recognized, the macro set’s the text feedback, tells the Media Player to pause, and then prompts the user if necessary to clarify (or disambiguate as we say inside the Speech group). After which, it sets a few named states to keep track of the last verbal request, and then emulates “Play what I asked for”.

Full Article