Пример #1
0
    def __init__(self,
                 only_final: bool = False,
                 ast: bool = False,
                 context: Context = None,
                 nameless_voices: bool = True,
                 declare_voices: bool = True,
                 base_voice: Voice = None):
        """
        only_final          When true, the result is only emitted after the entire 
                            input (musical sequence) has been processed. When false,
                            intermediate notations are continuously emitted.
        
        ast                 When true, emits the Abstract Syntax Tree objects. When
                            false, transforms those objects into a string that can
                            be parsed, and emits the string instead

        nameless_voices     When true, it tries to produce notation that carries with
                            it any state that is needed, instead of prepending 
                            the names of the voices the events belonged to
        
        declare_voices      When `nameless_voices = False`, also include the 
                            definitions of the named voices used.
        
        base_voice          ...
        """
        super().__init__(only_final)

        self.ast: bool = ast
        self.context: Context = context or Context.create()
        self.nameless_voices: bool = nameless_voices
        self.declare_voices: bool = declare_voices
        self.base_voice: Voice = base_voice or Voice()
    def create_context ( self, player : Player ):
        ctx = Context.create()

        ctx.link( StandardLibrary() )
        ctx.link( MusicLibrary() )
        ctx.link( KeyboardLibrary( player ) )

        return ctx
Пример #3
0
 def setUp(self):
     self.parser = parser
     self.context = Context.create()
     self.context.link(StandardLibrary(None))