예제 #1
0
 def __init__(self, always_first_note=True, dynamics=None, minimum_duration=None):
     DynamicHandler.__init__(self, minimum_duration=minimum_duration)
     assert isinstance(always_first_note, bool), repr(always_first_note)
     self._always_first_note = always_first_note
     if dynamics is not None:
         for dynamic in dynamics:
             if not indicatortools.Dynamic.is_dynamic_name(dynamic):
                 message = "not dynamic name: {!r}."
                 message = message.format(dynamic)
                 raise TypeError(message)
     self._dynamics = dynamics
예제 #2
0
 def __init__(
     self, 
     hairpin_tokens=None, 
     minimum_duration=None,
     ):
     DynamicHandler.__init__(self, minimum_duration=minimum_duration)
     if hairpin_tokens is not None:
         for hairpin_token in hairpin_tokens:
             if not spannertools.Hairpin._is_hairpin_token(hairpin_token):
                 message = 'not hairpin token: {!r}'.format(hairpin_token)
                 raise ValueError(message)
     self._hairpin_tokens = hairpin_tokens
예제 #3
0
 def __init__(
     self,
     hairpin_token=None,
     minimum_duration=None,
     patterns=None,
 ):
     DynamicHandler.__init__(self, minimum_duration=minimum_duration)
     if hairpin_token is not None:
         if isinstance(hairpin_token, str):
             hairpin_token = tuple(hairpin_token.split())
         assert spannertools.Hairpin._is_hairpin_token(hairpin_token)
     self._hairpin_token = hairpin_token
     if patterns is not None:
         assert isinstance(patterns, (list, tuple)), repr(patterns)
     self._patterns = patterns
 def __init__(
     self, 
     hairpin_token=None, 
     minimum_duration=None,
     patterns=None,
     ):
     DynamicHandler.__init__(self, minimum_duration=minimum_duration)
     if hairpin_token is not None:
         if isinstance(hairpin_token, str):
             hairpin_token = tuple(hairpin_token.split())
         assert spannertools.Hairpin._is_hairpin_token(hairpin_token)
     self._hairpin_token = hairpin_token
     if patterns is not None:
         assert isinstance(patterns, (list, tuple)), repr(patterns)
     self._patterns = patterns
