Speaking of live music, if you've ever watched our RealVideo webcasts while a band was on stage, you probably noticed that audio and video were at least ten seconds out of sync. I think I've fixed that, but I won't know for sure until the next time there's someone performing on stage (which looks like it's going to be a while.)
The webcasting setup we have is pretty convoluted, and I just made it even more convoluted to fix this. The goal is to webcast the main room when we're open (in both MP3 and Real) and webcast our archives when we're closed. That's simple enough for the MP3 streams: I just have the input source to the Icecast server change based on a timer. But getting those archived MP3s into the Real stream was trickier.
The way it used to work is that the MP3 encoder machine did two things:
- stream MP3s from either live audio or the archives;
- play analog audio of whatever is currently being streamed out its sound card.
Then the RealEncoder machine had its soundcard input coming from the soundcard output on the MP3 machine. That made the two always be in sync, at the expense of another decode/encode step (but that doesn't matter much, because RealAudio is way lower quality than MP3 anyway.) The only problem was that all that encoding/decoding introduced a big delay.
So the change I made was to introduce a switch: when we're open, the RealEncoder machine gets its audio directly from the main room; and when we're closed, it gets it from the MP3 machine. This switch is a pair of ST-SSR1 relays. I wired up their control lines to a pin on a parallel port, and the decision of when to switch from A to B is made by the MP3 machine (since that machine already knows when we're open, since it already had to decide whether to play live or archived.) The scripts that start and stop the live audio and archives now also run a little program that turns the appropriate pin on the parallel port on or off.
It seems to be working, but I had to tweak the volume levels in three different places, so I'm not sure it's all completely in sync; I think it's a little quieter than it used to be overall.