subsequence.catalogue
The API reference for generators, describe_generator, transforms, and describe_transform.
generators
generators() -> typing.List[typing.Dict[str, typing.Any]]
Describe every generator Subsequence offers, as plain data.
The whole catalogue in one call, so a caller never has to hold its own list
of what exists. Each entry is exactly what describe_generator
returns for that name.
Example
import subsequence
for shape in subsequence.generators():
print(shape["name"], len(shape["parameters"]))
describe_generator
describe_generator(name: str) -> typing.Dict[str, typing.Any]
Describe one generator's parameters as plain data.
Parameters
name: The generator's method name onPatternBuilder, e.g."ghost_fill".
Returns
typing.Dict[str, typing.Any]: A dict withname,summary,partial,parametersanddropped— see this module's contract. Each parameter says whether it isrequiredand what it defaults to.
Raises
ValueError: if name is not a declared generator. A transform is named as such rather than reported missing, since the two catalogues are easy to confuse and the answer is one call away.
Example
import subsequence
shape = subsequence.describe_generator("euclidean")
shape["parameters"][0]["kind"] # 'pitch'
transforms
transforms() -> typing.List[typing.Dict[str, typing.Any]]
Describe every transform Subsequence offers, as plain data.
The companion to generators: those place notes, these reshape
notes already placed. A surface that wants to roll a rhythm off the
downbeat asks here rather than holding its own list of method names.
Example
import subsequence
for shape in subsequence.transforms():
print(shape["name"], len(shape["parameters"]))
describe_transform
describe_transform(name: str) -> typing.Dict[str, typing.Any]
Describe one transform's parameters as plain data.
Parameters
name: The transform's method name onPatternBuilder, e.g."rotate".
Returns
- The same shape
describe_generatorreturns. A transform is applied the same way a generator is, so a caller that can drive one can drive the other without a second code path.
Raises
ValueError: if name is not a declared transform.
Example
import subsequence
shape = subsequence.describe_transform("rotate")
shape["parameters"][0]["name"] # 'steps'