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

quantprofile

scorestruct

Returns the ScoreStruct of this score

title

Title of the score, used for rendering purposes

Methods Summary

check()

Check this QuantizedScore

coreScore()

Convert this QuantizedScore to a Score

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

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

setReadOnly(value)

show([backend, fmt, external])

toCoreScore()

DEPRECATED.

write(outfile[, options, backend, format])

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

quantprofile
scorestruct

Returns the ScoreStruct of this score

title: str

Title of the score, used for rendering purposes

Methods Documentation

check()[source]

Check this QuantizedScore

coreScore()[source]

Convert this QuantizedScore to a Score

Return type:

Score

Returns:

the corresponding maelzel.core.Score

Example

>>> from maelzel.core import *
>>> chain = Chain([...
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

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

setReadOnly(value)[source]
Return type:

None

show(backend='', fmt='png', external=False)[source]
Return type:

None

toCoreScore()[source]

DEPRECATED. Convert this QuantizedScore to a Score

Use .coreScore instead

Return type:

Score

Returns:

the corresponding maelzel.core.Score

Example

>>> from maelzel.core import *
>>> chain = Chain([...
write(outfile, options=None, backend='', format='')[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. Use ‘stdout’ to print to stdout

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

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

  • format – format used (one of ‘pdf’, ‘png’, ‘musicxml’, ‘lilypond’). If not given it is inferred from the file extension.

Return type:

Renderer

Returns:

the Renderer used