musical_games.dice_games.lilypond package¶
Submodules¶
musical_games.dice_games.lilypond.bar_converters module¶
-
class
musical_games.dice_games.lilypond.bar_converters.
BarConverter
[source]¶ Bases:
object
Bar converters are used when rendering a given bar for use the AllBarsConcatenated typesetter
-
class
musical_games.dice_games.lilypond.bar_converters.
MozartBarConverter
[source]¶ Bases:
musical_games.dice_games.lilypond.bar_converters.BarConverter
Converts the two repeats bar to a single bar with two voices
-
class
musical_games.dice_games.lilypond.bar_converters.
SimpleBarConverter
[source]¶ Bases:
musical_games.dice_games.lilypond.bar_converters.BarConverter
Simply converts the Bar object to a string
musical_games.dice_games.lilypond.base module¶
-
class
musical_games.dice_games.lilypond.base.
LilypondBook
(scores, title, book)[source]¶ Bases:
object
Container for a single score.
Parameters: - scores (list of LilypondScore) – the list of scores out of which the book was typeset
- title (str) – the title of the score
- book (str) – the actual typeset book
-
scores
¶ list of LilypondScore
the list of scores out of which the book was typeset
-
title
¶ str
the title of the score
-
book
¶ str
the actual typeset book
-
class
musical_games.dice_games.lilypond.base.
LilypondScore
(title, score, is_midi_score=False, midi_instruments=())[source]¶ Bases:
object
Container for a single score.
Parameters: - title (str) – the title of the score
- score (str) – the score itself in string format
- is_midi_score (boolean) – if this score is a midi score (if True) or a visual score (if False)
- midi_instruments (list of str) – the list of midi instruments, one per staff. Only useful if it is a midi score.
-
title
¶ str
the title of the score
-
score
¶ str
the score itself in string format
-
is_midi_score
¶ boolean
if this score is a midi score (if True) or a visual score (if False)
-
midi_instruments
¶ list of str
the list of midi instruments, one per staff. Only useful if it is a midi score.
-
class
musical_games.dice_games.lilypond.base.
MusicBookComment
(left, middle, right)[source]¶ Bases:
object
Information about a comment for use in the MusicBookTypesetter.
Please note that each comment should fit on one line.
Parameters: - left (str) – the comment on the left of the page
- middle (str) – the comment on the middle of the page
- right (str) – the comment on the right of the page
-
class
musical_games.dice_games.lilypond.base.
TypesetStaffInfo
(music_expr, clef, key_signature, time_signature, instrument_name, midi_options)[source]¶ Bases:
object
All information needed to render a staff.
-
music_expr
¶ str
the actual lilypond code for this staff
-
clef
¶ str
the type of clef, lilypond string
-
key_signature
¶ KeySignature
the key signature
-
time_signature
¶ TimeSignature
the time signature
-
instrument_name
¶ str
the instrument name
-
midi_options
¶ MidiOptions
the container for the midi options
-
musical_games.dice_games.lilypond.staff_builders module¶
-
class
musical_games.dice_games.lilypond.staff_builders.
AllBarsConcatenated
(bars_lists, bar_converter, end_bar='|.')[source]¶ Bases:
musical_games.dice_games.lilypond.staff_builders.StaffTypeset
Typeset the given list of bar lists
Parameters: - bars_lists (list of list of Bar) – the list of Bars we will typeset
- bar_converter (BarConverter) – the bar converter to use for the conversions
- end_bar (str) – the end bar we will use (lilypond string). Only used if the last bar is not a repeat bar.
-
class
musical_games.dice_games.lilypond.staff_builders.
DaCapoAtEnd
[source]¶ Bases:
musical_games.dice_games.lilypond.staff_builders.StaffAnnotator
-
class
musical_games.dice_games.lilypond.staff_builders.
FineAtEnd
[source]¶ Bases:
musical_games.dice_games.lilypond.staff_builders.StaffAnnotator
-
class
musical_games.dice_games.lilypond.staff_builders.
KirnbergerPolonaiseStaffTypesetMidi
(bars_lists, end_bar='|.')[source]¶ Bases:
musical_games.dice_games.lilypond.staff_builders.StaffTypeset
Typeset the given list of bar lists
Parameters: - bars_lists (list of list of Bar) – the list of Bars we will typeset
- end_bar (str) – the end bar we will use (lilypond string). Only used if the last bar is not a repeat bar.
-
class
musical_games.dice_games.lilypond.staff_builders.
KirnbergerPolonaiseStaffTypesetVisual
(bars_lists, end_bar='|.')[source]¶ Bases:
musical_games.dice_games.lilypond.staff_builders.StaffTypeset
Typeset the given list of bar lists
Parameters: - bars_lists (list of list of Bar) – the list of Bars we will typeset
- end_bar (str) – the end bar we will use (lilypond string). Only used if the last bar is not a repeat bar.
-
class
musical_games.dice_games.lilypond.staff_builders.
NoneAnnotator
[source]¶ Bases:
musical_games.dice_games.lilypond.staff_builders.StaffAnnotator
-
class
musical_games.dice_games.lilypond.staff_builders.
StaffAnnotator
[source]¶ Bases:
object
-
class
musical_games.dice_games.lilypond.staff_builders.
StaffTypeset
(bars_lists, end_bar='|.')[source]¶ Bases:
object
Typeset the given list of bar lists
Parameters: - bars_lists (list of list of Bar) – the list of Bars we will typeset
- end_bar (str) – the end bar we will use (lilypond string). Only used if the last bar is not a repeat bar.
-
class
musical_games.dice_games.lilypond.staff_builders.
WithRepeat
(bars_lists, repeats, staff_annotator, end_bar='|.')[source]¶ Bases:
musical_games.dice_games.lilypond.staff_builders.StaffTypeset
Typeset all the bars with the necessary repeats.
Parameters: - bars_lists (list of list of Bar) – the list of Bars we will typeset
- repeats (list of tuples of int) – the bars we repeat. For example: [(0, 8), (8, 16)] indicates two repeats, one in which 0 to 8 is repeated and one in which 8 to 16 is repeated.
- staff_annotator (StaffAnnotator) – the staff annotator to use for annotating the staff
- end_bar (str) – the end bar we will use (lilypond string). Only used if the last bar is not a repeat bar.
musical_games.dice_games.lilypond.staff_layouts module¶
-
class
musical_games.dice_games.lilypond.staff_layouts.
AutoLayout
[source]¶ Bases:
musical_games.dice_games.lilypond.staff_layouts.StaffLayout
-
class
musical_games.dice_games.lilypond.staff_layouts.
PianoLayout
[source]¶ Bases:
musical_games.dice_games.lilypond.staff_layouts.StaffLayout
-
class
musical_games.dice_games.lilypond.staff_layouts.
SimpleNamedLayout
[source]¶ Bases:
musical_games.dice_games.lilypond.staff_layouts.StaffLayout
-
class
musical_games.dice_games.lilypond.staff_layouts.
SimpleWithPianoLayout
[source]¶ Bases:
musical_games.dice_games.lilypond.staff_layouts.StaffLayout
-
class
musical_games.dice_games.lilypond.staff_layouts.
StaffInfo
(music_block, instrument_name, options_block='')[source]¶ Bases:
object
This contains enough information about one staff in order to typeset it.
Parameters: - music_block (str) – the block containing the music for this staff
- instrument_name (str) – the name of this instrument, needed for display
- options_block (str) – the optional options block
-
class
musical_games.dice_games.lilypond.staff_layouts.
StaffLayout
[source]¶ Bases:
object
-
typeset_staffs
(staff_info_list)[source]¶ Typeset the given staffs.
This will typeset the given staffs according to a specific staff layout. For example, in lilypond we can combine two staffs using a piano staff. Also, lilypond allows nesting staffs, mixing staffs, etc. This is all taken care of by staff layouts.
Parameters: staff_info_list (list of StaffInfo) – the list of staff info to use for rendering Returns: the rendered staffs Return type: str
-
musical_games.dice_games.lilypond.typesetters module¶
-
class
musical_games.dice_games.lilypond.typesetters.
MidiScoreTypeset
(title, staffs, tempo_indication, midi_options=None)[source]¶ Bases:
musical_games.dice_games.lilypond.typesetters.SimpleScoreTypeset
The score typesetter for the midi output.
Parameters: - title (str) – the title for this score
- staffs (list of TypesetStaffInfo) – list of Staffs for each instrument.
- tempo_indication (TempoIndication) – the tempo indication
- midi_options (list) – if set, a list with additional midi options per tract
-
class
musical_games.dice_games.lilypond.typesetters.
MusicBookTypeset
(title, scores, show_title=False, comments=None, page_limit=None)[source]¶ Bases:
object
Typeset a series of scores into a book.
Parameters: - title (str) – the title of the book
- scores (list of LilypondScore) – the lilypond scores out of which we create the book
- show_title (bool) – if we want to show the titles or not
- comments (list of MusicBookComment) – the initial list of music book comments
- page_limit (int) – if not None we try to fit all the music on the given number of pages
-
add_comments
(comments)[source]¶ Add one or more comments to this book.
Parameters: comments (list of MusicBookComment or MusicBookComment) – the comments to append after the scores.
-
typeset
()[source]¶ Typeset the book.
Returns: the lilypond book Return type: LilypondBook
-
class
musical_games.dice_games.lilypond.typesetters.
SimpleScoreTypeset
(title, staffs, tempo_indication)[source]¶ Bases:
object
Information of a single piece for use in the MusicBook typesetter.
Parameters: - title (str) – the title for this score
- staffs (list of TypesetStaffInfo) – list of Staffs for each instrument.
- tempo_indication (TempoIndication) – the tempo indication
-
typeset
()[source]¶ Typeset all the information about one piece.
This typically typesets the score blocks.
Returns: the single score in lilypond format Return type: LilypondScore
-
class
musical_games.dice_games.lilypond.typesetters.
VisualScoreTypeset
(title, staffs, tempo_indication, staff_layout=None, show_bar_numbers=False, show_tempo_indication=True, show_title=True)[source]¶ Bases:
musical_games.dice_games.lilypond.typesetters.SimpleScoreTypeset
Information of a single piece for use in the MusicBook typesetter.
Parameters: - title (str) – the title for this score
- staffs (list of TypesetStaffInfo) – list of Staffs for each instrument.
- tempo_indication (TempoIndication) – the tempo indication
- staff_layout (StaffLayout) – the layout mechanism for displaying the staffs
- show_bar_numbers (bool) – if we want to display all bar numbers
- show_tempo_indication (bool) – if we want to display the tempo indication
- show_title (bool) – if we want to show the title or not