HTPC? Go with Linux, try and avoid Windows based HTPCs.

A year and a half ago I switched my media server from Windows to Linux, this opened my eyes. A lot of people are afraid of Linux, people are afraid of what they don’t understand. I was a bit skeptical at first, but having made the switch I would never go back to a Windows based machine. Also I wanted to state that this article is not put here to start a flame war. I’m a heavy Windows user, these are just some observations of mine.

Main_logo_3DMy server serves up all the media from 7 Hard Drives totalling about 14 Terabytes of storage. I use XBMC to view all that media in my home. For those of you not familiar with XBMC, first I must ask, “Where have you been?”. XBMC is an award-winning free and open source (GPL) software media player and entertainment hub that can be installed on Linux, OSX, Windows, iOS, and Android, featuring a 10-foot user interface for use with televisions and remote controls. It allows users to play and view most videos, music, podcasts, and other digital media files from local and network storage media and the internet. That bit is straight from the horses mouth. It is probably one of the most popular media players for home theatre enthusiasts. If you have multiple televisions in your home you can point XBMC to an SQL database and sync content across rooms. If you are half way into a movie and you decide to stop it, you can continue where you left off in another room. It’s a very feature filled and rich media centre environment.

In my main living room where I have my home theatre setup, I’ve been running XBMC on top of a Windows machine for quite some time now. It has been very unstable, and more often than not if I brought the PC out of suspended mode XBMC would crash to desktop. My main reason for running this on top of Windows was that I also wanted to browse the web while in the living room. Finally I got annoyed at all the crashes and hangups with Windows. I could have ran in on top of Ubuntu, but instead I opted for an embedded XBMC solution. I had a choice either XBMCbuntu or OpenElec. I decided to go with OpenElec, to me it seemed like to more logical choice of the two. OpenElec is XBMC built from the ground up, on top of a Linux kernel. It is designed for light and small embedded media players. XBMCbuntu is an XBMC distro built on top of the Ubuntu kernel. I wanted the one with less bloatware. OpenElec stands for open embedded Linux entertainment center.

openelec_logoOnce I installed OpenElec and setup all my sources in XBMC I moved on to the testing phase. I wanted to test a couple movies. I ran a test on a movie i recently watched on my Windows based XBMC. Same hardware but different software. I played the movie and immediately I noticed the sound was a little louder, so i dropped the volume a couple notches, and continued watching. Meanwhile this is all playing through a 5.1 surround sound setup, and DTS is being decoded on the receiver. While listening I noticed something nice but not that surprising. The dynamic ranges in the movie were clearer and being reproduced a little better. The new XBMC Frodo (v12) Audio Engine (AE) and the linux audio stack was handling the audio a lot better than the Windows equivalent. Then I immediately recalled an article I read about 6 months ago where an audio engineer discusses the merits and accuracy of the Linux audio stack over the competition such as Windows. I wish I could link to the article, it was an interesting read. I also recalled that Windows audio stack or API as of the Vista version was no longer controlled by the hardware manufacturers but by the kernel of the OS. Some say that since Vista you don’t have true hardware DirectSound, instead you have software WASAPI which does mandatory resampling and frequency cutoff, and doesn’t allow any hardware effects such as CMSS-3D. This lead to some back lash from a lot of people back then, both hardware manufacturers and end users. In the end the audio experience is just as important to me as the video experience. I still buy Blue Rays because of the uncompressed video and audio quality, after all a movie should be an audio visual experience.

linux-wallpaperIn the end I’m glad I switched the HTPC to Linux. There is a noticeable performance increase on the audio side and just a general performance increase due to the smaller OS overhead from Linux and OpenElec. As for the web browsing part on my HTPC that I mentioned earlier, I found a third party Opera Browser plugin for OpenElec. Also as a side note, if you’re using a Raspberry Pi for XBMC, there is a huge performance increase with OpenElec over Raspbmc.

Here is a little clarification of the Windows audio subsystem taken from the XBMC Wiki:

Since Vista SP1, Windows has two primary audio interfaces, DirectSound and Wasapi (Windows Audio Session Application Programming Interface). The latter was a replacement for XP’s Kernal Streaming mode.

DirectSound acts as a program-friendly middle layer between the program and the audio driver, which in turn speaks to the audio hardware. With DS, Windows controls the sample rate, channel layout and other details of the audio stream. Every program using sound passes it’s data to DS, which then resamples as required so it can mix audio streams from any program together with system sounds.

