Pulsoid MIDI Protocol

The MIDI (Musical Instrument Digital Interface) protocol is a technical standard that enables electronic musical instruments, computers, and other devices to communicate and synchronise with each other by transmitting musical performance data, such as note pitches, timings, and control signals, over a serial connection. It allows for the control of multiple instruments from a single controller, facilitating complex and synchronised musical compositions and performances.

Pulsoid supports transmitting heart rate data via MIDI protocol by Pulsoid MIDI Protocol.

MIDI message consists of 3 bytes:

  • message byte

  • data 1 byte

  • data 2 bytes

Message Byte

Message byte is used to define command and channel number. There are 7 different commands and 16 different channels.

To transfer heart rate data, the Pulsoid MIDI Protocol uses

  • Note ON command

  • 1 channel

So the format of first(message) byte is always the same.

Data Bytes

Each data byte can transfer up to 7 bits of information (1 bit is reserved), which is equal to a number from 0 to 127 inclusive. However, heart rate is typically in the range of 30 to 230.

To transfer a heart rate value over the MIDI protocol, we need to encode the value from the range [30, 230] into two ranges: [0, 127] (data byte 1) and [0, 127] (data byte 2).

To achieve this, we will split the beats per minute (BPM) value into two parts:

• Number of tens

• Number of ones

For example:

• bpm = 134, number of tens = 13, number of ones = 4

• bpm = 98, number of tens = 9, number of ones = 8

Then, the number of tens is transferred as the byte 1 value and the number of ones is transferred as the byte 2 value.

Examples

67 bpm transferred by Pulsoid MIDI Protocol

  • 90 - message type 9(Note on) on the first channel (0)

  • 07 - number of ones

  • 06 - number of tens

To decode bpm back 6 * 10 + 7 = 67

References

  • MIDI message format explained

  • WebMIDI.js

Last updated