Like a lot of MediaMonkey users I wanted to be able to change MM's audio output "on the fly" and since we are well into the "20-teens" now obviously this had to be voice activated. Unfortunately this can't be done via a script in MM or even with a hot key so when I came across EventGhost last week I decided to see if it could do the job. The answer was yes...eventually. After a lot of searching and tweaking I have achieved the goal of voice command controlled audio output switching in MediaMonkey plus speaker selection via the Marantz amplifier (also voice controlled)
EDIT: Here is a link to a better way to do what I have listed here. I'll leave all this info though because it might help someone achieve something else...
Some of the information below is available in other parts of this site but bringing it together saves anyone who is interested in doing this from having to search "how to run a VBS script in EventGhost" (for example). Ignore the information regarding the Marantz amp if this isn't of interest.
My HTPC setup:
MediaPortal & MediaMonkey with an AMD card and an on-board Realtek sound card.
VoxCommando to enable voice control of the HTPC.
Marantz SR6004 Amplifier with ZoneA set up as my outside/deck speakers
Harmony One remote (which doesn't get used much thanks to VoxCommando)
Connections:
AMD card to Amplifier via HDMI
Realtek card to amplifier via speaker cables going into BD audio in (for use in ZoneA because ZoneA won't accept a digital input
NOTE: To trick the amp into playing sound from the AMD/HDMI input I have looped speaker cables from "audio out" back into "DVD in"
RS-232 Serial cable connects the HTPC to the amplifier (NOTE: You have to set the "standby" option on the amplifiers menu to "normal" if you want to be able to turn your amplifier on via EventGhost)
Android phone running:
VoxWav Pro - turns your phone into a smart microphone.
MediaMonkey Remote. Voice commands are great but if you're sitting on the deck talking to a friend talking to your phone to change the music isn't really socially correct. The combination of these 2 control options works well.
I use MediaMonkey for playing music and MediaPortal for playing anything, including music (but not very often). I prefer to use MediaMonkey for playing music because I can control it via VoxCommando and/or MediaMonkey Remote from anywhere on my WiFi network plus it has several extra features over MP that I like, including AutoRate. MediaPortal can also be controlled by VoxCommando but having a separate software package playing music means that MediaPortal can be used inside the house while MediaMonkey is playing music outside at the same time.
These are the different scenarios I wanted to be able to achieve via voice commands:
- Turn the amp on and off (if I'm on the deck having a beer I don't want to have to go inside to turn the amp on...)
- Have music playing inside and outside (eg. party). Or if I walk outside I want to be able to turn the outside speakers on while leaving the inside speakers on.
- Have no music playing from MediaMonkey inside the house while music is playing outside. This will allow someone to watch TV, movies and even different music via MediaPortal inside while playing music outside via MediaMonkey.
How it was achieved:
The breakthrough came when I figured out that I could get EventGhost to overwrite the MediaMonkey.ini file via a VBS script which changes the audio output on the fly (more or less - MediaMonkey has to be closed and then re-opened). To achieve this I set MM's audio output to AMD and saved a copy of the .ini file, then I did the same with the Realtek option. From there it just took a few hours of tweaking to fine tune everything...
NOTES:
1. The "Broadcast" events shown in the images below are voice commands coming from VoxCommando. These events could be from a remote. See this page to see how to use VoxCommando in EventGhost. I highly recommend this option.
2.a) The TTS changes noted below ( using a VBS script which runs keystrokes - EDIT: Check out this post below by blaher - this is how I am setting the TTS speakers now. No VBS script is required and because keystrokes aren't being emulated I have been able to cut out the 5 sec "wait" Action) are required because when MediaMonkey is only playing via the outside speakers I don't want VoxCommando announcements coming from the inside speakers. If you're still using a remote you can skip this part
b) If you do need to use the Speakers_2_Digital.vbs and the Digital_2_Speakers.vbs files set them up to run and then test them from EventGhost. You will see what they do when the "TTS Audio Output" option window opens. Depending on the number of audio output options you have you may need to change the number of key strokes being activated in the script. To do this open the VBS file in Notepad and make the required changes.
3. I use the MarantzSerial Plugin (C:\Program Files (x86)\EventGhost\plugins\MarantzSerial) but I modified it to tell it what volume levels I wanted the amp set to and what the audio input source is (see attached file: _init_.py). The part I added is called "Zone Selection". I had never seen a Python script before doing this but modifying this bit of code is straightforward. See that attached Marantz RS232 Command file if you need to make tweaks to suit your setup.
4. Edit the following text highlighted in blue below in the loadRealtekOutput.vbs & loadStandardOutput.vbs files. These are the scripts that replace the MediMonkey.ini file so point them to the two different ini files you will have created and saved earlier if you're following along...(NOTE: In Windows 7 MM's ini file is here: C:\Users\User Name\AppData\Roaming\MediaMonkey\Myinifiles):
Const DestinationFile = "C:TARGET FILE LOCATION\MediaMonkey.ini"
Const SourceFile = "C:LOCATION OF INI FILE TO BE USED\MediaMonkey.ini"
Set fso = CreateObject("Scripting.FileSystemObject")
'Check to see if the file already exists in the destination folder
If fso.FileExists(DestinationFile) Then
'Check to see if the file is read-only
If Not fso.GetFile(DestinationFile).Attributes And 1 Then
'The file exists and is not read-only. Safe to replace the file.
fso.CopyFile SourceFile, "C:TARGET FILE LOCATION\MediaMonkey.ini", True
Else
'The file exists and is read-only.
'Remove the read-only attribute
fso.GetFile(DestinationFile).Attributes = fso.GetFile(DestinationFile).Attributes - 1
'Replace the file
fso.CopyFile SourceFile, "C:TARGET FILE LOCATION\MediaMonkey.ini", True
'Reapply the read-only attribute
fso.GetFile(DestinationFile).Attributes = fso.GetFile(DestinationFile).Attributes + 1
End If
Else
'The file does not exist in the destination folder. Safe to copy file to this folder.
fso.CopyFile SourceFile, "C:TARGET FILE LOCATION\MediaMonkey.ini", True
End If
Set fso = Nothing
I assume anyone who has read this far already knows how to add Plugins, Macros and Actions in EventGhost and a picture tells a 1,000 words so here is my current setup:
List of Plugins and Macros - The Broadcaster plugin is used for VoxCommando commands. The Keyboard plugin is only required if the TTS audio output settings need to be changed. All amplifier settings are achieved using the MarantzSerial plugin. MediaMonkey is stopped using the MediaMonkey plugin. I use "Actions->System->Start Application" to start MediaMonkey because when I was setting everything up I was using TeamViewer which cases MM to crash so I had to point to the non-skinned MM.exe file to test things and I got sick of renaming the 2 exe files. The VBS scripts are run as shown below using the "Actions->System->Start Application" action. The "wait" action can be found in "Actions -> EventGhost -> Wait some time". "Outside" and "deck" speakers refers to the same set of speakers but I have named the Macros differently to tie in with the voice commands that I use in VoxCommando:

