Skip to content

Instantly share code, notes, and snippets.

@doop
Last active December 28, 2024 13:58
Show Gist options
  • Save doop/6c0f0783e4b613540cbadb37fc7a2be6 to your computer and use it in GitHub Desktop.
Save doop/6c0f0783e4b613540cbadb37fc7a2be6 to your computer and use it in GitHub Desktop.
How to byte-jam on a mac

How to do a TIC-80 byte-jam on an ARM mac

Byte jams are a fun demoscene event where there's usually music from a DJ and several participants who use the TIC-80 fantasy console to code up a graphics effect from scratch within an hour. I usually watch the Field-FX stream on Monday evenings, and occasionally take part; there's an archive of the graphical effects people have made in these sessions, here.

A rather neat part of this is that TIC-80 has been modified to allow its programs to access the FFT of a sound stream, so that you can make your programs respond to the music in real-time. However, this can require a bit of setup on a mac.

In this document I will describe how to set up the audio software, plus byte jam client and TIC-80 itself, to allow participation in a byte jam.

Initial downloads

You will need the following to get started:

  • rust: ideally install via rustup; follow the instructions here
  • Blackhole 2CH: download and install the PKG file from here
  • git: if you don't have it installed, follow the instructions here

Build ticws

Ticws is totetmatt's byte jam client, linking your TIC-80 session to whoever is running the stream. In the terminal, do the following:

git clone https://github.com/totetmatt/ticws.git
cd ticws && cargo build --release

Install TIC-80

The stable release of TIC-80 does not currently (2024-12-28) have the changes for byte jams or the FFT interface; however the nightly builds do. Download the build from here and extract it into the ticws directory. If you click that link from Safari then it will probably unzip it for you, in which case from the ticws directory in terminal you just need to do this:

mv ~/Downloads/tic80-macos-arm64 .

You should then be able to see both the ticws client and the tic80 executable from the ticws directory:

$ ls  target/release/ticws-client tic80-macos-arm64/tic80
target/release/ticws-client*  tic80-macos-arm64/tic80*
$

Tell macOS to trust the tic80 executable:

xattr -r -d com.apple.quarantine tic80-macos-arm64/*

Install the client startup script

Download run_client.sh (from here ) and put it in the ticws directory, then

chmod +x run_client.sh

Set up loopback audio

If you want your TIC-80 code to be able to react to an audio stream (from Twitch, or Spotify or whatever) then you'll need some way of taking audio output and looping it back so TIC-80 can access it as an input. This is what Blackhole 2CH does. Once you've installed it, open the "Audio MIDI Setup" app (I normally seach using the icon in the top-left of the screen; the app has a little piano keyboard icon). You should then see something like this:

Screenshot 2024-12-27 at 16 30 35
  • Click the "+" sign in the bottom left and select "Create Multi-Output Device".
  • Make sure both "Macbook pro speakers" and "Blackhole 2CH" are selected in the right-hand pane.

This creates a new virtual audio device - sound sent here will go to both your laptop speakers and also to the Blackhole loopback device which can be read by TIC-80. If you right-click/double-finger-tap on "Multi-output device" then select "Use this device for Sound Output" then the system will send sound (eg from Spotify or your web browser) here. Note that this disables the speaker controls on F11/F12! If you want to go back to normal sound setup (and re-enable the F11/F12 controls), right-click on "Macbook pro speakers" and select "Use this device for Sound Output".

Jam time!

Whoever is organizing the jam will tell you the name of the room; you will also need to choose a name or handle for yourself. Then, in the ticws directory, run:

./run_client.sh roomname handle

That's it! You should get a TIC-80 session up, and (remember to use "Multi output device" for audio output) it should have a working fft() function. Have a great byte jam!

Comments to [email protected]

TICEXE=./tic80-macos-arm64/tic80
CLIENT_EXE=./target/release/ticws-client
SHOWDOWN_FILE="client_showdown_$1_$2.dat"
if [ -z "$1" ] || [ -z "$2" ] ; then
echo "Usage: $0 <room> <handle>"
exit 1
fi
if [ ! -x $TICEXE ]; then
echo "$TICEXE not found"
exit 1
fi
if [ ! -x "$CLIENT_EXE" ]; then
echo "$CLIENT_EXE not found / not executable"
exit 1
fi
touch $SHOWDOWN_FILE
$TICEXE --fft --skip "--codeexport=$SHOWDOWN_FILE" --delay=5 &
$CLIENT_EXE "$1" "$2" "$SHOWDOWN_FILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment