Sunday, August 21, 2011

How to stream audio from mog.com on Ubuntu laptop to remote linux box

The problem: I recently got a linux set-top box that I have connected to my stereo in my living room. I use the internet music service mog.com and I'd like to be able to play it on my stereo and control it from my linux laptop.

I've tried lots of approaches that didn't work, like using vnc/nx/etc and setting up pulseaudio with module-tunnel-sink.

The way that seems to work the best for me is to first, setup pulseaudio on the settop box to install the module-native-protocol-tcp by adding the following line to /etc/pulse/default.pa:

load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;192.168.0.0/16

and restart pulseaudio with:

pulseaudio --kill ; pulseaudio --start

This tells pulseaudio to accept network connections from other machines on the local network.

Then, on my laptop, I run google-chrome as follows:

PULSE_SERVER=tcp:[settop box hostname] google-chrome --user-data-dir=/home/redstone/tmp/chrome-mog --app=http://mog.com

This starts a separate chrome session that will stream audio to the settop box. Note: you are free to simultaneously start google-chrome without the flags and start a google chrome sessions that will use your local laptops speakers as well. The reason for the user-data flags is that you can only specify the pulse server to use when chrome starts a new session, and if you don't start chrome with the user-data flags, it will just open a new window in your existing chrome session rather than start a new one.

You may want to run:
PULSE_SERVER=tcp:[settop box hostname] pavucontrol
to fiddle with the audio settings on the settop box.

I suspect that this approach should work with any other internet music streaming service like spotify/pandora/etc.

Saturday, August 20, 2011

Back and internal pictures of Niles Audio PS-1 Phono/Aux A-B Switcher

For those of you who are considering buying a Niles Audio PS-1 and are wondering what it looks like on the back and inside, I took a few pics. Here they are:







Subscribing to a twitter feed in Google reader

Google reader is a bit picky about the types of feed URLs you can paste into it to subscribe to feeds. I found that the following works:

http://api.twitter.com/1/statuses/user_timeline/[username].atom

where you substitute [username] for the actual usename. For example, to subscribe in google reader to Facebook's twitter feed (http://twitter.com/#!/facebook) you click on 'Add a subscription' in reader.google.com and paste in:

http://api.twitter.com/1/statuses/user_timeline/facebook.atom

There is more documentation on this API at https://dev.twitter.com/docs/api/1/get/statuses/user_timeline. It's listed at the bottom in the 'Extended description' section with the words 'not recommended' :). The 'recommended' API, using URL parameters, doesn't work in google reader. Further note: I initially tried getting RSS feed format to work and didn't have any luck.

Plotting the ratio of two stocks

I found a website, stockcharts.com, that let's you plot the ratio of two stocks. In the 'symbol' field, you specify the two stocks separated by a ':'. For example, "goog:$SPX" to plot the ratio of Google and the S&P 500. As a side note, there is a link partway down, 'linkable version' that let's you bookmark the chart. A recent one I was interested in:

GOOG versus S&P 500 over the past year