Skip to main content

pitch_bend

Function pitch_bend 

Source
pub fn pitch_bend(cents: f64, bend_range: f64) -> (u8, u8)
Expand description

A pitch bend of so many cents, within a range of so many semitones, as the event’s two parameters, least significant first; beyond the range it is the range’s end.

use music21::midi::base::pitch_bend;

assert_eq!(pitch_bend(0.0, 2.0), (0, 64));
assert_eq!(pitch_bend(50.0, 2.0), (0, 80));
assert_eq!(pitch_bend(-300.0, 4.0), (0, 16));