Use
When the project is first loaded, there is no sample saved. It will be silent when the keys are pressed. Once you record a sample, the file gets saved to the micro SD card. From then on it will automatically load when the Fruit Jam boots up.
Control Change Values
MIDI control change events are used to control the sample recording and automated MIDI file playback. Near the top of the code.py file you will find variables that configure the CC values used by the project.
CC_RECORD = 77 # midi CC control value to initiate recording CC_PLAY_SONG = 78 # midi CC control value to initiate playing a song
On the Akai MPK Mini 4 the values used: 77, and 78 correspond with the red solid circle button labeled "quantize", and red circle with plus inside button labeled "automation".
Different keyboards may use different CC values for their buttons. The project code will print the ControlChange object for any other buttons when they are pressed. Look in the serial console to find the value of your buttons and substitute them into the code for the CC_RECORD, and CC_PLAY_SONG variables. See example CC prints and updated variables below.
ControlChange(control=73, value=127, channel=0) ControlChange(control=74, value=127, channel=0)
CC_RECORD = 73 # midi CC control value to initiate recording CC_PLAY_SONG = 74 # midi CC control value to initiate playing a song
Recording
To record first press the button assigned as CC_RECORD, on my keyboard its the red solid circle labeled "quantize". The first NeoPixel in the line of 5 built-in pixels will turn yellow to indicate that it is waiting to begin recording. To start recording press and hold any key on the keyboard. The recording will stop when you release the key. The NeoPixel will turn red while recording.
MIDI File Player
The project bundle comes with an example MIDI file that contains an aria by Bach. There is a variable near the top of the code.py file that configures the MIDI file to use for the auto playback feature.
SONG_PATH = "/anna-magdalena-20a.mid"
To customize it, copy your desired MIDI file to the CIRCUITPY drive and update the filename in this variable.
To play the song press the CC button that is assigned to CC_PLAY_SONG, on my keyboard that's the red circle with plus sign in it, labeled "automation".
Enjoy this rendition of Bach's aria by Princess Catty Beans 😺.
Going Further
If you've built this project and are interested in taking it to the next level, here are some ideas for expanding the capabilities:
- Allow multiple samples. Recorded samples are saved to /sd/sample0.wav. The old file is always overwritten by newly recorded samples. Update the project code to allow sample2, 3, or more to get saved alongside the old sample(s). Set up an unused CC knob or button on your keyboard to cycle between sample files.
- Apply more effects. The only things in the effects chain currently are an amp to boost the volume, and the granular pitch shift to move the sample up or down in pitch. Add additional effects before or after the pitch shift in the chain. Different effects are found in these core modules: audiofilters, audiodelays, and audiofreeverb. Look for the
# --- Set up effects chains ---section header comment in the code. - Expand the controls using additional MIDI CC knobs and buttons on your keyboard. Make a volume knob by hooking it up to change the
pre_gainvalue used for the amp. Add more effects to the chain and hook up buttons to enable/disable them, or knobs to modify theirmixproperty. - Add an additional reserved voice track to the
audiomixerand use it to play a backing track from a different wave file. - Support multiple MIDI files. Copy more MIDI files to the CIRCUITPY drive and hook up different CC buttons to play each one. Or use one button to cycle thru songs and another button to play the currently selected one.
Page last edited July 20, 2026
Text editor powered by tinymce.