💾 Archived View for posixcafe.org › blogs › badapple.gem captured on 2022-06-11 at 20:51:32. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-12-17)

-=-=-=-=-=-=-

Playing bad apple using rio

Video

Getting bad apple to play on random devices has become somewhat of a

long running joke it seems. After seeing some interesting videos of

people doing it with various windows tools I thought it might be fun

to try and get it working using a similarly 'hacky' method on plan9.

First step was figuring out what source I could use to make this happen,

thankfully I was able to find a pretty well done ascii conversion of the

original video online in one huge text file. Some looking at the file and a bit

of sam commands and it seemed good to go. The file used 30 lines per frame, and

totaled 2108 frames overall.

The first thing I tried was figuring out some way of getting it to work

in sam, ultimately this didn't work well as the text scrolling in sam just

couldn't keep up. The method I was trying to use for it was simply entering

'+30' at a specific time width in a script loaded with '_' like so:

#!/bin/rc
for(i in `{seq 2108}){
	echo +30
}

Two problems with this I found:

I figured my best bet was to just use a rio window for this. First thoughts here were

to simply clear and reprint the screen for each frame but this turned out to cause some flickering.

However, letting the window scroll and only writing one frame at a time to the window seemed to do

the tick pretty well. I ended up with something like this:

#!/bin/rc
echo -n > /dev/text
for(i in `{seq 1 2108}){
	{
		echo 'a='$i'*30+1'
		echo a
		echo 'a+30'
	} | bc | {
		start=`{ sed 1q }
		end=`{ sed 1q }
	}
	sed -n $start','$end'p' apple.txt
	sleep 0.035
}

The sleep command is completely arbitrary and just seemed to make it sync up the best

to the original video. The seemed to work well enough and when going back to add the

music I was surprised at how well it synced up.

That's about it, just a bit of rc scripting and dumb fun. I didn't get a chance to try

with acme using its filesystem, so perhaps that might work as well.

Stolen ascii art file