🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Can I send any CC values with Midi unit/Core3s/UIflow 2.0?

    UiFlow 2.0
    2
    2
    40
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      kcuk220
      last edited by

      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

      Y 1 Reply Last reply Reply Quote 0
      • Y
        yuyun2000 @kcuk220
        last edited by

        @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 cc

        Bn: 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 unit

        Initialize 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/

        1 Reply Last reply Reply Quote 0
        • First post
          Last post