def render_score(score, beats, jigs): # adapted from https://github.com/Abjad/abjad/blob/5c7f5f7abd8013f99b60c9ceb3a91c771abbca7c/abjad/demos/ligeti/make_desordre_lilypond_file.py file = abjad.LilyPondFile.new(score, global_staff_size=18) context_block = abjad.ContextBlock(source_context_name='Score') file.layout_block.items.append(context_block) # for future reference: http://lilypond.org/doc/v2.18/Documentation/learning/engravers-explained.en.html context_block.remove_commands.append('Bar_number_engraver') context_block.remove_commands.append('Default_bar_line_engraver') abjad.override(context_block).clef.transparent = True abjad.override(context_block).spacing_spanner.strict_grace_spacing = True abjad.override(context_block).spacing_spanner.strict_note_spacing = True abjad.override(context_block).spacing_spanner.uniform_stretching = True abjad.override(context_block).text_script.staff_padding = 0 abjad.override(context_block).time_signature.transparent = True abjad.override(context_block).rest.transparent = True abjad.override(context_block).dots.transparent = True file.header_block.tagline = ' ' file.paper_block.paper_width = beats * 15 file.paper_block.paper_height = jigs * 20 file.paper_block.bottom_margin = 0 file.paper_block.left_margin = 0 vector = abjad.SpacingVector(0, 0, 15, 0) #file.paper_block.system_system_spacing = vector abjad.show(file)
def configure_score(score): """ Configures score. """ # configure bell staff bell_staff = score["Bell Staff"] leaf = abjad.inspect(bell_staff).leaf(0) clef = abjad.Clef("treble") abjad.attach(clef, leaf) bells = abjad.Instrument(name="Campana in La", short_name="Camp.", pitch_range="[C4, C6]") abjad.attach(bells, leaf) mark = abjad.MetronomeMark((1, 4), (112, 120)) abjad.attach(mark, leaf) # time_signature = abjad.TimeSignature((6, 4)) # abjad.attach(time_signature, leaf) # configure first violin staff first_violin_staff = score["First Violin Staff"] leaf = abjad.inspect(first_violin_staff).leaf(0) clef = abjad.Clef("treble") abjad.attach(clef, leaf) violin = abjad.Violin(markup=abjad.Markup("Violin I"), short_markup=abjad.Markup("Vl. I")) abjad.attach(violin, leaf) # configure second violin staff second_violin_staff = score["Second Violin Staff"] leaf = abjad.inspect(second_violin_staff).leaf(0) clef = abjad.Clef("treble") abjad.attach(clef, leaf) violin = abjad.Violin(markup=abjad.Markup("Violin II"), short_markup=abjad.Markup("Vl. II")) abjad.attach(violin, leaf) # configure viola staff leaf = abjad.inspect(score["Viola Staff"]).leaf(0) clef = abjad.Clef("alto") abjad.attach(clef, leaf) viola = abjad.Viola() abjad.attach(viola, leaf) # configure cello staff leaf = abjad.inspect(score["Cello Staff"]).leaf(0) clef = abjad.Clef("bass") abjad.attach(clef, leaf) cello = abjad.Cello() abjad.attach(cello, leaf) # configure bass staff leaf = abjad.inspect(score["Bass Staff"]).leaf(0) clef = abjad.Clef("bass") abjad.attach(clef, leaf) contrabass = abjad.Contrabass(short_markup=abjad.Markup("Cb.")) abjad.attach(contrabass, leaf) # configure score vector = abjad.SpacingVector(0, 0, 8, 0) abjad.override(score).vertical_axis_group.staff_staff_spacing = vector abjad.override(score).staff_grouper.staff_staff_spacing = vector abjad.override(score).staff_symbol.thickness = 0.5 scheme = abjad.Scheme("format-mark-box-numbers") abjad.setting(score).mark_formatter = scheme
def configure_lilypond_file(self, lilypond_file): r'''Configures LilyPond file. ''' lilypond_file._default_paper_size = '11x17', 'portrait' lilypond_file._global_staff_size = 12 lilypond_file.layout_block.indent = 0 lilypond_file.layout_block.ragged_right = True lilypond_file.paper_block.ragged_bottom = True spacing_vector = abjad.SpacingVector(0, 0, 8, 0) lilypond_file.paper_block.system_system_spacing = spacing_vector
def configure_score(score): r'''Configures score. ''' # configure bell staff bell_staff = score['Bell Staff'] leaf = abjad.inspect(bell_staff).get_leaf(0) clef = abjad.Clef('treble') abjad.attach(clef, leaf) bells = abjad.instrumenttools.Instrument( name='Campana in La', short_name='Camp.', pitch_range='[C4, C6]', ) abjad.attach(bells, leaf) mark = abjad.MetronomeMark((1, 4), (112, 120)) abjad.attach(mark, leaf) time_signature = abjad.TimeSignature((6, 4)) abjad.attach(time_signature, leaf) # configure first violin staff first_violin_staff = score['First Violin Staff'] leaf = abjad.inspect(first_violin_staff).get_leaf(0) clef = abjad.Clef('treble') abjad.attach(clef, leaf) violin = abjad.instrumenttools.Violin( markup=abjad.Markup('Violin I'), short_markup=abjad.Markup('Vl. I'), ) abjad.attach(violin, leaf) # configure second violin staff second_violin_staff = score['Second Violin Staff'] leaf = abjad.inspect(second_violin_staff).get_leaf(0) clef = abjad.Clef('treble') abjad.attach(clef, leaf) violin = abjad.instrumenttools.Violin( markup=abjad.Markup('Violin II'), short_markup=abjad.Markup('Vl. II'), ) abjad.attach(violin, leaf) # configure viola staff leaf = abjad.inspect(score['Viola Staff']).get_leaf(0) clef = abjad.Clef('alto') abjad.attach(clef, leaf) viola = abjad.instrumenttools.Viola() abjad.attach(viola, leaf) # configure cello staff leaf = abjad.inspect(score['Cello Staff']).get_leaf(0) clef = abjad.Clef('bass') abjad.attach(clef, leaf) cello = abjad.instrumenttools.Cello() abjad.attach(cello, leaf) # configure bass staff leaf = abjad.inspect(score['Bass Staff']).get_leaf(0) clef = abjad.Clef('bass') abjad.attach(clef, leaf) contrabass = abjad.instrumenttools.Contrabass( short_markup=abjad.Markup('Cb.'), ) abjad.attach(contrabass, leaf) # configure score vector = abjad.SpacingVector(0, 0, 8, 0) abjad.override(score).vertical_axis_group.staff_staff_spacing = vector abjad.override(score).staff_grouper.staff_staff_spacing = vector abjad.override(score).staff_symbol.thickness = 0.5 scheme = abjad.Scheme('format-mark-box-numbers') abjad.setting(score).mark_formatter = scheme