music-parts-1.9.0: Musical instruments, parts and playing techniques.

Safe HaskellNone




Representation of musical instruments.

The Instrument type represent any instrument in the MusicXML Standard Sounds 3.0 set, with some extensions. See



data Instrument Source

An Instrument represents the set of all instruments of a given type.


Enum Instrument 
Eq Instrument 
Ord Instrument 
Show Instrument 
ToJSON Instrument 
FromJSON Instrument 
Default Instrument

This instance is quite arbitrary but very handy.


fullName :: Instrument -> Maybe String Source

Full instrument name.

shortName :: Instrument -> Maybe String Source

Instrument name abbrevation.

fromMidiProgram :: Int -> Instrument Source

Create an instrument from a MIDI program number. Given number should be in the range 0 - 127.

toMidiProgram :: Instrument -> Maybe Int Source

Convert an instrument to a MIDI program number. If the given instrument is not representable as a MIDI program, return Nothing.

fromMusicXmlSoundId :: String -> Instrument Source

Create an instrument from a MusicXML Standard Sound ID.

toMusicXmlSoundId :: Instrument -> Maybe String Source

Convert an instrument to a MusicXML Standard Sound ID. If the given instrument is not in the MusicXMl standard, return Nothing.

Clefs and transposition

transposition :: Instrument -> Interval Source

Transposition interval.

transpositionString :: Instrument -> String Source

A string representing transposition such as Bb or F.

standardClef :: Instrument -> Maybe Clef Source

Standard clef used for this instrument.

allowedClefs :: Instrument -> Set Clef Source

Clefs allowed for this instrument.

Playing range

playableRange :: Instrument -> Ambitus Pitch Source

Playable range for this instrument.

comfortableRange :: Instrument -> Ambitus Pitch Source

Comfortable range for this instrument.