QuantizedScore

class maelzel.scoring.quant.QuantizedScore(parts, title='', composer='')[source]

Bases: object

A QuantizedScore represents a list of quantized parts

See quantize() for an example

Parameters:
  • parts (list[QuantizedPart]) – the parts of this QuantizedScore

  • title – an optional title for this score

  • composer – an optional composer for this score

parts

the parts of this score

title

an optional title

composer

an optional composer

Attributes Summary

composer

Composer of the score, used for rendering

parts

A list of QuantizedParts

scorestruct

Returns the ScoreStruct of this score

title

Title of the score, used for rendering purposes

Methods Summary

check()

Check this QuantizedScore

dump([tree, indent, stream, numindents])

Dump this QuantizedScore to a given stream or to stdout

groupParts()

Group parts which have the same id

numMeasures()

Returns the number of measures in this score

padEmptyMeasures()

Adds empty measures at the end of each part so that all have the same length

removeUnnecessaryDynamics()

Removes any unnecessary dynamics in this score

render([options, backend])

Render this quantized score

resolveChordEnharmonics([enharmonicOptions])

Finds the best enharmonic variant for each chord individually and pins it to it

resolveEnharmonics(enharmonicOptions)

Finds the best spelling for each part in this score, inplace

show([backend, fmt, external])

toCoreScore()

Convert this QuantizedScore to a Score

write(outfile[, options, backend])

Export this score as pdf, png, lilypond, MIDI or musicxml

Attributes Documentation

composer: str

Composer of the score, used for rendering

parts: list[QuantizedPart]

A list of QuantizedParts

scorestruct

Returns the ScoreStruct of this score

title: str

Title of the score, used for rendering purposes

Methods Documentation

check()[source]

Check this QuantizedScore

dump(tree=True, indent='  ', stream=None, numindents=0)[source]

Dump this QuantizedScore to a given stream or to stdout

Parameters:
  • tree – if True, use the tree representation for each measure

  • indent – the indentation to use

  • stream – the stream to write to

  • numindents (int) – the starting indentation

Return type:

None

groupParts()[source]

Group parts which have the same id

At the moment we do not support subgroups

Return type:

list[list[QuantizedPart]]

Returns:

A list of groups where a group is a list of parts with the same id

numMeasures()[source]

Returns the number of measures in this score

Return type:

int

padEmptyMeasures()[source]

Adds empty measures at the end of each part so that all have the same length

Return type:

None

removeUnnecessaryDynamics()[source]

Removes any unnecessary dynamics in this score

Parameters:

tree – if True, apply the transformation to the tree representation

render(options=None, backend='')[source]

Render this quantized score

Parameters:
  • options (Optional[RenderOptions]) – the RenderOptions to use

  • backend (str) – the backend to use. If not given the backend defined in the render options will be used instead

Return type:

Renderer

Returns:

the Renderer

resolveChordEnharmonics(enharmonicOptions=None)[source]

Finds the best enharmonic variant for each chord individually and pins it to it

As an alternative for finding the best global spelling it is possible to just fix each chord individually

Return type:

None

resolveEnharmonics(enharmonicOptions)[source]

Finds the best spelling for each part in this score, inplace

Parameters:

enharmonicOptions (EnharmonicOptions) – the enharmonic options to use

Return type:

None

show(backend='', fmt='png', external=False)[source]
toCoreScore()[source]

Convert this QuantizedScore to a Score

Return type:

Score

Returns:

the corresponding maelzel.core.Score

Example

>>> from maelzel.core import *
>>> chain = Chain([...
write(outfile, options=None, backend='')[source]

Export this score as pdf, png, lilypond, MIDI or musicxml

When rendering to pdf or png both the lilypond or the musicxml backend can be used.

Parameters:
  • outfile (str) – the path of the written file

  • options (Optional[RenderOptions]) – render options used to generate the output

  • backend – backend used when writing to png / pdf (one of ‘lilypond’, ‘musicxml’)

Return type:

Renderer

Returns:

the Renderer used