Setting up a Windows Show Machine (with a Little Beaudry Interactive Magic)
Regardless of whether you like programming on Mac or Windows, sometimes you will have your hands tied when you are putting a show machine together. The client might prefer a cheaper option or one more compatible with their IT department and tell you to work on Windows, or you may find you are tied to some kind of hardware or Windows-only form factor.
What I am talking about here is the kind of situation where you are putting in a machine to run a show for a period of time - say, at a gallery or some kind of venue or institution. You almost certainly will have to deal with scheduling issues, hours of operation, and maintenance access. You may or may not have access to the internet, and you may not even be able to access the machine once it is installed. So, let’s say the challenge here is “set and forget”.
In one of our early meetings with David and Sean at Beaudry Interactive (b/i), I talked to them about this. (As you may know, we are showcasing their work this month including an interview with David, and a walkthrough of one of their projects.) I mentioned to them that this was an area I always had some trouble with. Their response was, “Oh, we’ve got that completely nailed. We’d be happy to share this stuff with the community...”
!!!
So here we go....
The Gear
Of course, I'll need to provide you with some concrete examples, which was a really a giant pretext for me to have fun. I had such a blast putting this together last week. Here are the parts I'm using for my “show...”
For the main machine, I decided to try the new i3-based compute stick from Intel. (Find an Anandtech review of it here.)
I added in a 128Gb microSD card for storage.
I was really curious to find out how this little thing would perform. The answer? It works like a champ for audio and not bad at all for video. While it’s pretty easy to load up enough GPU processing that HD video output starts to flicker, it will play back HD video content very smoothly and have plenty of headroom for doing other tasks in the background. For processing audio, it ran all my stuff just fine.
The one trick with these little machines is the power supply! It’s now one of the larger parts of the whole deal, as you can see:
The 9-volt battery is there in the picture to give you a sense of the scale. The HDMI jack is at the bottom of the CS stick, so you can just plug this straight into a TV and rock on.
For the audio card, I used one of my favourite recent bits of kit, the Novation Audiohub2x4 (you can get these for $150 at Sweetwater now). The great thing about this box is the built-in 3-port USB hub. The compute stick has one USB3 port on the body of the device, and 2 more in the power supply, so this addition of 3 on the audio interface means you have tons of room to add stuff and not much in the way of wall warts to deal with. The ASIO drivers that come with the box run fine in Max - this interface is completely gig friendly!
MIDI out to the synth is via a Kenton USB Solo MIDI interface - mainly because that’s what I have lying around in the studio. And the synth? That’s a whole other story.
There you have it. So - I have my gear all hooked up and I have a Max patcher which plays my synth and processes the audio from it and spits it all out up and running.
Now I want to stick it in a dark closet and have it startup and shutdown on a schedule.
Make a Standalone Application
The final step in working on your show code is making it into a Max standalone application. You can then summon your whole show into existence with one line of Windows Powershell scripting. I know people out there complain that this is cumbersome and doesn’t allow for rapid editing and bug fixing.
Honestly, if you need that much flexibility when you are installing, you probably have lots of other problems going on as well. As far as the guys at b/i are concerned, they’re talking about shows which may run for years that have been developed and signed off by a whole committee of client reps. For them, there are no last-minute fixes. Their stuff has been tested for weeks.
Windows PowerShell (and a PDF!)
Another advantage of creating standalone applications out of your Max code is that you get to leverage some pretty tweaky stuff in the Windows Powershell. Suppose that you need to run 2 applications or 2 instances of Max, and you have found out that you can increase performance by telling Windows which cores of your CPU to restrict each app to. You can do this in Powershell using the Processor Affinity settings.
Which leads us to the awesome centerpiece of this article:
This document is the motherlode of Windows Powershell Max scripting as used by the guys at Beaudry Interactive (and a whole lot more). Sean is being modest when he says, “This is all just known information that's out there” - it was sure largely not known to me. This document represents a significant head start and is the product of (no doubt) countless hours of mucking around with this technology to make it useful to Max programmers.
On behalf of you all, I would like to thank b/i for their generosity in making this information available to the Max community.
I’ve made the document into a PDF because you’re really going to want it everywhere. I dropped it into the dropbox folder I shared with my show machine so I could cut and paste from it into the Powershell IDE (called “Powershell ISE” ) while I tweaked the scripts for my “show”.
Basically, and the document makes this clear, the idea is the following:
Create a script which manages the startup of your show software. You can do this right in the Powershell ISE, debugging and running it as you develop it.
Then you can call your Powershell script in the Windows Task Scheduler. There are a number of fine details to do with getting around security issues, and there’s also a technique described in the document for making your full screen apps completely full screen.
That’s about it. I hope you have as much fun playing with Windows Powershell as I did. In the end, I basically ended up creating a hugely complicated alarm clock, but it runs like a dream.
If you have questions about the b/i document or would like to know more about the Compute Stick, let us know in the comments.
Happy Patching!
by Andrew Pask on July 19, 2016