Skip to main content

Module scale

Module scale 

Source
Expand description

MIDI 2.0 default resolution scaling (Min-Center-Max) between bit widths.

MIDI 1.0 carries 7-bit / 14-bit values; MIDI 2.0 carries 16-bit / 32-bit values. Up-scaling uses the “bit-repeat” expansion from the MIDI 2.0 UMP specification so that minimum, center, and maximum map exactly (e.g. 7-bit 0x40 center scales to the 16-bit center). Down-scaling is a right shift.

Functions§

scale_down
Scale value from src_bits down to dst_bits (a right shift by the width difference). dst_bits <= src_bits.
scale_up
Scale value from src_bits up to dst_bits using the MIDI 2.0 Min-Center-Max bit-repeat algorithm. src_bits <= dst_bits <= 32.