In developing the page "Beat (acoustics)" on Wikiversity I needed to find a LilyPond instrument that had no vibrato, and this required quick access to all LilyPond's 128 different imitations of a musical instrument. This short code wrote so much wikitext so long I had to upload it to Wikiversity in short segments.

The list of instruments in #instruments.txt shown below was copy/pasted from:

The output wikitext can be found by viewing the source of the Wikiversity page at:

Code edit

##Sample riff:
##====recorder====
##<score sound="1"> \relative c'' {\set Staff.midiInstrument = #"recorder" \clef treble \cadenzaOn  c2\grace { b16[c] } [b g e (b'] a1) } </score>
##<score sound="1"> \relative c''' {\set Staff.midiInstrument = #"recorder" \clef treble \cadenzaOn  c2\grace { b16[c] } [b g e (b'] a1) } </score>
##<score sound="1">\relative c' { \set Staff.midiInstrument = #"recorder" \clef bass \cadenzaOn  c2\grace { b16[c] } [b g e (b'] a1) } </score>

## Open instruments.txt to create ilist, which lists all LilyPond instruments:
ilist=[]
with open("instruments.txt", "r") as infile:
    for line in infile:
        ilist.append(line.rstrip())
## Each riff is different in one of three ways:        
prime=["''","'''","'"]
clef=[r'\clef treble', r'\clef treble', r'\clef bass']
finish=r"\cadenzaOn  c2\grace { b16[c] } [b g e (b'] a1~a2) } </score>"

## Open an output file and write the entire passage, line by line:
with open("wikitext.txt","w") as outfile:
    for i in range(len(ilist)):
        outfile.write("\n===="+ilist[i]+"====\n")#                         ====recorder====
        for j in range(3):
            outfile.write('<score sound="1"> \\relative c'+prime[j])#      <score sound="1"> \relative c'''
            outfile.write(r'{\set Staff.midiInstrument = #"'+ilist[i]+'"')# {\set Staff.midiInstrument = #"recorder"
            outfile.write(clef[j]+finish)
            outfile.write("\n")

instruments.txt edit

acoustic grand
bright acoustic
electric grand
honky-tonk
electric piano 1
electric piano 2
harpsichord
clav
celesta
glockenspiel
music box
vibraphone
marimba
xylophone
tubular bells
dulcimer
drawbar organ
percussive organ
rock organ
church organ
reed organ
accordion
harmonica
concertina
acoustic guitar (nylon)
acoustic guitar (steel)
electric guitar (jazz)
electric guitar (clean)
electric guitar (muted)
overdriven guitar
distorted guitar
guitar harmonics
acoustic bass
electric bass (finger)
electric bass (pick)
fretless bass
slap bass 1
slap bass 2
synth bass 1
synth bass 2
violin
viola
cello
contrabass
tremolo strings
pizzicato strings
orchestral harp
timpani
string ensemble 1
string ensemble 2
synthstrings 1
synthstrings 2
choir aahs
voice oohs
synth voice
orchestra hit
trumpet
trombone
tuba
muted trumpet
french horn
brass section
synthbrass 1
synthbrass 2
soprano sax
alto sax
tenor sax
baritone sax
oboe
english horn
bassoon
clarinet
piccolo
flute
recorder
pan flute
blown bottle
shakuhachi
whistle
ocarina
lead 1 (square)
lead 2 (sawtooth)
lead 3 (calliope)
lead 4 (chiff)
lead 5 (charang)
lead 6 (voice)
lead 7 (fifths)
lead 8 (bass+lead)
pad 1 (new age)
pad 2 (warm)
pad 3 (polysynth)
pad 4 (choir)
pad 5 (bowed)
pad 6 (metallic)
pad 7 (halo)
pad 8 (sweep)
fx 1 (rain)
fx 2 (soundtrack)
fx 3 (crystal)
fx 4 (atmosphere)
fx 5 (brightness)
fx 6 (goblins)
fx 7 (echoes)
fx 8 (sci-fi)
sitar
banjo
shamisen
koto
kalimba
bagpipe
fiddle
shanai
tinkle bell
agogo
steel drums
woodblock
taiko drum
melodic tom
synth drum
reverse cymbal
guitar fret noise
breath noise
seashore
bird tweet
telephone ring
helicopter
applause
gunshot