The advantages are that programs don’t need resampling code or other complexities, and any program can play sounds at the same time as others, or the same time as system sounds, because they are all mixed to one format.

The disadvantages are that other programs can play at the same time, and that a program’s output gets mixed to whatever the system’s settings are. This means the program cannnot control the sampling rate, channel count, format, etc. Even more important for this thread is that you cannot pass through encoded formats, as DS will not decode them and it would otherwise bit-mangle them, and there is a loss of sonic quality involved in the mixing and resampling.

Partly to allow for cleaner, uncompromised or encoded audio, and for low-latency requirements like mixing and recording, MS re-vamped their Kernal Streaming mode from XP and came up with WASAPI.

WASAPI itself has two modes, shared and exclusive. Shared mode is in many ways similar to DS, so I won’t cover it here.

WASAPI exclusive mode bypasses the mixing/resampling layers of DS, and allows the application to negotiate directly with the audio driver what format it wishes to present the data in. This often involves some back-and-forth depending on the format specified and the device’s capabilities. Once a format is agreed upon, the application decides how it will present the data stream.

The normal manner is in push mode – a buffer is created which the audio device draws from, and the application pushes as much data in as it can to keep that buffer full. To do this it must constantly monitor the levels in the buffer, with short “sleeps” in between to allow other threads to run.

WASAPI, and most modern sound devices, also support a “pull” or “event-driven” mode. In this mode two buffers are used. The application gives the audio driver a call-back address or function, fills one buffer and starts playback, then goes off to do other processing. It can forget about the data stream for a while. Whenever one of the two buffers is empty, the audio driver “calls you back”, and gives you the address of the empty buffer. You fill this and go your way again. Between the two buffers there is a ping-pong action: one is in use and draining, the other is full and ready. As soon as the first is emptied the buffers are switched, and you are called upon to fill the empty one. So audio data is being “pulled” from the application by the audio driver, as opposed to “pushed” by the application.

WASAPI data is passed-through as-is, which is why you must negotiate capabilities with the audio driver (i.e. it must be compatible with the format you want to send it as there is no DS between to convert it), and why encoded formats like DTS can reach the receiver unchanged for decoding there.

Because WASAPI performs no mixing or resampling, it is best used in the exclusive mode, and as a result the application gets the exclusive rights to the audio buffers, to the exclusion of all other sounds or players. WASAPI shared mode does allow this, but that’s not a common mode and not what we want for an HTPC. I myself have a dislike of Window’s cutesy system sounds happening at 110db

Hope some of you found today’s primer of use. Please pick up a scorecard from the desk and drop it in the big round “collection box” on your way out

Cheers, Damian

Advertisements

The Device that Saved my Home Theatre

I enjoy movies and TV immensely, I have since I was a kid. As a teen I used to stay up till 4am on fridays and saturdays watching old school films on the local channel. If I ever have an hour or two of free time it’s a coin flip between video games, TV show or a Movie. I live in a 3 story apartment building, and I’m positive that my neighbours must hate me by now. I crank the shit out of my volume, on a 0-100 volume scale I hover around 65, and 75 if it’s action packed and full of awesome effects. My go to movie for testing sound effects is the first 20 minutes of Star Trek First Contact, I’m sure there are better movies out there for testing audio system setups but Star Trek holds a special place in my heart.

Home Theatre

The entire setup, sans the rear surrounds.

My Home Theatre setup is as follows. The TV is an LG 60” Smart TV, beautiful picture except for the fact that mine was shipped with a defect in the panel. I am in the process of getting it replaced but since it is the time of year where manufacturers are switching to their new product line LG has no stock of 60” TVs at the moment. Funny fact, when the repair guy showed up at my place to have a look at the TV and opened it up, the label on the LCD panel inside read SHARP. He also said he has never seen a panel with the issue that I have. Smart TVs are nice having the option of netflix right on the TV is a nice add on, and the LG magic remote is a pleasure to use it is similar to the likes of the Wii remote if you’ve ever used one.

Panel and Problem

Panel defect, top left, dark pixels. Sharp panel on the inside.

Harman Kardon AVR 2650

Harman Kardon AVR 2650

The receiver is a Harman Kardon AVR 2650, 7.2 surround, 3D support and in general just beautiful sound. It is capable of plethora of audio codecs, as well as DTS-HD Master Audio and Dolby TrueHD. I have yet to get the Audio Return Channel to work but whatever, modern TVs have optical output, so really it is not a dealbreaker for me. Also a device connected to my receiver does not allow ARC, but we’ll get to that later in the article, essentially this limits my options with ARC. It also has network connectivity which allows music streaming from internet radio or a local DNLA server. Yes, I could have went with other receivers that have better on screen display, and more features, however I was not willing to sacrifice the audio quality that Harman is known for just to get a few extra bells and whistles.