예제 #5
0
 def __init__(
     self,
     always_first_note=True,
     dynamics=None,
     minimum_duration=None,
 ):
     DynamicHandler.__init__(self, minimum_duration=minimum_duration)
     assert isinstance(always_first_note, bool), repr(always_first_note)
     self._always_first_note = always_first_note
     if dynamics is not None:
         for dynamic in dynamics:
             if not indicatortools.Dynamic.is_dynamic_name(dynamic):
                 message = 'not dynamic name: {!r}.'
                 message = message.format(dynamic)
                 raise TypeError(message)
     self._dynamics = dynamics
 def __init__(
     self,
     attach_start_dynamic_to_lone_notes=True,
     hairpin_token=None,
     minimum_duration=None,
     patterns=None,
     span='contiguous notes and chords',
 ):
     DynamicHandler.__init__(self, minimum_duration=minimum_duration)
     self._attach_start_dynamic_to_lone_notes = bool(
         attach_start_dynamic_to_lone_notes)
     if hairpin_token is None:
         hairpin_token = []
     elif isinstance(hairpin_token, str):
         hairpin_token = tuple(hairpin_token.split())
         assert spannertools.Hairpin._is_hairpin_token(hairpin_token)
     elif isinstance(hairpin_token, list):
         tokens = []
         for element in hairpin_token:
             if isinstance(element, str):
                 element = tuple(element.split())
                 if not spannertools.Hairpin._is_hairpin_token(element):
                     message = 'must be valid hairpin token: {!r}.'
                     message = message.format(element)
                     raise Exception(message)
             tokens.append(element)
         hairpin_token = tokens
     if isinstance(hairpin_token, datastructuretools.CyclicTuple):
         pass
     elif isinstance(hairpin_token, list):
         hairpin_token = datastructuretools.CyclicTuple(hairpin_token)
     elif isinstance(hairpin_token, tuple):
         hairpin_token = datastructuretools.CyclicTuple([hairpin_token])
     else:
         raise TypeError(hairpin_token)
     self._hairpin_token = hairpin_token
     if patterns is not None:
         assert isinstance(patterns, (list, tuple)), repr(patterns)
     self._patterns = patterns
     strings = (
         'contiguous notes and chords',
         'nontrivial ties',
     )
     if span not in strings:
         assert isinstance(span, (tuple, list)), repr(span)
     self._span = span
 def __init__(
     self,
     attach_start_dynamic_to_lone_notes=True,
     hairpin_token=None,
     minimum_duration=None,
     patterns=None,
     span='contiguous notes and chords',
     ):
     DynamicHandler.__init__(self, minimum_duration=minimum_duration)
     self._attach_start_dynamic_to_lone_notes = bool(
         attach_start_dynamic_to_lone_notes)
     if hairpin_token is None:
         hairpin_token = []
     elif isinstance(hairpin_token, str):
         hairpin_token = tuple(hairpin_token.split())
         assert spannertools.Hairpin._is_hairpin_token(hairpin_token)
     elif isinstance(hairpin_token, list):
         tokens = []
         for element in hairpin_token:
             if isinstance(element, str):
                 element = tuple(element.split())
                 if not spannertools.Hairpin._is_hairpin_token(element):
                     message = 'must be valid hairpin token: {!r}.'
                     message = message.format(element)
                     raise Exception(message)
             tokens.append(element)
         hairpin_token = tokens
     if isinstance(hairpin_token, datastructuretools.CyclicTuple):
         pass
     elif isinstance(hairpin_token, list):
         hairpin_token = datastructuretools.CyclicTuple(hairpin_token)
     elif isinstance(hairpin_token, tuple):
         hairpin_token = datastructuretools.CyclicTuple([hairpin_token])
     else:
         raise TypeError(hairpin_token)
     self._hairpin_token = hairpin_token
     if patterns is not None:
         assert isinstance(patterns, (list, tuple)), repr(patterns)
     self._patterns = patterns
     strings = (
         'contiguous notes and chords',
         'nontrivial ties',
         )
     if span not in strings:
         assert isinstance(span, (tuple, list)), repr(span)
     self._span = span
예제 #8
0
 def __init__(self, dynamic_name=None, minimum_duration=None):
     DynamicHandler.__init__(self, minimum_duration=minimum_duration)
     if dynamic_name is not None:
         assert indicatortools.Dynamic.is_dynamic_name(dynamic_name)
     self._dynamic_name = dynamic_name
예제 #9
0
 def __init__(self, dynamic_name=None, minimum_duration=None):
     DynamicHandler.__init__(self, minimum_duration=minimum_duration)
     if dynamic_name is not None:
         assert indicatortools.Dynamic.is_dynamic_name(dynamic_name)
     self._dynamic_name = dynamic_name
예제 #10
0
 def __init__(self, dynamics_talea=None, minimum_duration=None):
     DynamicHandler.__init__(self, minimum_duration=minimum_duration)
     dynamics_talea = dynamics_talea or ()
     dynamics_talea = datastructuretools.CyclicTuple(dynamics_talea)
     self._dynamics_talea = dynamics_talea
예제 #11
0
 def __init__(self, swell_dynamics=None, minimum_duration=None):
     DynamicHandler.__init__(self, minimum_duration=minimum_duration)
     if swell_dynamics is not None:
         swell_dynamic = tuple(swell_dynamics)
     self._swell_dynamics = swell_dynamics
 def __init__(self, swell_dynamics=None, minimum_duration=None):
     DynamicHandler.__init__(self, minimum_duration=minimum_duration)
     if swell_dynamics is not None:
         swell_dynamic = tuple(swell_dynamics)
     self._swell_dynamics = swell_dynamics