It got cold again today, after spending most of the week above zero.
This evening, it started to snow again and it’s still snowing now, several hours later.
The world outside is lying under a fluffy blanket once again.
It got cold again today, after spending most of the week above zero.
This evening, it started to snow again and it’s still snowing now, several hours later.
The world outside is lying under a fluffy blanket once again.
Another good test for my body a couple of days ago came in the form of lying on the ground, screwdriver in hand, trying to reach some inaccessible screws on the MythTV box, so that I could extricate it from the jungle of leads in the living-room and perform open-heart surgery on it in the dining-room.
One of my PVR-350 tuner cards gave up the ghost just before Christmas. I suspected a software fault at first, even though I had made no configuration changes to the machine, because the card was still emitting a video signal. Only the sound was missing from any recordings made using the card.
I tried numerous configuration changes to get the card to work, but I couldn’t coax it back into making audible recordings. Either something in the machine had suffered a short-circuit, or the tuner card itself had gone to the great pile of hardware in the sky.
I didn’t want to open the box — extricating it from all of its leads and attached devices is quite a kerfuffle — so I concluded the card must be at fault and set about finding a replacement for it.
Hauppauge appears to no longer manufacture the PVR-350, so I resorted to Marktplaats, the Dutch equivalent to eBay, and was pleased to quickly be able to find one for sale in Amsterdam for the princely sum of €30.
It was nice to be on the right side of depreciating hardware for once. €30 for a TV card in great condition: you can’t say fairer than that.
I’d had to venture out and drive through the snow to buy the card, because I wanted to purchase it before my operation, not knowing how long it would otherwise be before I could go and pick it up. I didn’t want the bloke to sell it to someone else if I took too long over it.
I thus picked it up the day before the operation, but I decided that if I was going to be opening the machine anyway, I may as well make it really worth my while and stick some extra memory in it. Our MythTV box has operated on only 1 Gb of RAM since its creation, which isn’t a lot these days. It hasn’t been a problem in daily use, but sometimes the front-end process can grow very large and there have been occasions when I’ve wanted to run a couple of other things on the box, and it hasn’t really had the capacity for it.
So, I ordered a couple of gigs of extra RAM and waited for that to arrive, knowing that I’d probably be up and about again by the time the stuff arrived.
That turned out to be an accurate prediction, because the memory didn’t arrive until Wednesday, at which point I decided to flex the muscles that hadn’t seen a lot of use in the intervening week and set about upgrading the box after all of the other TV viewers in the house had gone to bed.
Sure enough, there was a blown capacitor on the bad PVR-350. It appeared to have a corroded top and I was surprised that the fault was so strikingly visible. I put in the replacement PVR-350, which featured a tuner chip of a slightly later revision than the one it was replacing, but I had queried this beforehand with the seller and then verified that the Linux ivtv driver also contained support for this version of the card.
This is one of the ongoing problems with hardware on Linux. A product like the PVR-350 may remain on sale for a number of years, but in that time it may undergo any number of minor hardware revisions. The packaging, however, will typically make no mention of this. And why would it? After all, the supplied CDROM containing Windows drivers has drivers for whichever card is in the box.
The problem is that the writers of Linux drivers typically have to do quite a bit of work to figure out how to make hardware work under Linux. This isn’t always the case, however, and things are certainly a lot better now than ten years ago, Many manufacturers provide their own Linux drivers these days, or detailed technical specs, but even then driver writers can be left with plenty of reverse engineering work.
So, when a card like the PVR-250 suddenly starts to ship with a Philips tuner instead of a Hitachi one, Windows users aren’t affected and don’t even notice, whereas a Linux user will often find that the card doesn’t work, even though it’s supposedly a supported device.
That’s because the developer of the Linux driver wrote the code according to the hardware that was current at the time. The user then has to patiently wait for the driver writer to catch up and add support for the new tuner, which could be trivial or could be a lot of work, especially if he doesn’t have access to the latest revision of the card. The user can also add support himself, of course, but for most users, that’s not an option.
In my case, both cards had tuners from the same manufacturer, but they were different revisions.
The defective card, as detected by the ivtv driver:
tveeprom 1-0050: Hauppauge model 48139, rev K257, serial# 8351216
tveeprom 1-0050: tuner model is Philips FM1216 ME MK3 (idx 57, type 38)
The replacement card:
tveeprom 1-0050: Hauppauge model 48139, rev K2B7, serial# 9994410
tveeprom 1-0050: tuner model is Philips FM1216ME MK5 (idx 117, type 38)
The old card is a MK3 version of the tuner, whereas the replacement card is newer, a MK5. That could have been enough for the card not to function, which is why I had to check with the seller what was written on the chip itself. That’s a lot harder to do with a new product, still boxed and wrapped in cellophane, which is why buying hardware for Linux can still be a pain.
Next, I cracked open the Kingston KVR400X64C3AK2/2G memory that I’d purchased and added two sticks of 1 Gb 400 Mhz PC3200 CL3 DDR to the existing two 512 Mb sticks.
I also took the opportunity to hoover out the case of the PC, which had once again sucked in an inordinate amount of dust since it had last been opened and cleaned.
Now came the least fun bit: lying on my back to reconnect all of the cables.
Once that was done and I’d turned the machine back on, it came up as hoped with 3 Gb RAM and, more importantly, the replacement TV tuner card was functioning perfectly.
Our MythTV back-end is now back to being a quad-tuner system.
The same day that I upgraded our DVR, I also installed some slightly faster RAM in our new NAS (CL5 instead of CL6, for those who might wonder). The difference in speed won’t be noticeable, but I had the chance to exchange the memory I’d originally installed, so I thought that I may as well.
I exercised on the crosstrainer for the first time since the my operation this evening. I also picked up Eloïse from school, biked into the city centre for a haircut and then hauled a huge amount of groceries back from the supermarket, so I can feel good about the amount exercise my body’s had today.
The Wii Fit told me I’d put on a kilo since the last time I exercised, so that’s been the cost of the post-operative recovery period. Not too bad, I suppose.
That means I’m still two kilos up on my pre-Xmas low, because I hadn’t yet got back to that weight when the operation so rudely interrupted my workout regimen. I hope I can shift those two kilos over the next three or so weeks and return to my mid-December weight.
On the positive side, the Wii Fit declared me to have the body of a 21 year old this evening. Sigh… if only that were true.
We upgraded to the Wii Fit Plus on release last year and I’m pleased to say that I’ve been making good progress on the new activities that have been added.
I’ve managed 622 points on the Obstacle Course in advanced mode, which is easily good for four stars. I’ve also achieved four stars a couple of times in the super-advanced mode of Perfect 10 (which should then be called Perfect 20), but it took me a lot of plays to get my brain and hips working in that kind of harmony.
In Big Top Juggling, I’ve managed to attain a perfect score in standard mode, but I doubt I’ll pull off the same feat in advanced mode, where one must juggle five balls instead of three. That’s pretty hard, especially when the bombs start exploding at your feet.
Speaking of perfect scores, I’ve also managed a perfect run through Tilt City, getting all the balls into the matching coloured buckets.
The Obstacle Course is one of the few new activities that hold a lasting appeal for me, though. I find it to be the perfect warm-up for the crosstrainer, so it’s an activity I do every evening.
I was a bit wary of doing the squat routine on the crosstrainer this evening, but it wasn’t uncomfortable, so I didn’t skip it.
I’m in no more discomfort now than I would be if I’d taken part in a strenuous activity and pulled a load of muscles. More disturbing is the subcutaneous hardening of the tissue around my wounds. One of these has so much hardened tissue, that a bulge distends from my belly when I lie down and tense my stomach muscles. Yuck. I hope that’s normal.
I ventured out of the house briefly on Monday, for the first time in five days. The last time I was outside, the ground was lined with powdery snow and I was returning from my operation. On Monday, however, the only remaining hint of this was the thin layer of ice still floating atop the local ponds.
Yesterday, we went for lunch as a family and today I picked Eloïse up from school on the bike. I could definitely feel some muscles, tendons and whatnot being pulled in directions they didn’t much feel like going in, but all in all, that’s probably no bad thing. Certain parts of my body have been getting no exercise over the last week.
As of today, I’m officially allowed to bike and drive a car again. That’s good, because the car has to go in for its first APK test next week.
I’ll probably do some exercise this evening. I’m curious what the scales will read after the last, very inactive week.
The US is home to a great number of on-line music services, such as Napster, Pandora and Rhapsody. The trouble is that, due to copyright and royalty issues, access is currently restricted to users in the US.
Over here in Europe, things are fragmented. Last.fm is a popular service that offers listeners the streamed equivalent of a personalised radio station, but outside of the US, it’s available only in the UK and Germany.
The only pan-European music service I know of is France’s Deezer. The trouble is, Deezer’s not very good in its present state. It doesn’t have a large number of songs, so selecting a SmartRadio station, which allows one to listen to a particular artist and others deemed similar, very quickly results in repetition, if, indeed, your chosen artist can be found at all.
Over on the the forums of the multi-room Sonos sound system, the most frequently requested integration of a new music service comes from users from all over Europe who’d like to see their Sonos system able to access Spotify, a high-quality music service based in the Swedish capital.
Sonos is obviously aware of the demand, but thus far hasn’t granted the request. There are a number of reasons why Sonos integration of Spotify is problematic.
Firstly, at the technical level, Spotify has no API to speak of. The service requires the user to download an application, which then runs on their Windows or Mac machine. For Sonos to make this work on their system, they wouldn’t simply be able to perform a few HTTP GETs and make the existing controller software stream from Spotify. They (or more likely Spotify) would have to write a small application to do so. Integrating this with the existing system could prove challenging, but I’m sure it could be done.
Secondly, Spotify is currently in beta as an invitation-only service. This is to control the number of new users taxing the servers and ensure the quality of the service. Periodically, though, eager users in the UK can sign up without an invitation as Spotify decides to expand its user base.
Thirdly, Spotify is only available in a handful of European countries. Sadly, the one I live in isn’t amongst them.
The above problems notwithstanding, I’m going to demonstrate how, with a little bit of determination, it’s possible to listen to Spotify anywhere in the world on any device that supports streaming.
Prerequisites for this exercise are a computer running a fairly recent distribution of Linux. In particular, it’s going to need to be running the revolutionary PulseAudio sound server. This computer is going to act as middleware between Spotify and the device you listen on. Of course, if the machine in question is also your desktop, you can also use it as an endpoint to listen to Spotify.
First of all, you need to sign up as a user of Spotify. Since UK users sometimes don’t need an invitation and, in any case, you need to appear to be registering from a serviced country, we’re going to use a regional proxy, such as lessonfly.com or DaveProxy to do this. You can find many others with Google, so try a few different ones if you think you’re running into a technical problem.
Paste the URL https://www.spotify.com/en/get-started/ into the box and you will be transported to Spotify’s site as if you were in the UK. Once there, sign up for service as a new user.
If you can’t get past a screen informing you that Spotify is currently an invitation-only service, you’re not going to get in by just knocking on the door. In that case, you’re going to need to get yourself invited. If you don’t know anyone who has Spotify, ask around in audiophile and torrent forums. With some effort, you should be able to find someone who can send you an invitation.
Complete your registration with a valid UK address. including with a British postcode. The Royal Mail operate a rather nice postcode finder. Just plug in an address somewhere in the UK and it’ll spit out a postcode you can use.
Once you’ve done that, download the Spotify application for Windows. Spotify doesn’t provide a native Linux application, so we’re going to have to run the Windows binary on our computer.
Next, install the software on your Linux machine by running wine Spotify Installer.exe
in a terminal window. It should install flawlessly with a fairly recent version of WINE (a Linux implementation of the Windows API). Once it’s installed, configure it with your Spotify user name and password, plus any additional settings you’d like to add, such as the user name and password of your Last.fm account, so that anything you listen to can be scrobbled.
If you can and you haven’t already done so, configure WINE at this point to use the PulseAudio sound server. It will make your life easier in the long run, as Spotify and any other Windows applications you use that access your computer’s sound card will play nicely with any native Linux applications that do the same. You can configure WINE to use PulseAudio by running winecfg and going to the Audio tab.
Depending on your distribution, you may first need to patch WINE to add PulseAudio support. How to do this is beyond the scope of this HOWTO. but if you have Fedora 12, the patch has already been integrated in the distribution binary.
You should now have a working Spotify client. Regardless of where you live, the client will function normally at this point, but if you’re not within the service area, it will work for only 14 days and you’ll start to see warnings to that effect after a few days.
This is because Spotify’s free service entitles users to travel outside the coverage area for up to two weeks without affecting their access. If you want to travel for longer, you have to sign up for Spotify’s premium service at £9.99 per month.
If all you want to do is listen to Spotify on your Linux desktop, you’re pretty much ready at this point. Consider signing up for Spotify’s premium service, because it will remove both the advertising and the geographical restrictions. Because you can pay with PayPal, no-one need be any the wiser that you don’t actually live in the UK. You can simply appear to be permanently travelling.
I wanted to listen to Spotify on my Sonos system, however. Although my natural habitat is at my computer, I’m frequently also to be found in the kitchen, dining-room, media room and bathroom. I therefore wanted to be able to listen to Spotify anywhere in the house.
Here’s how to get there. The same solution works for streaming Spotify to any number of other networked devices in (or even outside of) your home, including computers, phones, etc.
First of all, we’re going to capture the raw sound that the Spotify application sends to your PC’s sound card. We do this using PulseAudio’s parec utility, which is actually just a symlink to pacat, a program for recording and playing back raw audio streams.
Next, we take the flowing stream and convert it to signed 16 bit little-endian WAV format data. This stage makes the sound much more palatable to other programs, because despite the name, this is actually a very common format for audio data interchange.
Finally, we take the resulting stream of WAV format sound and make it accessible to the Sonos. This requires transcoding it a format that is digestible by the Sonos, such as the commonly used MP3 format.
That alone won’t be enough, however. We still need a way for the Sonos to actually get to the data we’re producing. To achieve that, we’ll take our newly re-encoded data and stream it over HTTP from the Linux computer. That way, any device that can play an MP3 stream can connect to the computer and grab the data.
Putting this together, we get the following script:
#!/bin/bash type pactl &>/dev/null || { echo pactl unavailable. Install pulseaudio-utils.; exit 1; } type cvlc &>/dev/null || { echo cvlc unavailable. Install vlc-core.; exit 1; } # Change this to 'true' if you have Spotify's premium service. # SPOTIFY_PREMIUM=false # The computer's first Ethernet interface. # IF=eth0 IPADDR=$( ip addr show dev $IF | awk '/^ *inet / { print $2; exit }' | sed 's#/.*##' ) PORT=8080 DEVICE=$( pactl list | grep -A 2 'Source #' | sed -ne 's/^.*Name: \(.\+\.monitor\)$/\1/p' | grep -iv headset | head -n 1 ) if [ "$SPOTIFY_PREMIUM" = 'true' ]; then BITRATE=320 else BITRATE=160 fi parec --device=$DEVICE --format=s16le --rate=44100 --channels=2 | sox --type raw -s2L --rate 44100 --channels 2 - --type wav - 2>/dev/null | cvlc -q - --sout "#transcode{acodec=mp3,ab=$BITRATE}:standard{access=http,mux=raw,dst=$IPADDR:$PORT}" 2>/dev/null |
Copy and paste the above script into a file, make it executable and run it. If you don’t have SoX or VLC installed, install them now.
There’s a chance the above script won’t work for you. It’s not very sophisticated and doesn’t do a lot of error-checking. If you have multiple Ethernet interfaces in your computer and it’s not connected to the network via the first one, you’ll need to modify the script.
Similarly, if you have multiple sound cards in your computer, the above script may try to use a different one than the one to which the Spotify application is sending its output. Again, you’ll have to modify the script to make it work.
For the majority of users, however, the above script will just work.
Spotify streams its free service in Ogg Vorbis Q5 format, which is good for a nominal 160 kbps of data. Premium users get Ogg Vorbis Q9, which is nominally 320 kbps, although the Ogg Vorbis codec is so good that you’ll be hard-pressed to tell the difference. Make the appropriate modification to the script if you’ve signed up for premium service and want the higher bit rate.
Assuming the script is working, you should now be able to connect to your computer using your Sonos (or similar device) and listen to whatever Spotify is playing at the time. If your computer’s IP address were. for example, 192.168.1.12, you would add a radio station to the Sonos, giving it the following URL: http://192.168.1.12:8080/
At this point, music should start to emanate from the speakers connected to your Sonos system. If it doesn’t, make sure that the Spotify application is actually playing something and that the above script is functioning correctly. Troubleshooting the script may prove tricky for you, but it includes enough variables that it, too, is unfortunately beyond the scope of this posting.
If you’ve got this far, well done. You’re listening to Spotify in a location that isn’t officially served, using a client application that was written for use on a different operating system, transcoding its output and retransmitting it to an unsupported device!
Obviously, the integration with the Sonos is poor. You can start or stop listening to the stream from your computer, but your computer will go on streaming after you have stopped listening. This only really matters if you’re scrobbling data to Last.fm, because you will scrobble tracks you didn’t actually listen to.
Similarly, you can’t control or even view the details of what you listen to from the Sonos. To select new music or see what’s currently playing, you’ll have to visit the computer and use the Spotify application.
Still, some integration is better than no integration at all, I think.
There’s also the problem of service ending after 14 days if you’re not in the service area. Whilst you can sign up for premium service to escape this restriction — and I encourage you to do so — there’s another solution.
Spotify’s preferences dialogue allows you to specify a proxy server to use to access the service. You can choose between a number of different flavours of proxy, one of which is SOCKS5. If the proxy you fill in here happens to be located in Spotify’s service area, it will appear to Spotify as if you, yourself, are also within that area.
Here again, Google is your friend.
Freely available open proxies of this kind tend to come and go with the weather, but you actually only briefly need one once every two weeks to reset the clock on your travelling. After logging in via a proxy, you can reselect no proxy and enjoy another two weeks of listening on the road, as it were.
If you can’t locate a SOCKS5 proxy, use an HTTPS proxy instead. That will work equally well and these are much more common than their SOCKS5 cousins.
There are some stability issues with this set-up. Occasionally, the script will hang and the Sonos will be unable to (re-)connect to the stream. In that case, you’ll need to restart the script. Alternatively, you could write a watchdog to monitor the script and restart it as necessary.
Also, you’ll experience the occasional audio drop-out, particularly if you’re streaming Spotify via a SOCKS5 or HTTPS proxy in another country. There’s not much you can do about this, other than sign up for premium service so that you have unlimited access to a direct stream.
Finally, there’s some minor danger to your privacy to be aware of with this configuration. You’ll recall that all data going to your computer’s sound card is being captured and streamed. That means that if you were to receive an incoming call via, say, Skype, and that program is configured to send its output to the same sound card as Spotify, anyone in your house can now tune into the conversation via the Sonos. If this is a worry to you, use PulseAudio to send only the output of Skype to a USB headset.
Getting this operational should not be regarded as a guarantee of continuity of service. Spotify is at liberty to block your account at any time, even as a paying subscriber, because you’re circumnavigating their geographical restrictions. They’re under absolutely no obligation to you.
Nevertheless, if you can get this working and manage to stay under Spotify’s radar, I hope it’s of some use to you. If nothing else, it’s a nice demonstration of the combined power of Linux, the Internet and geek willpower.