The JBL loft series speakers are connected to my receiver, and a Polk Audio subwoofer. I have 2 Loft50s for fronts, a Loft20 center speaker, two Loft30s for surrounds, and a Polk Audio PSW10 subwoofer. This setup is nothing special, but it does the job. In the future I hope to upgrade to an Axiom setup, drool… http://www.axiomaudio.com/. Now I had no idea JBL was owned by Harman until I bought them, so I assume I matched up the setup quite nicely. I got a really good deal on these speakers too, boxing day is a blessing. I pretty much got a good deal on most of my equipment, I’m a bit of a frugal man so I save where I can. Sound reproduction is excellent. At first when I bought these speakers I had trouble finding the appropriate crossover settings and reading online yielded only suggestions and no exact settings for this option on my receiver. At first I was running the receiver at default settings, which was I believe was 100 for all speakers, boy was I ignorant. Is sounds so much better with the right settings. It’s like night and day.

So what is crossover? Crossover frequency is the frequency point you set at which the speakers start to feed their information to the subwoofer. This is set by the room acoustics, speaker frequency range… etc. There are a lot of factors involved in this measurement, and this is why I could not find an exact metric for my setup online. You kind of have to calculate/quess it. I found a good article explaining this crossover feature on Cnet, check it out it really goes into depth of crossover http://forums.cnet.com/7723-7596_102-308924/what-is-crossover-setting/. This is where the EZset/EQ swooped in to save the day, it pretty much took all the guesswork out of the equation for crossover. Set it and forget it. Well not exactly, after the EZset setup my crossover frequency I went in the menu and tweaked the distances and levels of the speakers. This involved a measuring tape and listening to music in 5 channel stereo. No this is not the device that saved my Home theatre, this is the device that helped me get the most out if it.

Finally I have all this connected to my network which hosts a home server sporting the Linux UnRaid distribution, with movies, TV, and my Music on it which is all reachable directly on a SAMBA share or via a DNLA server of the Plex flavour. Actually a friend of mine turned me onto this server OS and I couldn’t be happier with the switch from Windows to Linux. Check it out both UnRaid http://lime-technology.com/ and Plex Server http://www.plexapp.com/. Plex is nice because it does transcoding for PS3 and Xbox 360, and can be installed on WIndows, Mac, or Linux. I also have a PS3 an Xbox 360, HTPC, Gaming Computer, and a Bluray/DVD/HDDVD player connected to the receiver.

The Problem

Some call it video stutter, audio drops, there are so many names for it. I call it, bad programming, however before I continue I need to explain to you what EDID is. EDID stand for Extended Display Identification Data, EDID id is how an Xbox or PS3 tells a television set that it is connected to to the display, that it exists, and what resolution it is capable of. And the communication goes something like this…

EDID

Anyways the problem I encountered was one that i really did not notice until I got my new LG TV. I upgraded from a 5 year old 46” Samsung LCD to a new 60” LG Smart TV.

When I had my Samsung connected to the receiver I had the occasional video flicker, mostly on my HTPC. My gaming and other video devices didn’t really cause any problems.

So I didn’t really think much of it. I bought a new TV, I wall mounted it, and started it up. At first it worked flawlessly. Yeah it worked, it worked until i restarted the television, this is where you should insert hours of cursing and troubleshooting. The only way the whole setup would work is if I turned it on in a specific order as per the receiver troubleshooting guide. Even then sometimes this did not help at all, and when I did manage to get video going there would be other issues I would experience. I would have to turn everything off for 5 min and try again. Check out my video on YouTube… http://www.youtube.com/watch?v=uIFTPkttjrI

I blamed the receiver at first, as did hundreds of other people on Amazon. This is wrong, it is not the receivers fault, it is actually a combination of both receiver and the television set. Mostly however it is the television set and bad programming. But how do you know this Dave?

Well, this is not my first run in with an LG television and bad EDID communication. My first instance was about 2 years ago, I was setting up a Patriot Box Office in the basement and connecting it to an LG TV. Nothing, that is what I got on the television, no sound or picture. Now I knew this worked because as soon as I connected the PBO to my Samsung television, the PBO booted up and I was able to watch videos and listen to music.

