makeSpanner

maelzel.core.symbols.makeSpanner(descr, kind='start', linetype='', placement='', color='')[source]

Create a spanner from a descriptor

This is mostly used within a note/chord defined as string. For example, within a Voice/Chain, a note could be defined as “C4:1/2:slur”; this will create a C4 eighth note which starts a slur. The slur will be extended until the end of the chain/voice or until another note defines a ‘~slur’ attribute, which ends the slur (a ‘~’ sign ends a previously open spanner of the same kind).

Possible descriptors:

  • ‘slur:dashed’

  • ‘bracket:text=foo’

  • ‘<’

  • ‘>’

  • ‘linespan:dotted:starttext=foo’

  • ‘trill’

  • etc.

Parameters:

descr (str) – a descriptor string

Return type:

Spanner

Returns:

the spanner

Example

>>> from maelzel.core import *
>>> chain = Chain(...)
>>> spanner = makeSpanner("trill")
>>> spanner.bind(chain[0], chain[-1])