DIY Audio Snake, Part 1

(Alternate title: “An Exercise in Masochism”.)

At the beginning of summer, having graduated and left all the audio tech-related roles I had held in Wolfville, I was really missing monkeying around with mics and mixers. Fueled by that hole and thanks to Layman’s continual prodding encouragement, I ended up pitching in on audio tasks at myChurch. To make a long story shorter, the organizational hierarchy of the church places the Audio, Video, and Lighting under the broad Production (“Prod”) umbrella. As such, equipment from all three Prod teams is usually kept in the same general area in venue. More than that, to the untrained eye not paying attention to their contents, the road cases containing video, audio, and power components (largely being cabling) all look the same (assuming the label on the top of the case goes unread). Usually this doesn’t matter much because anyone on Prod learns to distinguish them pretty quickly, but when someone from another team is lobbing cables around, which bin those cables end up in can be a bit of a tossup. This leads to XLR and HDMI being found every whichway when things aren’t struck properly.

In aggressive reaction to an overabundance of HDMI being found in all the wrong places, I threatened to Brojo that I’d build an XLR-to-HDMI adapter and use his video cables to run audio the next time the cables got mixed up.

We had a good laugh. And then I started thinking about how such an adapter might actually work.

HDMI is 19 pins. (Some cheaper cables supposedly don’t include pin 14 which isn’t used by the spec, but I’m getting ahead of myself.) Divided by three (hot/cold/ground), that rounds down to six – six channels of balanced audio. The HDMI standard even defines four grounded, two-conductor channels (pins 1-3, 4-6, 7-9, and 10-12), and one grounded, three-conductor channel (pins 13 and 15-17). Well, that’s far too convenient to not abuse, and suggests that cable composition may even be amenable to carrying at least four channels (ignoring, for the moment, the absurdly low wire gauge used in HDMI cables). And even though they’re maybe not strictly suitable for it, I can try to run another channel over the leftover pins (presumably 16, 18, and 19) just for kicks.

So that’s the carrier. Without actually trying it, I’ve no idea if microphone-level audio signals will actually make it through the cable – both are low-voltage, but I imagine audio is far less current (and therefore far more susceptible to signal loss) than digital video. But working on the assumption that they will, what do we do with the connectors? HDMI is tiny. I don’t solder tiny. I try not to even work with tiny. My fingers aren’t tiny or all that steady, so at a point it becomes something of a physical impossibility. So that means getting some breakout boards – small circuit boards with easily-accessible solder pads connected to a mounted connector (in this case, female HDMI).

And then we need to think about what connects to the breakout board. I could go directly to microphone cable and then to the XLR connectors. But how do you protect that? Just by being used whatever cable comes out of the XLR is going to have tension applied to it, and I don’t want to place tension directly onto the breakout board: my soldering is not that strong, and even if it were, you don’t want the connectors taking any more stress than can’t be avoided. Plus, the breakout is going to have to be mounted to… something so it can be handled easily. And what if this doesn’t work for audio, but I still want to reuse the idea of abusing HDMI as a carrier for analog signals? Maybe it won’t behave well for audio, but I bet you $5 I can run a whole bunch of low-baud serial lines over HDMI. (For what, I don’t know, but it’s a use-case!) Let’s try to avoid connecting the HDMI breakout directly to the XLR, then.

The most commonly-used connector I can think of with around the same pin count as HDMI but which uses a larger form-factor is DB-25, commonly used for parallel port communication. It’s six wasted pins, but DB-25 connectors have sufficiently wide pin spacing to be easy to work with directly, and connectors are plentiful and cheap, both to buy new and to pillage from old equipment. Beauty. It’s more work, because I’ll have to connect each HDMI breakout to a DB-25 connector and then build DB-25-to-XLR pigtails, but it solves both the stress and reusability issues.

I don’t want the HDMI breakouts and DB-25 connectors floating in mid-air, so I’ll have to house them in project boxes. An enclosure that opens on both ends (a rectangular tube with caps on the ends, if you will) would probably be easier to work with than a container with a lid, as I can detach the endcaps to cut HDMI and DB-25-shaped holes in them. I’ll have to solder the wiring harness between the HDMI breakout and DB-25 connector, then thread one connector through the enclosure, then attach the endcaps to the connectors, then fasten the endcaps to the enclosure. As long as I make the wiring harness long enough, it shouldn’t be a problem.

