Software engineer, motorsport fan, audio-visual geek, Christian. Sometimes emits words in blog form.
Monday, May 05, 2014
Build your own AMX replacement: part two (or, touchscreens can't swim)
Somebody had thoughtfully left a glass of water hidden right next to the AMX touchscreen. That morning, the inevitable happened; the touchscreen lost its programming after a short bath, and we were left with no way of controlling our video switchers short of manually dialling in each take, from a different room. The team stumbled through the morning service as best as they could, and I got a phone call at lunchtime: was my replacement system ready, and could I install it right now please?
The answers were no and yes, respectively. That glass of water, strangely enough, was one of the most useful things to be added to the A/V system in some time. ;)
One of the things I had agreed with the church leadership after my week of working in the Parish Centre was that I wasn't going to spend any more than I already had on components for the replacement system. I'd already invested a couple of hundred pounds all told, and knowing what happened to the last few upgrade plans we'd heard of, I wasn't going to commit more until the plan had been given both approval and budget. So when the call came, I didn't have all the necessary components to install a complete solution - I had barely any more than the bare proof of concept from November (though I had been developing the software in that time). Nevertheless, some control was better than no control, so I grabbed what I had and headed to church.
What I had at this point was a Raspberry Pi with the control software installed, a USB hub, and enough serial adapters to connect exactly two devices. A quick committee meeting decided that the most important things were the main switcher and one of the cameras, so those were wired up first; I made a Kanban-style board using post-its to track which devices had been moved to the new system and which were still wired in to the AMX. (Two of those post-it notes, "Please do not remove these post-its" and "thank you", are still there. That's just how our sense of humour works.)
We didn't have a control surface (the touchscreen being the single most expensive part of the system), but I did have an old netbook that was capable enough for the time being. I was also fortunate enough to have received back the router that church had "borrowed" which meant we could connect the server and client machines together reliably. With the help of several of the team, we managed to bring the first phase of the system online in just a couple of hours - finishing just as the 6pm team arrived to set up.
Enough narrative. Show me teh codez.
Because I work as a technical architect, I drew a pretty, if also pretty basic, diagram of the new system:
Essentially, the "controller" running on the server is a big interface onto all the devices in its bucket. It's worth noting that you don't interact with the devices themselves from the client, you ask the controller to prod them for you. This is partly by design and partly a consequence of choosing Pyro: because the devices themselves need access to the serial ports on the physical server, they would need to use a proxy object to be able to be RPC'd. (Actually, I'm not sure quite how much work that would be.)
Having the controller as this union of all device interfaces means that it is the only object that needs to be made available through Pyro. The disadvantage (if it so proves) is that all the devices have to be physically on one server. It doesn't take much imagination to come up with a scenario in which a more distributed system is useful - for example, controlling something which doesn't have serial cabling into the server room. But that can be a future feature when it's needed. I imagine that keeping track of all possible devices on a network is one headache too far right now!
Another interesting feature of the system is the controller's "sequencer". It essentially lets you queue up a sequence of commands to be executed in turn, at intervals of (at the moment and somewhat arbitrarily) a second. The first use case, and the one for which it was included, is the perhaps surprising candidate of the highly desirable "turn the system on" feature: it needs to turn on one power distribution unit, then pause for a short time before turning on the next one, and so on. I have no doubt that more clever things will make their way in here as use cases in future. The ability to record and play back macros is an interesting idea that I'll certainly be looking into in the future.
The code itself is probably the least interesting part of the system. It's up at GitHub if you're interested (the project with all the UI is up separately). More interesting is what we can do now it's running, where I'm thinking of taking it, and how I intend to make sure getting from here to there doesn't accidentally destroy the universe on the way. (The phone calls would be insufferable.) More of that in part 3, which I'll hopefully not take quite so long to write as I did this one!
Monday, February 11, 2013
Build your own AMX replacement : part one
![]() |
| The user interface of the AMX system, showing controls for one of our three cameras. |
- It's a hideous big black proprietary box (literally!). Because you need AMX accreditation before they'll give you a compiler, there's no way for us to change how it functions as the needs and equipment of the church change. Ages ago (before I'd joined the church) we replaced our projectors. Because they were a different make, we lost some of the ability to control them via the AMX - we couldn't update the control codes. Unless we shell out for an expensive engineer ordained by AMX, the way things were at installation is the way they'll stay.
- It's now at least ten years old, and old equipment has an inevitable tendency to die when you least want it to. That's not AMX-specific; that's just one of the fundamental truths of A/V engineering. But because it's a proprietary system, and because it's so old, it's extremely difficult and costly to effect repairs. We had a ballpark quote for replacing it with a modern system with similar capabilities: in the region of £12,000.
Twelve.
- To replicate as fully as possible the functionality and behaviour of the existing system;
- To do so in a way that was easy to maintain and change as the needs and equipment of the church change over time; and
- To do so wherever possible using standard, off-the-shelf components.
- Because they're cheap and readily available (not to mention cool), I would base the system around a Raspberry Pi. Note that, since the Pi runs Linux, it could be easily replaced with any other general-purpose Linux computer if needed later. The Pi also has the advantages of being small and low-powered. Most of the other components I needed to source (USB-to-serial adapters, USB relays, miscellaneous other serial gumph) were easily found on eBay or Amazon for a few pounds each.
- Though I hadn't really used it much before, I decided to write the control and GUI software in Python. It's a ubiquitous language, and in a church the size of ours it's not going to be too hard to find another Python programmer should I ever move on! There are also plenty of libraries available for all sorts of useful functionality: python-serial would take care of the serial port communication, Pyro would deal with the RPC needed between front- and backend systems, and on the recommendation of a colleague, Qt via PySide would be used for the GUI.
- To keep things simple, I would write both the backend and frontend code in Python; Android and iOS interfaces might well appear in future iterations, but they're not core functionality so they're stuck on the backlog for now. This keeps the first objective - replicating existing functionality - as the priority.
At least, that was the plan... and then last Sunday happened. And that's where we'll pick the story up next time.
Tuesday, June 29, 2010
"Is bad sound a sin?"
"It doesn't matter if it didn't sound good, as long as people were worshipping!"
"When you bring blind animals for sacrifice, is that not wrong? When you sacrifice crippled or diseased animals, is that not wrong? Try offering them to your governor! Would he be pleased with you? Would he accept you?" says the LORD Almighty. "Now implore God to be gracious to us. With such offerings from your hands, will he accept you? Oh, that one of you would shut the temple doors, so that you would not light useless fires on my altar! I am not pleased with you," says the LORD Almighty, "and I will accept no offering from your hands. (Malachi 1 v8-10)
Tuesday, June 15, 2010
Setting Up Sound for Worship
- ...put out required number of microphones - vocal or instrument mics
- ...put out required number of DI boxes
- ...make sure everything is plugged in to the right place and there are enough jack-to-jack leads for everyone
- ...put out required number of foldback monitors
- ...make sure everyone who needs it has power sockets available
- Unmute the channel
- Move fader to around -10 / -5dB
- Adjust the gain until the sound that you're hearing is at a decent level
- Worship leader: their guitar/keyboard, their vocal should be loudest. Maybe some kick/snare drum. Maybe a little backing vocals.
- Drummer: maybe their drums (we use in-ear monitors so that's not as daft as it sounds!). Lead instrument and vocal. Bass.
- Backing vocalists: Backing vocals loudest, leader vocals softer. Maybe some lead instrument. Maybe some kick/snare.
- Keys: The keyboard. In my experience, keys players find it universally impossible to hear themselves in foldback even when turned up so loud you don't need front-of-house. (Any suggestions, anyone?) Lead vocal and instrument. Electric guitar if there is one.
- Electric guitar: if they don't have their own amp they'll need to be in their foldback. Lead instrument and vocal. Bass, keys.
- Bass: if they don't have their own amp they'll need to be in their foldback. Lead instrument and vocal. Eguitar. Maybe kick/snare drum.
Thursday, May 20, 2010
So... that was a new experience...
Wednesday, December 10, 2008
On leading and serving
OK - hopefully that wasn't news to you. The question I pose to you is: when things aren't perfect, something goes wrong, or something is not done that needed to be - how do you react? I've seen about three different approaches recently, and I think it's a matter worthy of comment.
Take this scenario: at work (I work at a software firm) someone makes a commit that sets the build on fire[1]. Thanks to the wonders of version-control and continuous integration software, you can see exactly what set of changes was made, and who made them, to break the build.
At this point you have three options: you can leave it, and hope that someone else picks it up - or maybe somebody else is assigned to that area of the code, so they'll pick it up instead. (Fair enough, particularly at work.) Or, you could run an svn blame and find out who 'owns' the line responsible, then shout across the office, "${name}, you set the tree on fire!"
Maybe, and this is your third option, you could find out how the build is broken, fix it, then commit that fix (and receive the adulation of DeciBot[2] when it announces "All watched trees are now green").
Put like that, I guess it's reasonably apparent which is the best of the three options to take. But so often - and now I'm not just talking about work - people pick the wrong one!
I was reading Joel Spolsky's blog the other day; the entry entitled "My Style of Servant Leadership". In it, Spolsky tells a story from his time in the Israeli army:
Those that know your Bible will already be thinking of Jesus' words to his disciples, after an argument breaks out over which of them is the greatest. Get this:Anyway, on my first day of work for the sergeant major, I didn't know what to expect. I was sure it was going to be horrible, a suspicion that seemed to be confirmed when he took me to the officers' bathroom and told me I would be responsible for keeping it clean. And then he said something I didn't anticipate.
"Here's how you clean a toilet," he said.
And he got down on his knees in front of the porcelain bowl -- in his pressed-starched-spotless dress uniform -- and scrubbed it with his bare hands until it shined.
To a 19-year-old assigned to clean toilets, which is almost by definition the worst possible job in the world, the sight of this high-ranking, 38-year-old, manicured, pampered disciplinary officer cleaning a toilet was a shock. And it completely reset my attitude. If he can clean a toilet, I can clean a toilet, I thought. There's nothing wrong with cleaning toilets. My loyalty and inspiration from that moment on were unflagging. Now that's leadership.
"If anyone wants to be first, he must be the very last, and the servant of all." (taken from Mark 9: 35, NIV)Those words from Jesus - the very instrument of creation, the incarnate God of the universe, who washed his disciples' feet.
You can try the ostrich approach - that is, bury your head in the sand until it (hopefully) passes. You can take the "assertive" approach, and bang some heads together until (hopefully) everyone sees things from your point of view (or at least are speaking to each other again). Or, you could step out, and do something to serve them. There's truth in the cliche that actions can speak louder than words; how different things would be if, instead of shouting matches with harsh words thrown in both directions, we all opted for serving matches, both sides wanting to do things for purely the other's benefit?
That's both simplistic and idealistic; in truth, even in the best case it's rarely two-way, at least not straight away. But, leaders, persevere - not just because it's effective (it actually works!), but because it's the right thing to do, out of love for those you are serving. And it's not an easy road - because to serve others is to necessarily sacrifice some of your own ambitions and plans. Then maybe, just maybe, for the briefest fraction of time, you'll get a glimpse of better things to come. And when you get that glimpse, don't stop there - keep hold of it, keep "cleaning toilets", and perhaps you'll get there in the end.
Perhaps, God willing, we will.
[1] Note to non-software engineers: this essentially means 'someone breaks the program you're all working on'
[2] A friend of your friend, the DecisionSoft Continuous Integration watching IRC bot
Monday, February 11, 2008
5th Week: Learning a New Language
"And afterward, I will pour out my Spirit on all people. Your sons and daughters will prophesy, your old men will dream dreams, your young men will see visions. Even on my servants, both men and women, I will pour out my Spirit in those days." -- Joel 2:27-29, The Bible
I've been running visuals for the Late Service at St. Aldate's. In an "ordinary" service this would mean getting the words of songs on screen at the right time, and keeping the speaker on-camera - straightforward stuff and all things I've done so often, they've become reflex. (Watch me during a service I'm not on AV, if you don't believe that...) The Late Service has gone beyond that, using video backgrounds behind the song words to aid the worship.
"Uh-huh, what's so special about that?" you may (or may not) ask. There is the ever-present danger of doing it for the sake of doing it, for the technical challenge, or even to "liven up" the worship - to which you might well reply "So what?". Background visuals can be just a "nice touch" but I always strive for more than that; to become as much a part of the worship as each instrument in the band, as each heart of the congregation. What I do behind the sound desk is my worship to God, my offering laid out on the screens that everyone can see. (That, by the way, is why it upsets me when I have to put up things that I know are low-quality. I want to give God more than that.)
Tonight, as Owen was playing and singing "For greater things have yet to come, and greater things are still to be done in this city" I felt God say, "Look outside. Outside the doors." Outside? How could I do that? The collection of loops we have is limited and there wasn't what I wanted to show. I went for the only "outside shot" I had available to me: across the entrance foyer and out through the front doors. And someone promptly walked across the shot and out of the building.
It struck me (as I walked to hand in work to the comlab at 1.15am) that what I was doing was learning a new language. As with any language, when you start you have a limited vocabulary - and when you want to express a specific thing, you can be scrabbling for words, hoping vaguely to get your point across. Here, the language was pictures, the point was God's heart, and my attempts to communicate were in desperation the closest thing I could get to the picture in my head. But that's OK - any language takes time to learn. And I know the point was gotten across (thanks Emily).
I really want to develop this further - I want to take a camcorder out and just walk around Oxford for a day, for one. The more words you have in your vocab list, and the more you learn them, the more expressive you'll be in the language. And the more new words you add, the less likely you are to fall back to the very basics - "Bonjour, je m'appelle James, j'ai vingt ans, j'habite a Oxford..." has a certain equivalence with those time-lapse clouds. They have a place, but there's so much more to French (right, Jenny?)
Oh, go on then.
And as for my vocab list? It'd be really useful if the thumbnail menu we have actually linked in with VLC to select what video was playing. And seamless looping in VLC would be nice, too... The former, at least, I've already prototyped.

