Can I send any CC values with Midi unit/Core3s/UIflow 2.0?
-
Hi everyone,
I have received with my core3s and midi unit recently and I want to start my first project with UIflow 2.0. My project is about sending midi messages to a synthesizer in order to make a sequence of sound, as simple as that.
UIflow made it easy to send note message and some other messages. However, I want to be able to send less common messages such as for Portamento (CC = 5) and I don't know how to do that.
I am a newbie and it is possible that I have just asked a dumb question. Any useful information would be appreciated!
Thank you
-
@kcuk220 No dumb questions at all! To send Portamento Time (CC 5) with your M5Stack Core3S and MIDI Unit in UIFlow 2.0, you'll need to use the cmd_write method to send raw MIDI control change messages. Here's how:
Step 1: Understand the MIDI CC Message Structure
Portamento Time (CC 5) uses this MIDI message format:Bn 05h ccBn: Status byte (B = Control Change, n = MIDI channel 0-15 → hex 0-F)
05h: CC number (5 for Portamento Time)
cc: Value (0-127, where 0 = fastest portamento, 127 = slowest)Step 2: UIFlow 2.0 Implementation
Initialize the MIDI Unit (if not already done):Use the "MIDI Unit" block under "Units" to set up the MIDI Unit with your UART port (e.g., Port A).
Send Portamento CC Message using cmd_write:The cmd_write method accepts a list of MIDI bytes. For Portamento Time on Channel 1 (hex 0), with a value of 64 (medium speed):
Bytes = [0xB0, 0x05, 0x40]
0xB0 = Channel 1 (0xBn where n=0), Control Change
0x05 = CC number 5 (Portamento Time)
0x40 = Value 64 (hex for 64)Example Code (Blockly & Python)
Blockly:Add a "MIDI Unit" → "cmd_write" block.
Set the input to [176, 5, 64] (decimal equivalent of 0xB0, 0x05, 0x40).Python (Advanced):
from m5stack import *
from m5ui import *
from uiflow import *
import unitInitialize MIDI Unit (adjust port if needed)
midi = unit.get(unit.MIDI, unit.PORTA)
Send Portamento Time (CC 5) on Channel 1, value 64
midi.cmd_write([0xB0, 0x05, 0x40]) # B0=Ch1, 05=CC5, 40=64
Key Notes:
Channel Adjustment: Change the first byte to target different channels. For example:
Channel 2 → 0xB1 (hex) or 177 (decimal)
Channel 10 (drums) → 0xB9 (hex) or 185 (decimal).Value Range: Use 0-127 for cc (e.g., 0x00 = 0 = fastest, 0x7F = 127 = slowest).
Verification
Test with a MIDI monitor (e.g., MIDI-OX on Windows, MIDI Monitor on macOS) to confirm the CC 5 message is received. Most synths require Portamento to be enabled (via CC 65, "Portamento On/Off") before CC 5 takes effect.
https://chat.m5stack.com/
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login