January 30, 2023

Lessons learned streaming building a Scheme-like interpreter in Go

I wanted to practice making coding videos so I did a four-part series on writing a basic Scheme-like language (minus macros and arrays and tons of stuff).

I picked this simple topic because I wanted a low-stakes way to learn what I did not know about making videos.

Here was the end result (nothing crazy):

$ go build
$ cat examples/fib.scm
(func fib (a)
      (if (< a 2)
          a
          (+ (fib (- a 1)) (fib (- a 2)))))

(fib 11)
$ ./livescheme examples/fib.scm
89

The code for the project is here.

Video archives

Here are the four episodes! Each about an hour long. One per week for four weeks.

Live live

The videos were streamed to Twitch live.

I didn't prep for them because I wanted to show warts and all. The thought process.

But some things turned out to be tricky to explain without preparation (function calling conventions, mostly).

Overall hopefully the series was somewhat useful.

Full screen windows

The first episode I did I didn't make sure that the terminal window was captured full screen. So some of my code went off the bottom of the video. That was dumb.

I even have a tmux mode-line at the bottom of the terminal app that I could have looked for to notice it didn't exist in the OBS view.

So I made sure to have the full window in view after the first episode.

Twitch moderation

Twitch Shield Mode is great. But the default setting prevents folks from commenting live until they've followed you for 2 weeks or something.

For someone starting a channel that doesn't make much sense. So in my first video I disabled it so folks could chat. And then some crypto scammer came in. Go figure.

After the first video I turned Shield Mode back on but set the minimum follow time to 10 minutes I think.

OBS Studio

I used OBS Studio to record. I was frustrated with it for a while because the video would lag so much when I tested out streaming. After playing around with Twitch Studio and giving up on it for being too simple, I messed with OBS video settings enough to get my video to not lag. Unfortunately I can't remember what settings I used.

Noise Gate / pop filter

The Noise Gate Filter is awesome. My mechanical keyboard sounded obnoxious before I turned it on. I was considering getting a pop filter but then discovered that the Noise Gate Filter is built in, you just have to turn it on.

Scenes

It also took me a while to understand OBS Scenes but then I realized I can use them to have an intro graphic (without the mic on!), a main coding scene (focused on my terminal and with my webcam overlayed), and a "back soon" graphic if I needed it.

To get the mic off you have to disable the mic globally (it's on globally by default) and then add it as an input only to the scenes you want.

Storage and export to YouTube

Twitch doesn't store streams by default. You have to turn on Video on Demand.

Even when it's turned on the videos only seem to be stored for 1 week. Maybe that's configurable but I didn't see it.

In any case it's not a problem because you can set up a YouTube connection. Then after a stream is complete you find the stream video and click Export. It takes about a minute to upload the hour long videos I did. Though YouTube post-processing took a while longer after that.

Next?

I'm forced to take a break from recording these videos for the next two weeks since I'll be in Cape Town.

I haven't decided yet if I'll continue this series (not something I'm extremely excited about since everyone builds a Scheme-like language).

I'd like to have a project that I can keep contributing to over time but I don't see very much value in doing that based on a Scheme or any lisp-like.

Maybe I'll do a basic JavaScript implementation next. Or another basic SQL database. Dunno.