Twitch Plays TTY
Twitch Plays TTY
A couple years ago I watched a video by Joel Creates where he shows off his work on the set for the short film Infinitus[1], and in it he shows off that in the set they used an old UltraTec Minicom II TTY as the control panel for the airlock. I was curious about them since it seemed like a cool gadget I might be able to display the weather or time on with a retro-looking vacuum flourescent display. So I picked one up on eBay.
A TTY device is a device that allows hearing impaired people to communicate over the phone, and usually features an acoustic coupler for the handset.
I didn’t really know the terminologies to look up how the protocol works at the time, so I started off recording all of the tones for each letter. In testing my recordings, I noticed that each special character would display the same key’s letter, so I figured there must be something else to it that tells it, and sure enough found that there’s a control signal sent when you switch from letters to special characters and vice versa.
I wrote up a quick python script[2] to handle playing back the appropriate tones to display arbitrary strings. It was kind of cheating, because I was just playing back wav files for each character.
Anyway, fast forward to December 2021. After having done almost nothing with it for over a year and a half, a friend of mine was working on another Twitch Plays project and I decided to implement the Twitch API and a MySQL-based message queue. It’s since been added to the repo. It’s extremely basic, there’s a script that just runs the listener for the Twitch bot and adds new messages to a MySQL table, and a second script that reads out the oldest message in the database, plays its tones, and then deletes it from the database.
Future Plans
After wrapping up the stream, I got the wild idea “what if I could generate the tones from scratch?” So I spent a little bit digging into the recordings and documentation on Baudot for the right bit sequences. All of the possible characters and control sequences in Baudot are represented by 5 bits. On TTYs (at least my Minicom III), “1"s are represented by a .022 second 1400hz tone, and “0"s are represented by a .022 second 1800hz tone and a signal is structured as follows:
[0.022 seconds] 1800hz "hello" [0.022 seconds] (1400hz/1800hz) fifth bit [0.022 seconds] (1400hz/1800hz) fourth bit [0.022 seconds] (1400hz/1800hz) third bit [0.022 seconds] (1400hz/1800hz) second bit [0.022 seconds] (1400hz/1800hz) first bit [0.550 seconds] 1400hz "goodbye"
Armed with this knowledge, I’m planning to make the script generate the tones from scratch and see how far I can shorten the “goodbye” tone — it takes over a half a second, over 5 times longer than the entire data being sent, and if I can get it shorter while still remaining stable I can increase the potential data rate.
[1] "I built a Sci-Fi movie set!" - Joel Creates, December 20th 2019
[2] "minicom-tone-gen" - Alyx Wijers