What genders do I want to use for the DB-25s? On one hand, the HDMI port on both breakout boxes is going to have to be female, as HDMI is male-to-male. But the cable is still technically going to be used directionally, so I think I’ll put a male DB-25 on one box and a female connector on the other. Then the pigtale with the female XLR connectors will have a male DB-25 connector and vice-versa so the XLR and box genders match.

So, here we are: two HDMI-to-DB-25 breakout boxes, and two DB-25-to-XLR pigtails. Given that I’m cheap and not in a huge rush, I hit up eBay for the required doodads and came up with this shopping list:

Breakout Boxes

Item Quantity Total Price
HDMI breakout board 2 $24.57
Female DB-25 connector 10 $5.29
Male DB-25 connector 10 $5.29
Connector anchor 25 $5.29
Connector anchor nut 25 $5.29
45x45x18.5mm project box 2 $11.80
22AWG wire 10m $2.96

Pigtails

Item Quantity Total Price
XLR connectors, male/female pair 10 $20.99
Microphone cable 10ft $11.92
Female DB-25 connector with hood 5 $5.29
Male DB-25 connector with hood 5 $5.29

(Huh. That is actually starting to get really expensive. Whoops.)

I accidentally ordered too little wire for the breakout boxes (5m instead of 10m) so I’m waiting to hear back from the seller on whether I can cancel or extend that order. And, I’m dubious about the quality of the microphone cable: I ordered thin stuff to more easily fit six cables through the DB-25 hoods, but I’m not sure how easily I’m going to be able to solder it as it’s a copper-tin alloy. Fingers crossed.

As for the high quantities of DB-25 couplers and connectors, I figure having some spare around for future projects isn’t a bad thing. I also wanted to get as much as I could from the same seller in order to get a reduced shipping rate.

I’m still not totally sure how the HDMI breakouts will mount to the project box endcaps. Bolts, sure, but how long? I don’t actually know how deep the HDMI connectors on the breakout boards are and I’ll need spacers. Have to wait until the bits and pieces are in my hands, then I’ll probably get something from Home Hardware.

Speaking of dimensions, I’m unsure that the breakout boards will fit inside the project boxes. The boxes are supposedly 12.9mm tall internally. The measurements for the breakout boards are obviously wrong as they’re listed as 25.4×25.4mm when they’re visibly wider than they are tall, but I suspect 25.4mm is the accurate height and they’re close to twice that in width. I think I might have to get bigger boxes. That’s a huge and embarrassing oversight, especially as I picked that box specifically because it looked like it was probably wide enough to fit the connector. Oops. Once the breakout boards show up, I’ll get a correct measurement. And then order new boxes. Maybe something like this – that would be nice if it would work because it’s not too deep, and I don’t need any more depth than I already have.

Stuff should start showing up in about two weeks. Depending on the order in which things arrive, I can start working on the box and the pigtails independently, although both of those rely on the DB-25 connectors showing up. Fingers crossed that it all shows up before Christmas.

The Hotel Kit

Over the past four years, I’ve had numerous opportunities through the programming competition team (and one with Axe Radio) to go abroad for a night or two in attendance of competitions or conferences or what have you. Beyond the event proper, these sorts of things are as good an excuse as any for a bit of fun on nights after the scheduled activities for the day are finished. In order to facilitate such shenanigans, I’ve taken to dragging a collection of odds and ends along with me to whatever hotel I end up in.

A Spare Laptop

This isn’t about a backup plan in case something happens to the good one. This isn’t to lend to someone needing a quick Internet fix (although it’s handy for such purposes). This is some old beater you can connect to the TV as you’re unpacking and leave there until you leave. It’s nice to just leave it playing music as you’re booting around the room, and it’s a far superior option to passing a phone around the room when someone wants to show a YouTube video. And, by using a spare, not your daily driver, you don’t ever have to move it or unplug it until you’re ready to check out. It should be something you don’t mind losing if something gets spilled on it or it takes flight; old netbooks make great candidates. It ought to have a decent Wi-Fi adapter because hotel Wi-Fi is notoriously flaky, and both VGA and HDMI outputs because you never know what will be available on the TV in the room.

