Create an Instrument object to represent an instrument.

Instrument(instrument, to = NULL, volume = NULL, pan = NULL)

Arguments

instrument

A single integer between 1 and 128, which indicates the program number of the instrument. See the Details section for all instruments.

to

Optional. A single character or a single positive integer, which indicates the musical line where to add the instrument.

volume

Optional. A single integer between 0 and 100, which represents the volume of the instrument. The default value is 80. Please note that volume and pan only work in MuseScore 3.

pan

Optional. A single integer between -90 and 90, which represents the panning of the instrument. The default value is 0.

Value

A list of class Instrument.

Details

Supported instruments:

  1. Acoustic Grand Piano

  2. Bright Acoustic Piano

  3. Electric Grand Piano

  4. Honky-Tonk Piano

  5. Electric Piano 1

  6. Electric Piano 2

  7. Harpsichord

  8. Clavinet

  9. Celesta

  10. Glockenspiel

  11. Music Box

  12. Vibraphone

  13. Marimba

  14. Xylophone

  15. Tubular Bells

  16. Dulcimer

  17. Drawbar Organ

  18. Percussive Organ

  19. Rock Organ

  20. Church Organ

  21. Reed Organ

  22. Accordion

  23. Harmonica

  24. Tango Accordion

  25. Acoustic Guitar (Nylon)

  26. Acoustic Guitar (Steel)

  27. Electric Guitar (Jazz)

  28. Electric Guitar (Clean)

  29. Electric Guitar (Muted)

  30. Overdriven Guitar

  31. Distortion Guitar

  32. Guitar Harmonics

  33. Acoustic Bass

  34. Electric Bass (Finger)

  35. Electric Bass (Pick)

  36. Fretless Bass

  37. Slap Bass 1

  38. Slap Bass 2

  39. Synth Bass 1

  40. Synth Bass 2

  41. Violin

  42. Viola

  43. Cello

  44. Contrabass

  45. Tremolo Strings

  46. Pizzicato Strings

  47. Orchestral Harp

  48. Timpani

  49. String Ensemble 1

  50. String Ensemble 2

  51. Synth Strings 1

  52. Synth Strings 2

  53. Choir Aahs

  54. Voice Oohs

  55. Synth Voice

  56. Orchestra Hit

  57. Trumpet

  58. Trombone

  59. Tuba

  60. Muted Trumpet

  61. French Horn

  62. Brass Section

  63. Synth Brass 1

  64. Synth Brass 2

  65. Soprano Sax

  66. Alto Sax

  67. Tenor Sax

  68. Baritone Sax

  69. Oboe

  70. English Horn

  71. Bassoon

  72. Clarinet

  73. Piccolo

  74. Flute

  75. Recorder

  76. Pan Flute

  77. Blown Bottle

  78. Shakuhachi

  79. Whistle

  80. Ocarina

  81. Lead 1 (Square)

  82. Lead 2 (Sawtooth)

  83. Lead 3 (Calliope)

  84. Lead 4 (Chiff)

  85. Lead 5 (Charang)

  86. Lead 6 (Voice)

  87. Lead 7 (Fifths)

  88. Lead 8 (Bass + Lead)

  89. Pad 1 (New Age)

  90. Pad 2 (Warm)

  91. Pad 3 (Polysynth)

  92. Pad 4 (Choir)

  93. Pad 5 (Bowed)

  94. Pad 6 (Metallic)

  95. Pad 7 (Halo)

  96. Pad 8 (Sweep)

  97. FX 1 (Rain)

  98. FX 2 (Soundtrack)

  99. FX 3 (Crystal)

  100. FX 4 (Atmosphere)

  101. FX 5 (Brightness)

  102. FX 6 (Goblins)

  103. FX 7 (Echoes)

  104. FX 8 (Sci-Fi)

  105. Sitar

  106. Banjo

  107. Shamisen

  108. Koto

  109. Kalimba

  110. Bag Pipe

  111. Fiddle

  112. Shanai

  113. Tinkle Bell

  114. Agogo

  115. Steel Drums

  116. Woodblock

  117. Taiko Drum

  118. Melodic Tom

  119. Synth Drum

  120. Reverse Cymbal

  121. Guitar Fret Noise

  122. Breath Noise

  123. Seashore

  124. Bird Tweet

  125. Telephone Ring

  126. Helicopter

  127. Applause

  128. Gunshot

See also

+.Music() for adding an instrument to a Music object.

Examples

# Create a flute
flute <- Instrument(74, pan = -90)
flute
#> Flute 
#> 
#> * of pan -90 

# Add it to a `Music`
music <- Music() + Meter(4, 4) + Line(c("C5", "D5", "E5", "F5")) + flute
music
#> Music 
#> 
#> $meters
#> # A tibble: 1 × 6
#>     bar number  unit actual_number actual_unit invisible
#>   <int>  <int> <int>         <int>       <int> <lgl>    
#> 1     1      4     4             4           4 FALSE    
#> 
#> $notes
#> # A tibble: 4 × 7
#>    line     i     j pitch  midi duration length
#>   <int> <int> <int> <chr> <int> <chr>     <dbl>
#> 1     1     1    NA C5       72 NA            1
#> 2     1     2    NA D5       74 NA            1
#> 3     1     3    NA E5       76 NA            1
#> 4     1     4    NA F5       77 NA            1
#> 
#> $lines
#> # A tibble: 1 × 7
#>    part staff voice segment   bar offset name 
#>   <int> <int> <int>   <int> <int>  <dbl> <chr>
#> 1     1     1     1       1     1      0 NA   
#> 
#> $instruments
#> # A tibble: 1 × 5
#>    line  midi name  volume   pan
#>   <int> <int> <chr>  <dbl> <dbl>
#> 1     1    74 Flute     80   -90
#> 

# Generate the music score
if (interactive()) {
  show(music)
}