The second run in was with my Fathers LG LCD. I was over at his place and I had my Dell XPS laptop with me and an HDMI cable. We decided we wanted to watch a movie where my laptop was the source. Once I connected the laptop to the TV I got a video but no audio. I tried several cables, and finally came to the realization that it’s not going to happen.

The third incident is in the form of my own Home Theatre. Oh man I was so livid when this first occurred, new TV, good surround but yet I can’t watch anything without audio or video dropping out. It also affected my Xbox 360 and PS3, the 360 would flicker really bad and I could not get any audio or video on my PS3. So came the hunt for my solution.

The Hunt

I spent hours on the net reading about the problem, searching, researching, reading, and then reading some more. Scratch that, not hours but days. Then one night at 1 am when I was looking at other receivers I stumbled upon this review on Amazon http://goo.gl/m8Na9. Whaaaaaaaa?!?…. yup… “Video issues like yours occur when HDCP or EDID information doesn’t sync properly between the receiver’s HDMI repeater and your TV.” Bells and whistles went off in my head, and I wanted to do Dance of Joy http://vimeo.com/6530632.

I found the cause of, and solution to, all of life’s problems. Beer! Kidding, I had finally found my culprit, right there in black and white from experts was exactly what was going on. I kept reading reviews on the HDMI detective and EDID issues. Most users had the problems with their HTPC and Receivers, but it all seemed very familiar to me. I found a couple reviews and complaints about receivers in general and this problem was not isolated to just HTPCs.

I thought I found the solution but I wanted to make sure. So I kept digging and reading, trying to find weather or not this EDID issue could be resolved by a device one of the posts mentioned. Nothing concrete, but I said “Screw it!” I’m going to pick one up anyways and give it a try. Worst case scenario I can send it back, with Amazons amazing customer service this will be a non issue.

Gefen HDMI Detective Plus

Gefen HDMI Detective Plus

The Solution

This is where the Gefen HDMI Detective comes in. http://goo.gl/gbW4r . Like a superhero swooping in to save a damsel in distress, the HDMI saved the day. I bought mine from Amazon. It was very easy to setup, literally it took less than 5 min.

Gefen HDMI Detective Plus in action.

Gefen HDMI Detective Plus in action.

The Gefen HDMI Detective Plus attaches to the HDTV display’s HDMI input connector for initial programming. Power is applied and the HDMI Detective Plus reads and stores the attached displays EDID to the internal memory. Then the HDMI Detective Plus is attached to your source HDMI output and it will never lose EDID again.

The HDMI Detective Plus includes 5 built-in selectable generic EDIDs that can be used for meeting standard home theatre setups. They can be selected by moving the dip switches between the different settings. I used one of the preset settings that come pre programmed with the device.

EDID

EDID 5 was my preset of choice, it can handle DTS, Dolby and 1080p is its native resolution. This was good enough for my Home Theatre setup and, 3 months later it is still up and running no more video or audio drops.

Conclusion

At the time of writing this, one of these devices will set you back about $130. You can find them for cheaper but rarely. If you’re like me this does not even cover the cost of cabling and shelving I had to buy for my system.

All in all this is a must have device for any Home Theatre, most setups have an HTPC if that is the case this device can save you a head full of ache. I paid the $130 and didn’t even look back, I’ll have this for the life span of my system and it is a small price to pay for a piece of mind.

Side Notes

For those of you that have EDID problems with your PC and a TV set check out this thread in the AVS Forum about changing the EDID on your video card driver. Otherwise you will need the Gefen HDMI Detective. http://www.avsforum.com/t/1091403/edid-override-thread

Update

Just a quick update.

I wanted to mention a few things about the receiver I have, mainly the crossover frequencies and an observation.

The crossover fq settings are as follows:

Front: Large

Centre: 60 Hz

Surround: 40 Hz

Subwoofer: Present

Mind you, these are based on my room size, device, and speakers. JBL, Loft 50, 30 and 20.

Update 2

Since writing this I am on my second H/K AVR 2650 receiver. The HDMI board on it blew last week. I have decided to return it to Amazon, who by the way has the most excellent customer service . I’m really pleased doing business with them and will continue to do so. I have decided to buy a Pioneer VSX-1123-K receiver from Amazon, or a local retailer if I can find it for a similar price.

Update 3

Both HDMI boards were bad on the two Harmon Kardon receivers. With my new Pioneer I no longer need this device, and it sits collecting dust in a box somewhere. Since this issue I have learned to avoid Harman Kardon hardware. The consensus is that since 2009 and the move of all manufacturing and design to China these devices have drastically dropped in quality.