Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

How to change MediaMonkey audio out and Marantz audio input

If you have a question or need help, this is the place to be.
Post Reply
Bleazle
Posts: 4
Joined: Sun Mar 30, 2014 8:12 pm

How to change MediaMonkey audio out and Marantz audio input

Post by Bleazle »

Hi All...

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) :D

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 :cry: )
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" :D
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. :D

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 :P
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:
Image

How to run a VBS script:
Image

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):
Image

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

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:
Image

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:
Image

Done. Easy! :D
Attachments
Files.zip
(228.74 KiB) Downloaded 150 times
Last edited by Bleazle on Thu May 01, 2014 6:09 am, edited 2 times in total.
blaher
Experienced User
Posts: 487
Joined: Thu Nov 17, 2011 1:27 am

Re: How to change MediaMonkey audio out and Marantz audio in

Post by blaher »

Thanks for that, looks pretty cool.
Is there any advantage to running a vbs script to change the audio, as opposed to doing it in EG, like in the pic below?
Attachments
Capture.PNG
V_J
Experienced User
Posts: 165
Joined: Tue Mar 04, 2014 9:00 am

Re: How to change MediaMonkey audio out and Marantz audio in

Post by V_J »

Nice one!

I'm planning something similar, but rather than change the output configuration of the playback software, I plan to use WinAmp: it can run multiple instances at the same time, and EventGhost can distinguish between them. This way, I have an instance for the main zone, and one for zone A. In this thread are my ideas and considerations (and the link to an updated winamp .py file):
viewtopic.php?f=2&t=6050
In the thread is also an idea to prevent the computer of going to sleep/hibernate when it is just playing music, and to prevent the screensaver from triggering (screensaver/powersave also kills hdmi audio output).

I also added many commands to the MarantzSerial plugin, as I want to fully control my SR6001 from a web interface:
viewtopic.php?f=9&t=747&start=15#p30399
It is no longer compatible with MarantSerial, but you can copy/paste what you need (structure of the actions is the same), to save some typing. :-)

Thanks for the heads-up on the SR6004 not being able to play back digital output through zone A, mine might have the same issue. I was thinking of using the digital out of my soundcard for zone A, and then perhaps some other zone with the analog output of the soundcard, but Then I may need the same workaround you have.

I plan to have webinterfaces for all, so the exact playback software (mediamonkey, winamp, ...) is not such an issue for me; the only argument for me is how well it integrates with EventGhost (and then particularly the multiple instances thing). Of course, I could also use one software for the main zone, and another for zone A, but using the same software felt more elegant. :)
Bleazle
Posts: 4
Joined: Sun Mar 30, 2014 8:12 pm

Re: How to change MediaMonkey audio out and Marantz audio in

Post by Bleazle »

@blaher - I didn't know you could do it that way (I've only been using EG for a week) but looking at your Macro I'd say the advantage to anyone setting this up from scratch is that running the VBS script only requires one action to be set up compared to the 7 that your Macro uses. Apart from that it looks like both methods achieve the same result.

