Just like so many consoles and systems before it, the startup screen for the Fruit Jam should be fun and memorable. This page will detail some of the challenges and solutions that were faced whiled bringing the boot animation to life in CircuitPython.
Here is an MP4 file with the animation and jingle that served as a reference while developing the CircuitPython implementation of the boot animation. The Adafruit design and sound engineering teams delivered these assets to work from.
Challenges Implementing in CircuitPython
The boot animation looks and sounds great but CircuitPython doesn't support MP4 playback, so it needed to be implemented using the graphical tools available within displayio
. Developing the code for the boot animation presented a few challenges. In overcoming some of these challenges the development team improved systems within the CircuitPython core that will have benefits far beyond just the boot animation. This page will detail some of the key problems that were faced and their solutions.
Sproingy Sprites
In Displayio, most graphical elements make use of a TileGrid
, which has a fixed rectangular size. That makes it not immediately obvious how to have the letters shrink and spring back to their original larger size. To achieve this effect, each letter and the apple were broken out and made into sprite sheets which contain frames of shrink and spring back to size animation. Here is an example of one of the sprite sheets:
The code flips through the sprites like a flip-book in order to make the letters visually shrink and grow. The letters in "JAM" end up overlapping on top of the letters in "FRUIT" during parts of the animation, so they have pink in the top half of their sprites which gets made transparent in the code using the Palette
.
Audio Interfering With Graphics
At one stage of development the graphics and audio were each working well individually, but when combined together it created all sorts of issues rendering the graphics. The situation was improved a little by slimming down the audio file to the lowest settings possible, but was still not great. A pair of improvements to audio playback within the CircuitPython core helped get things running much more smoothly.
Using the latest and greatest version of CircuitPython with these improvements allowed the quality settings on the audio file to be raised back up some and play more cleanly.
Audio Artifacts
The next problem were some rather gnarly audio artifacts that played during the jingle, think angry synth buzzing sounds. It turned out these occurred during garbage collection. The solution was two-pronged: 1) Change the python code to create fewer variables during the main animation loop to reduce the need for garbage collection to run, and 2)Â improvements within the core that allowed the garbage collection times to be lower in cases where large regions of memory are occupied by bitmaps and other media files. The change to garbage collection was detailed in a blog post. This change caused a marked improvement in the boot animation & jingle playback, and will offer similar benefits to other CircuitPython projects that use big regions of memory without pointers, like for media files or large data arrays.
Page last edited June 13, 2025
Text editor powered by tinymce.