How to run a VBS script:

Turn the "deck" speakers on - Outputs MediaMonkey music and VoxCommando responses to both the inside and outside speakers via the AMD card. Actions: Sets the amp volume to -20db, turns the deck speakers on, sets the audio source to DVD (which is the AMD card loop noted above) and sets the output of the deck speakers to -14db (relative to the inside speakers):

Turn the "deck" speakers off - Turns the speakers off and (re)sets the amplifier volume to -20db (just in case it has been changed):

Turn the "outside" speakers on - Only outputs MediaMonkey music and VoxCommando responses to the outside speakers via the Realtek card. This allows TV, movies and music from MediaPortal to be played on the inside speakers at the same time. Actions: Closes MediaMonkey, loads the MediaMonkey ini which uses the Realtek card by pointing to the loadRealtekOutput.vbs file, sets TTS audio out to Realtek out by pointing to the Digital_2_Speakers.vbs file, sets the amplifier volume to -20db, turns the deck speakers on, sets the input source of the outside speakers to "BD" (which is where the Realtek speaker output is plugged into), sets the output of the deck speakers to -20db (relative to the inside speakers) then restarts MediaMonkey:

Turn the "outside" speakers off - Turns the outside speakers off and outputs MediaMoneky music and VoxCommando responses to the inside speakers via the AMD card. Actions: Closes MediaMonkey, loads the standard MediaMonkey ini which uses the AMD card by pointing to the loadStandardOutput.vbs file, sets TTS audio out to AMD by pointing to the Speakers_2_Digital.vbs file, turns the outside speakers off, sets the amplifier volume to -20db, then restarts MediaMonkey:

Done. Easy!