Skip to content

Instantly share code, notes, and snippets.

@vicwomg
Last active September 13, 2025 16:29
Show Gist options
  • Select an option

  • Save vicwomg/42922fc3ef5f460831b8ab0f83fb1aa3 to your computer and use it in GitHub Desktop.

Select an option

Save vicwomg/42922fc3ef5f460831b8ab0f83fb1aa3 to your computer and use it in GitHub Desktop.
Sonicake Pocket Master - midi toggle buttons for ESP32-S3 boards
#include <Arduino.h>
#include <Control_Surface.h>
#include <MIDI_Interfaces/BluetoothMIDI_Interface.hpp>
// MIDI mappings for the Sonicake Pocket Master
// ---- MIDI interfaces ----
// Note: I found that enabling USBMIDI and BluetoothMIDI_Interface did not work at the same time on ESP32S3
// USB seems to get disabled when Bluetooth is enabled. Experiment with these settings at your risk.
// USBMIDI_Interface usbmidi;
BluetoothMIDI_Interface midi_ble;
// Change the first number to the desired GPIO pin, and leave the rest alone.
// Ex: "CCButtonLatched fx1 {12, {44, CHANNEL_1}}" sets fx1 toggle to GPIO12
// ---- Effects ----
// CCButtonLatched noise_reduction. {0, {43, CHANNEL_1}}; // noise reduction (pre)
CCButtonLatched fx1 {12, {44, CHANNEL_1}}; // fx 1 (pre)
CCButtonLatched drive_fx {8, {45, CHANNEL_1}}; // drive (pre)
// CCButtonLatched amp_fx {0, {46, CHANNEL_1}}; // amp
// CCButtonLatched ir_fx {0, {47, CHANNEL_1}}; // IR
// CCButtonLatched eq_fx {0, {48, CHANNEL_1}}; // EQ
CCButtonLatched fx2 {6, {49, CHANNEL_1}}; // FX2
CCButtonLatched delay_fx {4, {50, CHANNEL_1}}; // delay
CCButtonLatched reverb {5, {51, CHANNEL_1}}; // reverb
// CCButtonLatched tuner {0, {58, CHANNEL_1}}; // tuner
// ---- Looper ----
// CCButtonLatched looper {0, {59, CHANNEL_1}}; // looper on/off
// CCButtonLatched looper_record {0, {60, CHANNEL_1}}; // looper start record
// CCButtonLatched looper_play_stop {0, {62, CHANNEL_1}}; // looper play/stop toggle
// CCButtonLatched looper_delete {0, {64, CHANNEL_1}}; // looper delete loop
// CCButtonLatched looper_placement {0, {67, CHANNEL_1}}; // looper toggle post/pre
// ---- Drums ----
// CCButtonLatched drums {0, {92, CHANNEL_1}}; // drum on/off
// CCButtonLatched drums_play_stop {0, {93, CHANNEL_1}}; // drum play/stop toggle
// ---- Bank/Presets ----
// CCButtonLatched bank_down {0, {22, CHANNEL_1}}; // decrease preset number by 10
// CCButtonLatched bank_up {0, {23, CHANNEL_1}}; // increase preset number by 10
// CCButtonLatched preset_down {0, {24, CHANNEL_1}}; // decrease preset number by 1
// CCButtonLatched preset_up {0, {25, CHANNEL_1}}; // increase preset number by 1
// --- Potentiometer mappings. Scale from 0-127 ---
// One outer leg → 3.3V, Other outer leg → GND, Middle wiper → GPIO4 (for example). Swap the outer leg wiring to reverse the control
// Potentiometers must be wired to an ADC pin. On the ESP32S3 those are GPIO1 - GPIO10, and GPIO11 - GPIO20
// CCPotentiometer preset {0, {1, CHANNEL_1}};
CCPotentiometer master_vol {10, {6, CHANNEL_1}};
// CCPotentiometer preset_vol {0, {7, CHANNEL_1}};
// CCPotentiometer looper_rec_vol {0, {65, CHANNEL_1}};
// CCPotentiometer looper_play_vol {0, {66, CHANNEL_1}};
// CCPotentiometer drum_rhythm {0, {94, CHANNEL_1}}; // sets the rhythm style (0-9)
// CCPotentiometer drum_vol {0, {95, CHANNEL_1}};
void setup() {
Control_Surface.begin();
}
void loop() {
Control_Surface.loop();
}
@vicwomg
Copy link
Author

vicwomg commented Sep 11, 2025

MIDI toggle switches for Sonicake Pocket Master using ESP32-S3

sonicake.mp4

Hardware:

  • The ESP32-S3 board is only $9.99 (affiliate link). Less if you buy multiples: https://amzn.to/46nGaWL . Technically any ESP32 board should work. The S3 includes OTG USB midi if you want to experiment with that (the sonicake doesn't seem to support it).
  • Wire, momentary switches (ex: https://amzn.to/46nGaWL )
  • Breadboard if you want to prototype your wiring

Setup for flashing

Code changes / wiring

  • Uncomment the desired button controls in lines 18-57
  • Set the first number to the desired GPIO pin, and leave the rest of the line of code alone. (Note: pins GPIO19–21 are “special” pins on the ESP32-S3 and probably wont work)
  • Flash with the upload button (Right arrow in toolbar)
  • Wire a momentary button to a GND pin on the board, and to the specified GPIO pins
  • Wire any potentiometers. One outer leg → 3.3V, Other outer leg → GND, Middle wiper → GPIO4 (for example). Swap the outer leg wiring to reverse the control. Potentiometers must be wired to an ADC pin. On the ESP32S3 those are GPIO1 - GPIO10, and GPIO11 - GPIO20
  • Device will show up as "Control Surface MIDI" in the Bluetooth menu of the pocket master

The Pocket Master seems to forget this device on every boot, unfortunately. LMK if you know a way around that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment