Hypnotriod / midi-box-stm32

stm32 usb midi driver demo application
49 stars 6 forks source link
midi stm32 usb

N.B.: To all those who are citizens of the countries listed: russia, or provide any support or justification for such, my friendly reminder that you are not welcome.

midi-box-stm32

Midi Hub Device implementation (with 1 input and 3 output ports) example based on STM32F103 dev board.

Contains MIDI Device Class Middleware implementation for STM32 HAL USB drivers, compatible with STM32CubeMX/STM32CubeIDE code generator.
MIDI class V1.0 follows the "Universal Serial Bus Device Class Definition for MIDI Devices. Release 1.0 Nov 1, 1999"

User may specify number of physical/virtual input type MIDI_IN_PORTS_NUM ports and output type MIDI_OUT_PORTS_NUM ports.
The port means cable number or MIDI Jack associated with the endpoint that is transferring the data.
Right now up to 8 ports of each type supported, but only 12 ports in total.

Configuring user project with STM32CubeMX code generator to use MIDI Device Class Middleware

In STM32CubeMX / STM32CubeIDE:

To use MIDI Device Class middleware, project requires few modifications in generated code:

Midi event packet structure:

|  4 bits  |  4 bits  |  4 bits  |  4 bits  |  8 bits  |  8 bits  |
|          |          |        MIDI_0       |  MIDI_1  |  MIDI_2  |
|   Cable  |   Code   |  Message |  Channel |  Byte 1  |  Byte 2  |

Please refer to USB-MIDI Event Packets in midi10.pdf for more info.

Send midi event packets report to host device: