import abjad hymn = [ [[5,2],3], [[2,7],1], [[5,2],3], [[7,5],1], [[3,5],10], [[3,5],2], [[4,6],1], [[7,5],2], [[1,6],2], [[2,7],2], [[3,7],1], [[1,6],2], [[2,7],1], [[4,1],1], [[2,4],1], [[3,5],4], [[4,6],1], [[7,5],2], [[1,6],4], [[2,7],1], [[4,1],1], [[7,5],1], [[1,6],4], [[7,5],1], [[1,6],2], [[7,5],1], [[1,6],2], [[2,7],2], [[6,3],2], [[5,2],3], [[6,3],1], [[5,2],4], [[6,3],1], [[5,2],2] ] pitches = {1:"e''",2:"d''",3:"c''",4:"b'",5:"a'",6:"g'",7:"f'",8:"e'",9:"d'",10:"c'"} QUAVER = abjad.Duration(1,8) CROTCHET = 2*QUAVER staff = abjad.Staff() for (interval, length) in hymn: jump = interval[1] - interval[0] if jump == 2: staff.append(abjad.Note(pitches[interval[1]], QUAVER)) abjad.attach(abjad.TimeSignature((length+1,4)), staff[-1]) staff.append(abjad.Note(pitches[interval[1]-1], QUAVER)) if length == 10: staff.append(abjad.Note(pitches[interval[0]], 8*CROTCHET)) staff.append(abjad.Note(pitches[interval[0]], 2*CROTCHET)) abjad.attach(abjad.Tie(), staff[-2]) abjad.attach(abjad.Fermata(), staff[-1]) else: staff.append(abjad.Note(pitches[interval[0]], length*CROTCHET)) elif jump == -2: staff.append(abjad.Note(pitches[interval[0]], QUAVER)) staff.append(abjad.Note(pitches[interval[0]-1], QUAVER)) staff.append(abjad.Note(pitches[interval[1]], length*CROTCHET)) abjad.attach(abjad.TimeSignature((length+1,4)), staff[-3]) elif jump == 5: staff.append(abjad.Note(pitches[interval[0]+7], QUAVER)) staff.append(abjad.Note(pitches[interval[0]+6], QUAVER)) staff.append(abjad.Note(pitches[interval[1]], length*CROTCHET)) abjad.attach(abjad.TimeSignature((length+1,4)), staff[-3]) elif jump == 4 or jump == -3: staff.append(abjad.Note(pitches[interval[0]], QUAVER)) staff.append(abjad.Note(pitches[interval[0]+1], QUAVER)) staff.append(abjad.Note(pitches[interval[0]+2], QUAVER)) staff.append(abjad.Note(pitches[interval[0]+3], QUAVER)) staff.append(abjad.Note(pitches[interval[0]+4], length*CROTCHET)) abjad.attach(abjad.TimeSignature((length+2,4)), staff[-5]) score = abjad.Score([staff]) score.add_final_bar_line() abjad.show(score)