Cables

All of them. VGA and HDMI for reasons as noted above. Ethernet because you might need it at the conference. MicroUSB (with AC adapters!) because everything needs to be charged. Don’t forget laptop adapters. Don’t forget a male-to-male 3.5mm audio cable for the auxiliary input on the rental car for the drive down and to run laptop audio into the TV if you do have to use the VGA input.

Movies

If you’re there for more than one night (say, two nights), you’re almost bound to be bored on one of them, and with hotel Wi-Fi being what it is, video streaming is out (although music is usually OK). Make sure you stuff at least a couple fairly polar-opposite options onto the laptop before heading out the door.

So that’s about it. None of it that inobvious, but easy enough to forget as you’re haphazardly throwing things into a bag the night before.

Feel It

I’m a pretty hands-on guy. I like to twist knobs, push levers, turn dials. A whiteboard or flip chart is my best friend when scribbling down ideas, not because I particularly subscribe to the tenets of the corporate office space, but because I like scratching down words and diagrams on something I can feel.

I’ve been incredibly lucky to work at the same place for four summers running, and they’ve asked me back for a fifth. Lucky not because of the stability (although that’s a definite plus), but because the company is great and the product is really cool. The details of the product are, while interesting in and of themselves, irrelevant to this discussion; what matters is that it’s a real, physical product. It’s a beautiful blend of engineering: electrical, mechanical, and more than a little software. And I can feel it, and I can interact with it.

Which brings me to a huge disappointment I find in software: the impossibility of picking up, of playing with the things I’ve made. The intangibility of software is one of the leading reasons I often wish my aptitudes lay elsewhere.

I don’t think this trait is particularly limited to me. For example, despite the vast improvements computers have brought to the world of audio engineering over the last few decades, people still spend large bags of money on buttons and knobs and keys not because they have any impact on the range of sounds the computer can product but because they provide a more natural means of interaction with the machine. On-screen widgets which don’t provide the same tactile feedback as physical controls are simply not as satisfying to use nor as rapid at manipulating the underlying values.

It’s in our nature to want to interact with things physically. After all, fingers are pretty good at it, and we do have eight of those plus another two thumbs to help us hang onto the things we’re interacting with. Wouldn’t it be nice to be able to interact with computers in ways more akin to our nature? There have been some attempts to manufacture controls adaptable to the wide range of input tasks that software can demand; on the opposite end of the spectrum, some static controllers just have inputs for everything imaginable.

Still, these are all pretty specialized pieces of equipment: generally either specialized for gaming or multimedia production. It’d be super to see something like a USB version of the Big Knob on every desk, as standard as a keyboard. Some keyboard manufacturers have attempted to achieve something like this by jamming a million extra buttons onto keyboards. I don’t think buttons are the answer: binary states are too limiting. But then, they’re also very general, and software is a very general universe. There are so many applications for better input solutions, and then software would have to expose itself to the new controllers, and it’d be the same headache as the introduction of the mouse all over again.

When can we have our interactive hologram displays, please?

Words

I have an enthusiasm for regular languages which borders on fetishism. PineConeBoy has had reason to half-chastise, half-mock me on several different occasions due to my well-meaning but frustratingly clumsy attempts to enforce regularity on the English language by intentionally breaking grammatical rules or restricting myself from using more-inconsistent word forms. For example, I used to capitalize every word of titles, without exception; even though I realized capitalizing “of” and “the” was grossly incorrect, it was a form of standardization. More recently, I tried to eliminate the “-er”/”-ier” adjective suffix on the basis that it doesn’t apply evenly; for instance, “happier” is a word, but “funner” isn’t. However, “more happy” and “more fun” are both valid, so for a while, that’s what I tried to stick to. (That stopped working the second someone pointed out how stupid “more easy” sounds. Or something like that. And the someone was probably PineConeBoy.)

