Two-Fisted Tales of House Music's Own Sysadmin

Well, I think I got things working. Many Bothans died to bring us this information. To recap, goals include:

  • Stream audio to icecast, from either line-in or from the desktop audio output;
  • Acquire that same audio in OBS, to stream to RTMP;
  • Switch the audio input that we're reading from under cron control.

Every single layer of software involved in this process conspires to make this as difficult as possible, especially the automation.

Things that don't work:

  • Nicecast, which is no longer supported on macOS 10.15.
  • ffmpeg, which can't read audio from AVFoundation devices without glitching. There are five year old patches that might have fixed this that never landed and no longer apply.
  • DarkIce, which claims to support CoreAudio but does not (also the author is a dick).
  • JackAudio, which does not work on macOS 10.15.
  • Streaming to icecast from OBS, because you can't stream to two destinations at the same time without giving up the ability to also archive video to disk.

Here's how I made it go:

  • For audio input to the video stream: OBS doesn't support even the most remedial scripting, through AppleScript or otherwise, but it does let you assign a hot-key to a "scene". So make a different scene for each audio input, assign a function key to it, and use osascript to type those function keys at OBS at the appropriate time. Pepper your scripts with "sleep" statements until things mostly work, mostly.

  • To record from the system audio in OBS, I had been using iShowU, because OBS didn't seem to support anything else that works on 10.15. And by "iShowU" I mean "iShowUAudioCapture", not "iShowU Instant" or "iShowU Studio", which are separate paid products. But, see below...

  • For audio input to the icecast stream: Audio Hijack supports the devices well, but also has not even the most remedial automation support. And doesn't have the "scene hotkey" thing that OBS does, though it does let you type Cmd-R to play/pause. But, I found a kludge:

    1. Launch Audio Hijack. Set it up for Line In → Icecast.
    2. Export as "line-in.ahsession"
    3. Reconfigure it for System Audio
    4. Export as "system-audio.ahsession"
    5. Then to switch inputs:

      killall 'Audio Hijack' 2>&-
      while ( killall -0 'Audio Hijack' 2>&- ); do sleep 1; done
      rm ~/Library/Application\ Support/Audio\ Hijack/Sessions.plist
      open line-in.ahsession
      osascript -e 'tell application "Audio Hijack" to activate' \
      -e 'tell application "System Events" to keystroke "r" using {command down}'

      This will drop and re-open the connection every time you switch, which is less than ideal, but here we are.

  • Oh, but wait, if Audio Hijack is reading from System Audio, then iShowU gets silence. So you get audio on the Icecast stream and nothing in OBS. Awesome. Having two programs able to read from the same audio source at the same time would be too much to ask. What do you think this is, Linux?

  • The fix to that is to install yet another program, Loopback.

    1. Update both of the saved Audio Hijack configurations to split to two outputs, the Icecast server, as well as to a Loopback input.
    2. Update all of the OBS scenes to take audio from Loopback instead of from iShowU.
    3. Kick iShowU unceremoniously to the curb.

    This means that to fix the bug that Audio Hijack won't play nice and allow iShowU to read at the same time, I had to spend another $100 on Loopback. I would have been a lot more irritated by this if not for the fact that I bought Nicecast from Rogue Amoeba in 2006 and they only made me pay for it once. So, kudos to them for having kept alive the business model where software is a product that you buy rather than a service that you rent. So, yeah, take my money.

  • Oh yeah, and then good luck making the task of "crontab calls osascript which types a keystroke at an app" work. It's a whole other ordeal that involves adding every program under the sun to the list under "System Preferences → Security → Accessiblity", and clicking "Ok" on an endless series of dialogs that will pop up at the most inconvenient possible time.

Previously, previously.

Tags: , , , ,

DNA Lounge: Wherein the webcast is HD now

Since the current dystopia means that all we do now is webcasts, we've upgraded! We're now doing full HD on the stream, and it looks great. (Downside: if your home network can't support a full HD stream, it's gonna be a little choppy... but most people can handle that these days, I think.)

Our audio webcast went online in May or June of 2000, and the video webcast followed in July 2000, and has been running 24/7 ever since. I'm not sure, but I suspect this makes DNA Lounge the oldest continuously-operating webcast in the world. There were older ones, of course, but the Trojan Room Coffee Pot and the Netscape Fishcam shut down many years ago.

Anyway, about that upgrade. We've been a very happy customer of Sonic for years (their service and support has been fantastic, and their policies on customer privacy and net neutrality are top notch), but even though they've been rolling out fiber all over the city for years, SOMA still gets treated like a stepchild, and our four DSL circuits from them just aren't cutting it any more. Sorry, Sonic. It's not you, it's me. No wait, it's you.

We're using Monkeybrains now (another Bay Area company not owned by an international conglomerate). I'm nervous, though, because I have a deep distrust of wireless uplinks. We tried that here before, ages ago (remember when we sent Bishop down the pipe?) and I also had a DirecTV dish at home for years, and my experience has always been: putting a dish on the roof is great, unless you want it to work if there's rain, or fog, or birds, or a stiff wind. But, people tell me things are better now, so we'll see.

This was a multi-day slog of cacading failures, and hardware and software upgrades piled atop each other, but such is my lot in life as House Music's Own Sysadmin.

You can make me feel better about these decisions with a donation, is what I'm getting at here.

Also there's a chat area at the bottom of the window now. I wrote that a couple of weeks ago, in case you haven't noticed. It's basic, but it gets the job done, and so far people haven't been jerks! Let me know if there are chat features you're dying to have there.

Anyway, the stream looks really nice now. I hope you enjoy it. Tune in to our upcoming webcasts. It's a pretty full schedule!

Tags: , ,

  • Previously