attune.Instrument

class attune.Instrument(arrangements: Dict[str, Arrangement | dict], setables: Dict[str, Setable | dict | None] | None = None, *, name: str | None = None, transition: Transition | dict | None = None, load: float | None = None)[source]

Bases: object

__init__(arrangements: Dict[str, Arrangement | dict], setables: Dict[str, Setable | dict | None] | None = None, *, name: str | None = None, transition: Transition | dict | None = None, load: float | None = None)[source]

Representation of a system of arrangements for an instrument.

Parameters:
  • arrangements (Dict[str, Union[Arrangement, dict]) – Dictionary of arrangements in the instrument

  • setables (Dict[str, Optional[Union[Setable, dict]]]) – Default values for the instrument. Can be ignored unless you require your instrument to have default positions.

  • name (Optional[str]) – The name of the instrument, used to store/retrieve the instrument.

  • transition (Optional[Union[Transition, dict]]) – The operation which creates this instrument. transitions are concise records for instrument changes. If not given, a blank Transition (TransitionType “create”) will be made.

  • load (Optional[float]) – POSIX timestamp of the tune when retrieved from the store. Ignore for instruments not retrieved from the store.

property arrangements

The arrangements associated with this instrument.

as_dict()[source]

Dictionary representation for this Instrument.

property load

The POSIX timestamp for when this instrument was created, if it was stored.

property name

The name of the instrument.

This is the key that is used to store/retrieve the instrument.

print_tree()[source]

Print a ascii-formatted tree representation of the instrument contents.

save(file)[source]

Save the JSON representation into an open file.

property setables

The setables associated with this instrument.

property transition

The transition operation that generated this instrument.