@V-J: Running 2 instances of WinAmp sounds like a nice, straight forward way to go. Unfortunately it wasn't an option for me because I wanted more than just the ability to play music - I use MediaPortal for TV, movies, online videos, music, news, weather etc so I needed an option where MediaPortal could be used inside while music was being played outside. I looked at all sorts of software for playing music separately to MediaPortal and MediaMonkey, when combined with VoxCommando and the MediaMonkey Remote Android App was by far the best option for me.
V_J wrote:...Thanks for the heads-up on the SR6004 not being able to play back digital output through zone A, mine might have the same issue. I was thinking of using the digital out of my soundcard for zone A, and then perhaps some other zone with the analog output of the soundcard, but Then I may need the same workaround you have.
Zone A is the secondary zone so it sounds like all you need to do is connect your digital output to the main zone and the analog output to Zone A. Does your amp have a Zone B option? Mine does (but I don't use it) and according to the manual (which I had to dust off... :D ) Zone B accepts digital (both optical and coaxial) sources. That would mean connecting into another amp and my house isn't big enough to justify this but yours might be?
V_J
Experienced User
Posts: 165
Joined: Tue Mar 04, 2014 9:00 am

Re: How to change MediaMonkey audio out and Marantz audio in

Post by V_J »

I plan to launch the winamp when music playback is required. For movies, I currently use MPC-HC, but no system like MediaPortal. I plan to switch to it though. But I chose different programs for different purposes: music via winamp (regardless of the room), movies via something else (I have used MCE, and combined with MediaBrowser, it also works).

Bleazle wrote: Zone A is the secondary zone so it sounds like all you need to do is connect your digital output to the main zone and the analog output to Zone A. Does your amp have a Zone B option? Mine does (but I don't use it) and according to the manual (which I had to dust off... :D ) Zone B accepts digital (both optical and coaxial) sources. That would mean connecting into another amp and my house isn't big enough to justify this but yours might be?
I currently use hdmi for the main zone, and analog for zone A. Mine only has a single extra zone, zone A, so maybe it will support optical... I'll have to test it, or blow the dust or my manual. My apartment is not big, I plan to use Zone A for the kitchen. If I could use optical for zone A, it leaves the analog output of the pc open: an extra analog output could be useful for e.g. wireless headphones, or audio to bedroom.
blaher
Experienced User
Posts: 487
Joined: Thu Nov 17, 2011 1:27 am

Re: How to change MediaMonkey audio out and Marantz audio in

Post by blaher »

Bleazle wrote:@blaher - I didn't know you could do it that way (I've only been using EG for a week) but looking at your Macro I'd say the advantage to anyone setting this up from scratch is that running the VBS script only requires one action to be set up compared to the 7 that your Macro uses. Apart from that it looks like both methods achieve the same result.
I found a more direct way than the keypress kind of solution the others used:
http://blog.hemp-society.de/2012/12/sho ... tings.html

I use the same tiny program to turn my monitor off, because unlike EG's monitor off, you can do it when windows is 'locked'.
Attachments
Capture.PNG
Bleazle
Posts: 4
Joined: Sun Mar 30, 2014 8:12 pm

Re: How to change MediaMonkey audio out and Marantz audio in

Post by Bleazle »

Thanks for the screenshot and the link - I haven't got time to look at it tonight but I had a quick skim through and it looks like there's some good stuff there (for me to play around with..) :D

@V_J: It'll be interesting to see what you come up with and how you achieve it.

Cheers!
V_J
Experienced User
Posts: 165
Joined: Tue Mar 04, 2014 9:00 am

Re: How to change MediaMonkey audio out and Marantz audio in

Post by V_J »

So far; I only have small test configs, that have different aspects. I then got a bit sidetracked with expanding the Marantz plugin. I don't know websockets, which means it may take some time to make a nice webinterface.
But to have something in the mean time, I will only implement the music aspects and will use AjaxAmp to offer a web interface to Winamp. I'll also not make a webinterface to fully control the marantz at this time. I suspect making a small page with a few links and a frame for AjaxAmp could go quite fast. I'm currently travelling, but want to finish this solution in the week after this week. Of course, I'll post my config then!

J├Ârg
V_J
Experienced User
Posts: 165
Joined: Tue Mar 04, 2014 9:00 am

Re: How to change MediaMonkey audio out and Marantz audio in

Post by V_J »

Back to square one for me... I tried to make a quick interface using AjaxAmp or BrowseAmp, to give me a web interface for Winamp, but it doesn't work so well (occasional delays, web server settings that are not retained, ...).

So I will have to make my own web interface, interfacing everything via Eventghost (not the applications' interfaces). My html is a bit rusty :) , my css non-existing and websockets are something I just learned existed. So it will take me a bit of time to figure everything out. I suspect once I get one thing working, the rest will be similar. The Tornado plugin thread contains a simple example that ought to get me started, and the musicbee example should help a lot.

I also have to rethink my strategy: hdmi sometimes switches off, and I have no idea why (amplifier shows it gets no signal), I wonder if it is hdcp kicking in. And I cannot get it back without logging on to the console (this is a problem, as the pc is only connected to a projector, so logging in implies lowering a screen, and switching on the projector - and they don't like frequent on/off cycles). Also, I learned that audio from a hdmi input cannot be passed to the zone A output, nor any other digital input. So it is back to the drawing board: first a plan of what I want, then checking on how to achieve it, I already have your loopback idea in mind :-). As I will be busy with work, I think it may take me some weeks... I feel I have all the components to make it work, it just needs that extra push... :-)
I have a good idea on some connections, but I'll first direct my attention at making a webinterface. Once that is up and running, I can more easily see how to combine things.
Bleazle
Posts: 4
Joined: Sun Mar 30, 2014 8:12 pm

Re: How to change MediaMonkey audio out and Marantz audio in

Post by Bleazle »

Here is a link to a better way to do what I listed in my first post provided by James at VoxCommando using EventGhost to do the work under the hood... :D
Post Reply