Python/LilyPond

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 shown below was copy/pasted from: The output wikitext can be found by viewing the source of the Wikiversity page at:
 * https://lilypond.org/doc/v2.23/Documentation/notation/midi-instruments
 * Music/Software/Lilypond/MIDI

Code


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

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('
 * 1) Open an output file and write the entire passage, line by line: