moltenmercury.org

   HomeDiaryGalleryAbout Register Log in

moltenmercury.org

Rants and Ramblings

Rants and Ramblings


pyNAD – controlling audio amplifiers from Python

Thursday, December 31st, 2009

I recently had the opportunity to play with one of NAD’s new amplifiers that come with a serial port.  With an inexpensive USB to serial adapter, it’s easy to imagine how it might be controlled from a media PC.  Fortunately, NAD have released the specifications of the protocol to the general public (unencumbered as far as I can tell), so it was a simple task to write some Python code so control the amplifier.

The attached Python script is pretty rough and ready, but is capable of turning the amplifier on and off, and changing the volume up and down.  The script has been written for Ubuntu Linux but should work on any distribution with Python and pySerial installed, and should probably work on Windows also.  Usage of the script is fairly straightforward, ie

  • pynad.py {command}

where command is one of

  • vol- or vol+ : decrease or increase volume
  • on or off : turn amplifier on or off
  • offConditionally : turn amplifier off if it is set to input 5 (Auxiliary)
  • onAndSetAux : if the amplifier is turned off, turn it on and set it to Aux input (if it is already on, the input is not changed)

The final two commands are useful for running at shutdown / startup to provide a fairly intuitive control of the amplifier without interfering with any potential non-media PC uses (such as if someone was listening to a CD at the time when the media PC is shutdown).

The attached zip file contains the necessary Python code and an example upstart script for Ubuntu Karmic.  In addition, you may need to customise the pynad.conf file to change the serial port used (/dev/ttyUSB0 is probably suitable for most people).  Windows users will need to change this to COM5 or similar.  The pynad.conf file is looked for in ~/.pynad.conf or /etc/pynad.conf .

pyNAD

Melbourne – a photo diary, part I

Sunday, May 3rd, 2009

Melbourne. A city of contrasts.
(click on photos to make them really really big)

Bustling streets. Cars zoom past on an 8 lane highway. A tram rumbles down the middle of the highway on its own timetable. A criss-cross of power lines for the tram dot and dirty the landscape. Trees line the centre of the road.

St Kilda Road

A short walk from the main road. Sanctuary. St Kilda Botanical Gardens. People picnic in the shade. Others sun-bathe lazily in the park-like surrounds. Kids play. A small number of pot people gather near the fence.

Pot Land

The Esplanade. Miles away from the main road, but only a 5 minute walk. Tranquility. The smell of sea salt. Waves lap the shore. A lighthouse stands sentinel over the crowds milling along the beach. Skateboarders add to the drone of the waves. People play and dance in the water, on this 18 degree day at 4pm. People sit and watch the water. A procession heads out on to the pier.

St Kilda Beach 2

Meanwhile, the port of Melbourne and the dockyards slumber.

St Kilda Beach 1

St Kilda Beach 3

Heading away from the beach. A sign informs all who care to notice that this is a 3 smiles per hour zone.

Three Smiles per Hour

Cake shops litter the side of the road, bustling for attention.

Cake Shop

Old mixes with new. Rich mansions stand beside much more modest abodes. Two apartments side by side. One has been renovated. The other stands untouched.

Old and new

To be continued…

Home Studio

Sunday, March 29th, 2009

I’ve finally got my “studio” setup the way I want it.

Studio Rig

There’s not much more to say, the piano’s hooked up the computer via MIDI so I can play / compose and experiment with different synths in FL Studio (the new name for “Fruity Loops”) and input music into Sibelius. The guitar is at the other end of scale, not even requiring power for its operation :p. The desk I built out of copious amounts of MDF (it was cheap), the amplifier is home built and the speakers are the ones mentioned in a previous article… (followup to come once I’ve taken some photos)

Speaker Rebuild – part 1

Saturday, March 14th, 2009

I have some old Yamaha speakers that I think could do with a refurbishment. Some quick tests with a microphone basically confirmed what my ears were telling me: could do better! Since these were cheap speakers from TradeMe I can’t expect miracles from them. So I’m left with two options: buy new or refurb. For the amount of money I’d want to spend on a speaker, you can get bookshelves – but you still need stands and they tend to be bass reflex units, which I don’t like that much as they tend to sound unnatural. Anyway, for the same money or less I can refurbish my current speakers, and it’s more fun.

The full rebuild will involve
* New tweeters (high frequency – soprano and above)
* More foam inside the boxes to increase effective volume and damp resonance
* Some cone damping fluid applied to the old paper cone woofers, which appears to stiffen a bit like varnish (I’m not sure if there will be a benefit, but worth a try)
* New crossover to handle the smooth transition between woofers and tweeters.

At the moment, only the tweeters have arrived, so the first change has been to expand the holes so they fit. Unfortunately, I can’t really test them yet without the crossover.

This image shows the speakers before the holes were cut out, after I removed the existing woofer and tweeter.
Speaker Box, minus the drivers, before modification

This image shows the aftermath of my foray into jigsaw cutting. The mickey-mouse ears are so the little electrical connectors can fit into the box.
Speaker Box, after mickey-mouse holes cut for new tweeters

And these are the drivers: top left is the woofer; left bottom is the old tweeter; right bottom is the new tweeter by Vifa.
Speaker Drivers

Stay tuned. And yes, I will be updating more often! Some exciting news soon!

Google may harm your computer

Sunday, February 1st, 2009 Google may harm your computer

Apparently, Google’s malware engine has hit a major speedbump in the last 24 hours.  Now even Google may harm your computer.  In fact, the entire internet is a potential threat.  Disconnect your computer for the internet. Now.


Bad Behavior has blocked 32 access attempts in the last 7 days.