Skip to main content

for_percussion_key_or_unmapped

Function for_percussion_key_or_unmapped 

Source
pub fn for_percussion_key_or_unmapped(key: u8) -> Instrument
Expand description

The instrument a key of the General MIDI percussion map plays, and a bare unpitched percussion instrument carrying the key where the map names nothing at all: music21’s midiPitchToInstrument asked with raiseIfUnmapped=False, which is how its MIDI reader asks.

use music21::instrument::for_percussion_key_or_unmapped;

let bare = for_percussion_key_or_unmapped(22);
assert_eq!(bare.kind(), "UnpitchedPercussion");
assert_eq!(bare.name(), Some("Percussion"));
assert_eq!(bare.percussion_pitch(), Some(22));