The point being, even though I did horribly in my formal languages/translators class, I do find the topic near and dear to me. I’ve spent hours completing regex crosswords (and I’d recommend anyone else do as well — they’re a great way to get your head around some of the more complex regex operations like backreferences). I once cleared a competitive programming problem in the first ten minutes of the competition because I was able to quickly construct a pattern to match the solution. Maybe it’s because of this, or maybe it’s the other way around, but  it frustrates greatly when others overlook the importance of syntax in effective communication. (I know I go on about that topic a lot, but I do feel it’s significant!)

Some friends and I were hanging out earlier, and the topic came up of how Pickett22 crowdsourced a portion of the proofreading and editing of her master’s thesis to her Facebook friends. It was noted how she had to spend a significant amount of effort (although not as much as if she’d had to do it all herself) proofreading and correcting the returned proofreading and corrections.

Nicho and Rinnly and I have had numerous conversations about the importance of clarity in written informal communication, especially with regards to comments on websites. Nicho sides strongly with the viewpoint that your ability or otherwise to effectively verbalize your message should not decrease its importance as perceived by its recipients. This on the basis that the voices those who haven’t been as privileged in their ability to learn their target language shouldn’t be silenced. To me, that also assumes a great number of ESL communicators. My perspective is maybe a little more cynical: assuming instead that these are native speakers, I feel that if you can’t be bothered to put effort into coherently stating your opinion, it’s probably not worth it to me to spend more time deciphering it than you spent writing it.

I don’t really have a pithy conclusion or even much of a point. Guess I’m just contributing further to the noise. At least it’s mostly syntactically correct.

Laptop lifetime

The question was posed on the whiteboard in the CS student lounge:

Over n semesters attending Acadia full-time, how many laptops m have you used as your primary mobile computing device?

The answers were as follows:

n m
8 4
8 2
16 3
6 2
8 2
8 3
6 1
6 2
8 1
8 1
8 2
8 2
8 2
8 4
14 2
8 5

Later, a corrolary question appeared:

Over n semesters, how many laptops m have you bought for school?

It received the answers:

n m
8 0
8 3
14 2
8 3
8 1

The two takeaway points for me are yes, my laptop consumption is considerably above average (8/4 for the first question, 8/1 for the second) and hardly anyone below fourth year ever sticks their head through the door of the lounge. In fact, these numbers make me wonder if first- and second-year students are aware of its existence.

Oops

I broke my tablet about a month ago. The screen, specifically. Left it charging on the corner of my bedside table then went to grab it without considering the length of the cable. Even Gorilla Glass doesn’t much like a three foot drop onto ceramic tile, it would seem. (Sorry, I didn’t drop it — I used gravity to place it on the floor, as quoth Rinnly in reference to her own recently similarly-affected cellphone.) Funny, second time in a matter of hours that I’d done that, except the first time was with my plastic-screened phone and I don’t know that it even noticed — it’s seen worse. So there’s Oops #1: lack of attention.

Oops #2, it seems, is having ordered a replacement screen as a standalone piece. I knew it was going to be fun to detach the bezel from the old screen, but I didn’t know it was going to be this much fun. Decided not to get one because it would’ve been another $25 after $100 on the screen. Might’ve been worth it. “Recklessness”, let’s call it — the Oops, not the bezel. After half an hour of alternately waving a decades-old hair drier around the edges of the screen in an attempt to loosen up the glue and delicately prying it further and further back, I gave it a little more of a tug, fractured the screen (not that it wasn’t already fractured before, but it’s more to clean up), and realized the glue isn’t simply on the bezel — oh no, that would be too simple. ASUS, in their infinite wisdom, decided that the bezel should be adhered to the screen (and vice versa) by means of a sort of stencil layer of double-sided adhesive plastic. Gee, lovely. So I’ve already torn that in one place. I hope the replacement screen sticks down OK. As far as detaching the old screen goes, I’m going to cross my fingers and hope it’s sunny tomorrow so I can just leave it out in a warm place.

