Showing posts with label HTPC Project. Show all posts
Showing posts with label HTPC Project. Show all posts

Thursday, February 19, 2009

Switching audio output device on HTPC via Harmony remote

In my HTPC setup, I have two audio output devices connected; The first is my plasma TV via HDMI and the second is my home theater sound system via optical S/PDIF connection. Now normally, I will pipe the audio from the PC via my TV speakers for TV and general purpose use (such as Skype conferencing, watching youTube videos, some games etc). On the occasions where I'm listening to my music collection or watching movies, I will want to switch over to my 6.1 home theater sound system.

Unfortunately, there is no OOTB feature provided in Windows, VMC or the IR receiver software (SoundTech iMon) to allow me to switch the audio outputs via the remote. Hence I will have to use the mouse to enter the dreaded Windows interface, call up the audio devices control panel applet and change it manually. Typically, a five minutes process not including the need to walk up to my HTPC since I don't have a wireless mouse handy. Bummer!

Fortunately, you can maintain your couch potato laziness (and maximise your investment in the expensive Harmony remote!) by using a combination of AutoHotKey (a Windows scripting engine) and custom commands in iMon.

Here's how it works:
  1. An AutoHotKey script will be running on the PC at all times waiting for certain keyboard shortcut to be triggered. In my case, CTRL+F5 to trigger HDMI output and CTRL+F6 to trigger S/PDIF.
  2. Map two unused remote keys via the iMon custom command feature to CTRL+F5 and CTRL+F6 respectively. In my case, star (*) key to trigger CTRL+F5 and sharp (#) key to trigger CTRL+F6.
  3. In summary, when you hit the (*) or (#) keys on the Harmony (or MCE for that matter) remote, the iMon software will capture it and send the respective CTRL+F5 or CTRL+F6 keyboard shortcut in Windows. The AutoHotKey script will pick it up and execute the main sequence to open the audio device control panel applet, select the right audio output device and close (my script actually does more than that like sanity checks and reopening VMC if it is open at the time the script is called).

And here's how to get it working on your setup:
  1. Download and install AutoHotKey.
  2. Download and extract the two necessary addon scripts (COM standard library and Vista Audio Control Functions) to the \Lib folder (create if its not already present) of AutoHotKey's program folder. These two addon scripts are needed to enable AutoHotKey to talk to the Vista audio device APIs.
  3. Now create a text file with name "Audio device switch helper.ahk" and copy the following text into it:
    ; CTRL+F5 = Change audio device to Digital Output
    ^F5::
    ; check if HDMI output is already set
    COM_Init()
    device := VA_GetDevice()
    device_name := VA_GetDeviceName(device)
    COM_Release(device)
    COM_Term()

    vmcOpen := "nothing"

    if InStr(device_name, "Digital")
    {
    ;already set, so lets pop a message and return
    if WinActive("ahk_class eHome Render Window")
    {
    vmcOpen := "VMC Open"
    WinMinimize
    }
    SplashTextOn, 250, , Digital audio output already selected
    Sleep, 1500
    SplashTextOff
    ; TrayTip, ,Digital audio output already selected, 10,1
    if InStr(vmcOpen, "VMC Open")
    {
    WinMaximize, ahk_class eHome Render Window
    }
    return
    }

    if WinActive("ahk_class eHome Render Window")
    {
    vmcOpen := "VMC Open"
    ; Close application with Alt-F4
    WinClose
    ;Send !{F4}
    }

    Run, mmsys.cpl
    WinWait,Sound
    ControlSend,SysListView321,{Down 2}
    Sleep, 200
    ControlClick,&Set Default
    ControlClick,OK

    if InStr(vmcOpen, "VMC Open")
    {
    Run, C:\Windows\ehome\ehshell.exe, , max
    }
    return

    ; CTRL+F6 = Change audio device to HDMI Output
    ^F6::
    ; check if HDMI output is already set
    COM_Init()
    device := VA_GetDevice()
    device_name := VA_GetDeviceName(device)
    COM_Release(device)
    COM_Term()

    vmcOpen := "nothing"

    if InStr(device_name, "HDMI")
    {
    ;already set, so lets pop a message and return
    if WinActive("ahk_class eHome Render Window")
    {
    vmcOpen := "VMC Open"
    WinMinimize
    }
    SplashTextOn, 250, , HDMI audio output already selected
    Sleep, 1500
    SplashTextOff
    ; TrayTip, ,HDMI audio output already selected, 10,1
    if InStr(vmcOpen, "VMC Open")
    {
    WinMaximize, ahk_class eHome Render Window
    }
    return
    }


    ; check if VMC is open, if yes, close it
    if WinActive("ahk_class eHome Render Window")
    {
    vmcOpen := "VMC Open"
    ; Close application with Alt-F4
    WinClose
    ;Send !{F4}
    }

    Run, mmsys.cpl
    WinWait,Sound
    ControlSend,SysListView321,{Down 3}
    Sleep, 400
    ControlClick,&Set Default
    ;Sleep, 1000
    ControlClick,OK

    ;if vmc was open previously, we open it again
    if InStr(vmcOpen, "VMC Open")
    {
    Run, C:\Windows\ehome\ehshell.exe, , max
    }
    return
  4. Notice that in the above code, there are two lines with text in red. You will need to change them according to the order your devices are listed in the audio device control panel applet! So for example, in my case, my HDMI audio device is the first item in the list while the S/PDIF audio device is listed fourth. So to switch between them, the script will need to move up three items to select HDMI (assuming the current selection is at S/PDIF) and move down three items to select S/PDIF (assuming that the current selection is at HDMI).
  5. Save the script and test it (double click on the file to launch).
  6. Once you have it working, open up iMon manager and select "Custom Command" on the left.
  7. Click on the "Add" button, give the new function a name (e.g. "Select HDMI Audio"), configure the shortcut CTRL+F5, followed by selecting the remote key STAR.
  8. Click on the "Add" button again, give the new function a name (e.g. "Select S/PDIF Audio"), configure the shortcut CTRL+F6, followed by selecting the remote key SHARP.
  9. Now select "Program Command" followed by selecting "XPMediaCenter" as the program and finally, remove the (*) and (#) keys from the mapping. You need to do this to allow the custom command to work when VMC is the active application.
  10. Click on "OK"
  11. At this point, you should be able to start using the (*) and (#) keys on the remote to switch between the two audio outputs.
  12. To enable this feature to survive a reboot, add a shortcut to this script in the "Startup" folder of all users.
For those with a Harmony remote, you can add these keys into the startup sequence of your activities so that you don't even need to manually click the (*) or (#) buttons! e.g. in my case, when I start the "Watch Movie" or the "Listen to Music" activities, at the end of the startup sequence, a (#) key will be sent to ensure that the S/PDIF audio output is selected.

Ahhh.... a true couch potato's blessing indeed!

Thursday, October 23, 2008

HTPC Update: TV Signal Strength Checker

If you need a tool to help you find the best location to place your aerial for receiving over-the-air (OTA) DVB-T broadcasts, check out TSReader. It comes in three different flavors (Lite, Standard and Professional) but the Lite version (which is FOC btw) is good enough for this purpose.

After you have installed the software, launch it via the Start\All programs menu. The first time you run the program, you will be asked to select an input source. This refers to your TV Tuner hardware. In my case, I am using an Asus My Cinema U3100. It is not listed specifically but luckily it works with the generic DVB-T driver "DVBTBDASource.dll".

Next select the frequency of the channel that you would like to find the best reception for. If you live in Singapore you can refer to this Wiki page to get the frequencies of free-to-air (FTA) TV stations here. Just note that the frequency for HD5 is 610MHz and not 608MHz as stated on the Wiki.

When a consistent signal is detected, you will see in the bottom left window a line that says "Signal: Locked". Use the statistics ("Last sec" and "Mux bitrate") in the bottom window titled "MPEG-2 Statistics" to guide you in finding the best reception. The higher the numbers mean better reception of course!

Wednesday, October 8, 2008

HTPC Update: Logitech diNovo Edge


To complete the hardware setup of my HTPC, I decided to go all out and splurge on the best HTPC keyboard money can buy; the Logitech diNovo Edge. To me, it is really the perfect match for the following reasons:
  1. It has an integrated touchpad (although alittle on the petite side) which removes the need for a separate mouse. On top of that, you will want a touchpad over a mouse for living room use anyway since you are unlikely to find a hard surface to use your mouse on when you are on the couch.
  2. It has just the right dimensions and weight for using on the lap
  3. It has a dedicated volume slider and mute, sleep and MediaCenter buttons on the keyboard; essential keys for a HTPC setup.
  4. If you don't already have bluetooth capability in your box, the included USB bluetooth receiver adds that for free. And if you do, then it saves on one USB port for an otherwise proprietary receiver on the PC.
  5. The range is pretty decent although I find that it loses reception when you place your keyboard at a height much lower than the receiver. (I get this when I use the keyboard on my coffee table which is sitting approx 60cm below my PC placement. [Edit: Found the problem - it is due to interference from my WiFi router which sits within 1 meter of the HTPC])
  6. Tactile feel on the keys are excellent and not noisy.
  7. And lastly, the reflective black and metallic silver look compliments my living room look perfectly.
The SG SRP on this is a whopping S$399! The cheapest I can find in local retail stores is still S$349. The good news is that you can buy it online for just US$127 (roughly S$210 incl shipping via vPost) from Amazon.com. The downside is of course the warranty which is limited to domestic US but at nearly 50% off, I will gladly take that risk.

Installation and setup of the keyboard is a breeze. By default, the USB bluetooth receiver is configured as USB HID class which means that any modern day motherboard and OS can detect and use it without installing any drivers. This also means that the keyboard can be used even for entering Bios Setup! If you want more control over its features, then installing the SetPoint software is a must. Forget the version found in the CD and go straight to Logitech's support website to download the latest version (v4.6 as of this post).

One undocumented feature I've found is that the keyboard is actually active when charging in the base station even if you flick the on/off switch to off! This is a tad annoying as it wakes my HTPC whose off state is always S3 (commonly known as standby or sleep) whenever I put the keyboard back on the charging stand! I had to resort to pulling out the charging cable off the base to stop this behavior. Switching off the base charger is not possible as the switch is hidden behind the TV console. An alternative solution will be to configure the HTPC to disable wakeup from the keyboard but that also means that I lose the feature permanently. i.e. I will no longer be able to turn on the HTPC from the comfort of my couch using the keyboard!

To have the included USB bluetooth receiver to work with other bluetooth devices, you will need to change it from HID to HCI class using information found here. I will be updating this post once I have found time to try this out myself.

Here is the updated part list for my setup:

CPU: Phenom X3 8650 HD8650WCGHBOX 2.3GHz Socket AM2+, $0 (bundle with mobo).
CPU Cooler: Scythe SCMNJ-1000 Ninja MINI, S$50 (used).
Motherboard: GIGABYTE GA-MA78GPM-DS2H AMD 780G chipset microATX, $355 (SLS Bell Systems)
Memory: Kingston DDR2-800 2 x 2GB Kit, $104.(SLS Bell Systems)
Graphics Card: Radeon HD 3200 (integrated in motherboard the chipset), $0.
TV Tuner: PowerColor Theater 550 Pro PCIe, $69. (SLS Chamoxa)
HDD: Western Digital Caviar WD5000AACS 500GB SATA2, $101.(SLS Bell Systems)
PSU: Antec EarthWatts EA 430 (included in the case), $0.
Case: Antec Fusion Black 430, $339 (SLS Media Mart).
Webcam: Creative Live! Cam Optia AF, $55 (used)
Wireless Keyboard: Logitech diNovo Edge, $210 (Amazon.com)

The following are still on my todo list:

ODD: LG GGC-H20L, BD-ROM + DVD-RW, $249. (COMEX)

Friday, October 3, 2008

HTPC Update: Improving video quality

If you own a recent ATI graphics card and use it mainly for movie playback, you may well be interested in this set of tweaks. It is basically a registry script that enables certain settings in ATI based cards that is geared towards video playback and hardware assisted decoding (DXVA in geek speak).

[Disclaimer: I have yet to find time to apply the settings on my HTPC so please read up before applying the script!]

Monday, September 29, 2008

HTPC Update: Creative Live! Cam optia AF

A part of my plans for a digital home involves setting up a video conferencing facility in the living room so that:
  1. I can get in touch with the kids and family when I'm on overseas business trips;
  2. my folks can interact with their grandchildren when they are not visiting;
  3. we can keep in touch with our relatives and friends who have migrated abroad or out stationed for extended duration;
  4. and lastly, create a platform where we can encourage our kids to explore staging performances (singing, dancing, acting) in front of a camera! (This help build confidence in the child as well as capturing those precious childhood moments)

Although we can pretty much do this now with the integrated camera and microphone on our laptops (we have two of these at home), the experience isn't that great given the poor quality of the integrated cameras (1.3Mp only) and the screen is a little small for a family of five to crowd around to see.

Setting it up on the HTPC however is perfect. We have a 50" display and some pretty good speakers. All I needed is a good quality webcam with integrated microphone and we are all set.

Scouring my favorite marketplace, I managed to pick up a used Creative Live! Cam Optia AF for only S$55. It's about a year old but the condition was excellent.

This webcam features a 2 megapixel sensor, auto-focus, noise cancelling adaptive array microphone and great looks to boot (blends into the living room decor perfectly).

I tested it on my rig and found the picture quality to be excellent. Audio is a little weak but that is probably because I was testing it from a distance of two meters.

The bundled software are also pretty decent and fun for the kids to play with. Overall, I'm happy with this acquisition.

Here's my updated parts list with pricing:

CPU: Phenom X3 8650 HD8650WCGHBOX 2.3GHz Socket AM2+, $0 (bundle with mobo).
CPU Cooler: Scythe SCMNJ-1000 Ninja MINI, S$50 (used).
Motherboard: GIGABYTE GA-MA78GPM-DS2H AMD 780G chipset microATX, $355 (SLS Bell Systems)
Memory: Kingston DDR2-800 2 x 2GB Kit, $104.(SLS Bell Systems)
Graphics Card: Radeon HD 3200 (integrated in motherboard the chipset), $0.
HDD: Western Digital Caviar WD5000AACS 500GB SATA2, $101.(SLS Bell Systems)
PSU: Antec EarthWatts EA 430 (included in the case), $0.
Case: Antec Fusion Black 430, $339 (SLS Media Mart).
Webcam: Creative Live! Cam optia AF, $55 (used)

The following are still on my todo list:

ODD: LG GGC-H20L, BD-ROM + DVD-RW, $249. (COMEX)
TV Tuner: ??
Wireless Keyboard: Logitech DiNovo Edge S$399

Wednesday, September 10, 2008

HTPC Update: Powering on/off via remote!

A critical feature of any worthy HTPC is the ability to turn it on/off via a remote; Just like any other piece of living room appliance. I got the Antec Fusion Black 430 expecting this to work out of the box (the package includes an IR receiver and I own a Harmony 550) but I guess I was asking too much; You will need to perform this (undocumented) step in order to get it working.

In short, here is what you need to do:
  1. From the bunch of headers in the front panel, locate the two headers labelled "POWER SW".

  2. Connect the header with the white and black wires to the input pins on the LCD as shown in the picture above. Note: you should not need to remove the front panel and disassemble the LCD as stated in the forum thread as you should be able to see it through a hole in the panel.

  3. Connect the header with the red and black wires to the power switch pins on the motherboard.

Sunday, September 7, 2008

HTPC up and running finally!

One year ago, I started looking at building a HTPC for my living room (1)(2) but had it KIVed due to costs and more importantly the maturity of hardware HD decoding and availability of native HDMI+HDCP output combining both audio and video.

Recently, I revisited the project and am mighty glad to find plenty of options available and most of them at affordable costs. So over the weekend, I took the plunge and built my own "BD player" (and a whole lot more) for about 1k SGD.

The heart of the setup is the GIGABYTE GA-MA78GPM-DS2H motherboard. This mobo is based on the excellent AMD 780G chipset and features the ATI Radeon™ HD3200 (DirectX 10 capable) as its iGPU. It is actually a revision of the popular GA-MA78GM-S2H with an added DDR3 128MB SidePort Memory (essentially dedicated memory for the iGPU). It also features a native HDMI+HDCP output that delivers both audio and video.

The board is mated to an AMD Phenom X3 8650 processor and 2x2GB of DDR2-800 RAM. Triple core CPU is used as it is well suited for video and 3D rendering tasks, which will be the most common tasks on this PC. Plus you get more bang for the buck compared to the quad core ones. Power consumption and heat also come into mind. 2x2GB in Dual Channel mode provides more than adequate performance for now. Note that the board has 4 DIMM slots so you can add-on an additional 4GB at a later time. Also, although it supports DDR3 specs, the performance gain does not justify the cost today (its about 2x the price of the DDR2!).

Hard disk is a single 500GB Western Digital Caviar Green Power SATA 2 edition; Again chosen for its price and power/heat/noise characteristics. I only need one mid-size HDD in my HTPC as I have a NAS cum media server on my network. The casing I've selected can pack in 2 HDD giving you a total of 2TB if required.

And finally, the casing is the Antec Fusion Black 430. It is a rather big and heavy chasis but note that it only fits a microATX motherboard due to its unique tri-chamber design. Exterior wise, it resembles a conventional hifi component and features a LCD display and volume knob. The casing also comes with an IR receiver that is Vista and MCE compatible but without a MCE remote. This is fine by me since I use a Harmony remote anyway. The included 430W power supply is RoHS and 80 PLUS certified and is more than sufficient for the parts I'm throwing in. Chasis cooling takes the form of two 120mm fans which is very quiet at low setting. Any higher and they get audible but not annoying as the AMD stock CPU cooling fan. One gripe is that the fan speeds are manually set via a physical switch INSIDE the casing hence you can pretty much forget about adjusting them according to the CPU load.

The setup scored a Windows Experience Index of 4.1. As expected, the lowest value is due to the 3D performance. 2D scored 4.6 while the rest are well above 5.

The box is placed in a closed cabinet and after 30mins of running idle, both system and CPU temps can hit close to 50 Degrees Celsius. I may have to consider cutting up the rear of the cabinet to make way for an exhaust fan. Oh, and the stock AMD cooler fan is loud as hell at those temps (around 5k RPM). So do go out and get a decent aftermarket cooler.

The box is hooked up to my Pioneer PDP-508XG via HDMI. Resolution on the TV is automatically set at 1360x768 after the latest Catalyst drivers are installed. Setting to any of the HD resolutions (i.e. 720p/1080i/1080p) causes overscan when the TV is set to "TV Mode". You need to set it to "PC Mode" to get around this problem. Text is sharp and picture is good at the native resolution of 1360x768 hence I do not see a point in having the GPU output at 1080i/p resolution only to be downscaled later by the TV's internal processor.

Sound output is via HDMI to the TV and is pretty decent. I have it connected separately to my 6.1 Pioneer HTiB via optical S/PDIF but have to manually change the default sound device in the Realtek HD audio control panel before I can get sound output from there. Ideally I would like to output to both devices at the same time or better yet, selective output based on programs I run. e.g. Windows Media Center audio output should be via HTiB while the system sounds can be piped through the TV.

Here is the breakdown with costs for my setup:

CPU: Phenom X3 8650 HD8650WCGHBOX 2.3GHz Socket AM2+, $0 (bundle with mobo).
Motherboard: GIGABYTE GA-MA78GPM-DS2H AMD 780G chipset microATX, $355 (SLS Bell Systems)
Memory: Kingston DDR2-800 2 x 2GB Kit, $104.(SLS Bell Systems)
Graphics Card: Radeon HD 3200 (integrated in motherboard the chipset), $0.
HDD: Western Digital Caviar WD5000AACS 500GB SATA2, $101.(SLS Bell Systems)
PSU: Antec EarthWatts EA 430 (included in the case), $0.
Case: Antec Fusion Black 430, $339 (SLS Media Mart).

The following are on my todo list:

CPU Cooler: Scythe SCMNJ-1000 Ninja MINI (S$69).
ODD: LG GGC-H20L, BD-ROM + DVD-RW, $249. (COMEX)
TV Tuner: ??
Wireless Keyboard: Logitech DiNovo Edge S$399

CPU cooler was on my core list but too bad none of my selections had stock in any of the shops in SLS! But I really ought to get one soon as the buzz from the stock CPU cooler is killing me!

For the ODD, I had a choice between the LG and a LITE-ON DH-4O1S which costs only S$159. I had to drop the latter as it cannot write to CD/DVD while the LG one can. Since my choice of casing only allows me to have a single 5.25" device, I needed one that can read Blu-ray for movies but at the same time can read/write to CD/DVD for data/music/home movies! Forget writing to Blu-ray as the media is still way too expensive and the players are not as prevalent yet. (How many people you know owns a Blu-ray player?)

I'm still sourcing for an internal TV Tuner card to complete the setup. I'm split between looking for something that can accept HD input (via component or HDMI better) and has native hardware H.264 encoder or just settle for a conventional dual (DVB-T and analogue) TV tuner with hardware MPEG2, or even just a hybrid tuner without the hardware encoder since the 2.3GHz triple core CPU should be more than sufficient for handling the MPEG2 encoding in software. If you have any thoughts on this, let me know!

BTW, if you are going for the last option (i.e. TV card with no hardware encoder), be wary that you will need to jump through quite a few hoops to make it work in MCE or WMC.

Project updates:

Wednesday, September 19, 2007

Consideration factors for building your own HTPC

This is part two of the HTPC project series. In part one, I've described the advantages of having a HTPC. In this installment, lets talk about some of the key consideration factors you should think about when building your HTPC.

(1) Appearance
As the center of the entertainment hub, the HTPC will usually find its place in the living room near the TV. Unless you conceal it in a cabinet of sorts (which isn't such a good idea due to poor ventilation), you will probably want it to look good or at least blend in with the rest of the living room decor.

This factor will influence your choice of enclosure as well as input devices like remote, mouse and keyboard.

(2) Noise
Again, as the HTPC will mostly be in the same room, you will want it to be as quiet as possible so that you can enjoy the audio fidelity of your music or movies.

Typical noise generators to watch out for are the cooling fans (e.g. power supply, cpu, graphics card) as well as the harddisks. At times, the enclosure as well as the location where you put the HTPC will also aggravate the situation due to bad airflow (causing the fans to spin faster hence nosier).

This consideration will also indirectly affect your choice of the components; more powerful CPU and faster harddisks will generate more heat which in turn cause the fans to spin faster leading to more noise.

(3) Power consumption
Since this is the hub for entertainment, you will probably have it running for a large part of the day in both attended mode (e.g. playing music, movie, games, etc) and unattended mode (e.g. recording TV/FM programs). Hence you will probably want to also consider the power consumption so that it won't break your bank due to running cost.

This will influence your choice of hardware; i.e. rather than getting the top-of-the-line components which are typically power hungry, go for components that are just good enough for your needs. You may also want to consider components that have smart power saving features. e.g. components that shuts itself off or go into low power mode when idle, motherboards that support WOL (i.e. Wake-on-LAN) so that you can remotely start the HTPC instead of leaving it on 24/7.

(4) Usability
Usability here refers to how easy it is to use the HTPC. You will definitely not want a setup where your three years old son or ninety years old granny need to complete a one year IT program before being able to use the system. Neither do you want a setup where you have to click 10 times before you can listen to your favorite CD or watch your favorite program. And lastly, you will definitely not want a setup where you need to get up from your cosy couch and walk across the room to skip a track or turn up the volume!

The above are four key consideration factors to take into account when choosing the parts you put into a HTPC. In the next installment, we will look at which components are required and how these factors will influence the choices we make.

Wednesday, September 12, 2007

HTPC? What the hell is that??

For the uninitiated, HTPC stands for Home Theater PC. Its basically a PC designed to replace all your home theater needs; generally it means watching/recording live TV broadcast (with time shifting ala TIVO!), recorded TV programs as well as your collection of DVD movies. Besides watching video, you will also be able to use it to listen to your CD collection and AM/FM radio. On top of these conventional means of home entertainment, your HTPC can also be used for gaming, video conferencing and even karaoke!

So out go your VCR, DVR, DVD player, CD player, AM/FM tuner, TIVO, gaming console, karaoke and VC system. One box to rule them all. Yes, you will still need your bad ass audio setup (i.e. amp and speakers) and your TV of course. Erm.. hang on, TV is actually optional now since your HTPC can serve as the TV tuner so you may want to replace it with a projector for the big screen cinema effect.

Besides just replacing functionalities in your living room setup, a HTPC also opens up your reach to the content via the internet. So apart from your own collection of DVDs, CDs and the local airwave, you will also get access to an (nearly) infinite source of streaming media, ranging from shoutcast audio to Utube videos!

Sold on the idea yet? Want to know how to get started? Stay tuned for the next episode...