We'll be using CircuitPython for this project. Are you new to using CircuitPython? No worries, there is a full getting started guide here.
Adafruit suggests using the Mu editor to edit your code and have an interactive REPL in CircuitPython. You can learn about Mu and its installation in this tutorial.
There's a guide to get you up and running with CircuitPython specifically for the NeoTrellis M4. You should read it before starting to get the most recent CircuitPython build for the NeoTrellisM4 installed and running along with the required libraries.
Full code with links to github is on the Downloads page.
Navigating the NeoTrellis
To get your NeoTrellis M4 set up to run this project's code, first follow these steps:
1) Update the bootloader for NeoTrellis from the NeoTrellis M4 guide
2) Install the latest CircuitPython for NeoTrellis from the NeoTrellis M4 guide
3) Get the latest CircuitPython library pack, the version number of which should match your version of CircuitPython (4.x or greater), unzip it, and drag the libraries you need over into the /lib folder on CIRCUITPY. The latest library package includes support for NeoTrellis.
https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases/
For this project you will need the following libraries:
- adafruit_trellism4.mpy
- neopixel.mpy
- adafruit_matrixkeypad.mpy
Overall Structure
The codebase is broken into several classes/files:
- main.py sets everything up and contains the main loop the checks for input from the user and acts accordingly
- parser.py contains the MIDI file parser
- header.py contains a class implementing the MIDI file header structure
- events.py contains several classes representing the various events that can be present in the MIDI files
- sequencer.py contains the sequencer which takes a MIDI track (a temporally ordered list of events) and executes them
- synth.py contains the Synthesizer class that plays samples as required
Below is a snapshot of what CIRCUITPY should look like.

Temporarily unable to load content:
Page last edited January 22, 2025
Text editor powered by tinymce.