The replacement screen shipped out with something that might help get it to stick: three pieces of 3M 300LSE. Never run into it before, but Google tells me it’s “adhesive transfer tape”. Peeled back a little corner; seems to be really high-quality double-sided tape, like the stuff that’s on there that I’ve partially ruined, but not cut to shape. Might work. Might have to work. I guess that makes Oops #3 my apparent inability to retain anything from the disassembly/replacement video that, for once, I did bother to look up before I was half-way through the process — again, lack of attentiveness.

Something else the replacement came with was a spudger/prying tool. Nice. I’ve been too cheap to get one. Guess this means I don’t have to. Maybe Oops #4 is that I end up trying to do this crap on a semi-regular basis without adequate tools — unpreparedness. Every time I get new tools, I outgrow the problems that required those tools. Never seems to be because I’ve just solved everything. They say that when all you’ve got is a hammer all problems are nails, but it’s a weird sort of hammer to deal with sixteen-foot tall nails made of grapefruit.

I really like The Codeless Code. They’re software development koans. A cool concept. Sometimes they’re a bit far out, but other times, they’re bang on. The most recent one, Ten Thousand Mistakes, is a good one. Reviewing the four Oopses I’ve just mentioned (is immediate retrospect bad? Is that Oops #5?), none of them are new problems to me and #1 and #3 are even duplicates. Eh, I’ve got another nine-thousand nine-hundred and ninety-six mistakes with which to be original.

Windows Hate

I tried installing Windows 8 on my netbook last night. Everything went great: the install only took about fifteen minutes, and it came up with Wi-Fi support, the proper screen resolution, etc. Except, on my 1280×720 netbook, every single Metro app fails to launch, politely informing me that “The screen resolution is too low for this app to run.” Really, Microsoft? You’ll support 1024×768 as a minimum, but 1280×720 – 48 pixels shorter – is just right out? Instead, you’re endorsing the marketing-drone-constructed bastard that is 1366×768 as the lowest-supported widescreen resolution? Well, alright then.

Tomcat 6 with self-installed JDK

If you’re trying to install Tomcat 6 (or anything else with a dependency on Java) under Debian with a self-installed JDK (say, the Oracle Java 7 JDK) and you want to avoid apt-get grabbing OpenJDK, then your best bet is to use equivs to create a dummy package pretending to provide default-jre and default-jre-headless (and, if you feel like it, default-jdk). If you’re feeling particularly lazy (or are future me wishing he’d kept the resulting package around to reuse later – hello, future me!), here’s one I made earlier.

Edit 2013-12-16: This method hasn’t really worked for quite some time now, but that’s OK, as java-package has been updated to support Oracle Java 7. Along with satisfying the dependencies, it does a much better job of installing the JDK than most people will.

A note on Eclipse: Instead of depending on java-compiler like it ought, Eclipse depends on default-jdk, and more weirdly, on sun-java6-jdk. Even if you install Java using the above java-package method, you’ll still have to use an equivs package to provide those two dependencies if you want to keep OpenJDK off your system. Here’s a prebuilt package that provides just those two dependencies.

Motivation and Side Projects

For a long long time — starting in 2009, actually — I’ve been hacking away on a PHP framework, writing loosely-connected bits and pieces of code here and there as the mood struck me, repeatedly reconsidering the implementation of components as web development practices continue to evolve and as I continue to learn more as a developer. And at the end of the day, what I consider the “trunk” of the project (including the literal trunk in source control) has never consisted of more than a handful of parts that benchmark blank pages nicely but don’t really do anything.

And every once in a while, some job thing will come along with requirements perfectly suited for the application of that perfect framework, the manifestation of which exists only in my mind. And so I sit down, and in a few days, I hammer out something pretty close to what I’ve got in mind. Sometimes I’ll reuse existing components — I’ve got a database singleton I’ve been hauling around for at least a couple years now just because it works and I don’t have to think about it — but it’ll mostly be original to that project. And when the project’s done, I move on with my endless conceptualizing of something better. I may update the external original of anything I dragged in that that saw updates, but for the most part, I feel that my employer (none of these situations have ever been contract work) owns the implementation I’ve written on their time, so I take concepts with me, not code. Those concepts get rolled into the never-eventual “what I want to have”, and I go back to tinkering until I next need to pull out the stops.

I’m not really sure why I keep this up. Based on the time it’s taken the times I’ve had to finish an implementation — two or three, now — I could, if not finish this, at least have something ready to rumble in about a week straight of plugging away at it. Maybe some part of me enjoys the perpetually unfinished state: it’s a chance to continually explore (or at least contemplate) new development methods and design patterns. I think it’s more likely that without an objective clearly in sight, I find it hard to make progress on milestones. Every time I’ve had to get something operational for work purposes, it’s been a subquest: “vanquish the demon” requires “craft a website”, which has one completion path involving a frameworky backend. But at the same time, I think defining a use for the framework would somewhat rob it of its usefulness; despite the futility and inevitable over-complication involved in any attempt to craft a perfect be-all, end-all base for everything else, something reasonably close to that would be nice. Maybe I can settle for more clearly defining what it must provide.

Or maybe I’m just lazy and get distracted easily and someone throwing money at me makes me more likely to finish something. That could be it too.

LARS

LooseDetective and I completed our project for Software Engineering Thursday night. It was due at midnight, but I didn’t get it e-mailed off until 00:02:55 Friday; multitasking live sound for a band at the student bar* and frantically debugging a JTable model does that to you.

LARS — Like a Rental System — was a huge undertaking, and I’m still not quite sure how we managed to finish it at all, even a couple minutes late. The topic of the course was software engineering: the process by which software is designed in relation to its development cycle. As a class, we were tasked with the architecture of a video store rental system, and split off into self-selected teams to execute it. Thanks to the Asian professor’s thick accent, none of us clued into the fact he really wanted us to implement the system until about a month before its due date; even still, Loose and I didn’t actually sit down and start writing code until last Sunday afternoon.

Still, I’m fairly happy with how it turned out: despite what one might think, there are very few really hackish parts to be found in the codebase (probably to Loose’s dismay, due to the amount of extra time consumed in doing it “the right way”); actually, at the moment, I can’t think of a really good example of one. The design went through several changes as development progressed; the largest similarity can be found between the original design documents and the finished product in the data structures. Its largest issue is severe over-engineering: earlier in the semester, when we weren’t aware that we’d have to implement LARS, we designed an excessive number of features into it, including the ability for some items to be rentable, others just purchasable; price modifiers, allowing the modification of purchase/rental price and rental duration on a per-item basis; and a couple other things like that. In retrospect, had we known that we’d have to implement it, we probably wouldn’t have done that, but I do feel I was the driving factor in adding those, which makes me a bit guilty of the added work put on both of us.

Despite the crunch and stress associated with completing a 4,500-line-of-code project in five days, I’m not sure I, at least, would have been motivated to complete it had I started it any sooner: I feel like I would’ve put it off with thoughts of “oh, that’s started, I can finish that later” and then would’ve ended up rushing to get most of it done in two or three days and made an utter mess of it. But I don’t know; this is the first big project I’ve worked on side-by-side with another coder since Slyf and I did the Smiths Falls Chamber of Commerce website in 2008 (which I won’t link to, as it’s since had its interesting functionality gutted). That was an interesting aspect: even though I didn’t see this article until yesterday, I was most definitely the guy in a room. One may argue that that’s OK in a crunch-time scenario where the others involved don’t have experience with Methodology A or Technology B but I still feel badly about it, and it’s not the first time I’ve noticed this sort of thing: even though Rinnly and I don’t work side-by-side in the same codebase, I feel there are times where I’ve held up project progression or at least hindered teamwork with the magic words “no don’t worry about how x is going to work, I’ll take care of it”.

Anyway, it’s done now. All teams are to present their finished work to the professor (and, as I understand it, the class) tomorrow morning; as over-engineered as ours is, I think we can manage to show its ins and outs pretty quickly and still manage to impress. And then we wait for the mark — it would really suck if the almost-three minutes late does count against us and we get a 15% deduction on what may be an otherwise-perfect submission.

* Speaking of which, Adam and Steve did an absolutely fantastic job and I can’t wait until they next perform. Hopefully they don’t get the clever idea of doing a run of concerts over summer while I’m not here (please? Please don’t?).

Years later edit: I’ve converted the project’s Subversion repository to Git and uploaded it to GitHub.