scamp.playback_adjustments.PlaybackAdjustmentsDictionary¶
-
class
scamp.playback_adjustments.
PlaybackAdjustmentsDictionary
(**kwargs)[source]¶ Bases:
collections.UserDict
,expenvelope.json_serializer.SavesToJSON
Dictionary containing playback adjustments for different articulations, noteheads, and other notations. The instance of this at playback_settings.adjustments is consulted during playback. Essentially, this is just a dictionary with a couple of convenience methods to set and get adjustments for different properties.
Methods
get
(note_property)Get the
NotePlaybackAdjustment
for the given note_property.set
(note_property, adjustment)Set the given note_property to have the given
NotePlaybackAdjustment
.Inherited Methods
clear
()copy
()Returns a copy of this object by serializing to and from JSON.
fromkeys
(iterable[, value])items
()Dump this object as a JSON string.
json_loads
(s)Load this object from a JSON string.
keys
()load_from_json
(file_path)Load this object from a JSON file with the given path.
pop
(k[,d])If key is not found, d is returned if given, otherwise KeyError is raised.
popitem
()as a 2-tuple; but raise KeyError if D is empty.
save_to_json
(file_path)Save this object to a JSON file using the given path.
setdefault
(k[,d])update
([E, ]**F)If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v
values
()-
set
(note_property: str, adjustment: Union[str, scamp.playback_adjustments.NotePlaybackAdjustment]) → None[source]¶ Set the given note_property to have the given
NotePlaybackAdjustment
. The note property can either be a key/value pair (e.g. “notehead: slash”) or a value, from which we infer the key (e.g. “staccato”, from which it is inferred as an articulation)- Parameters
note_property – name of the notation detail, e.g. “staccato” or “harmonic”
adjustment – the adjustment to make for that notation. Either a
NotePlaybackAdjustment
or a string to be parsed to aNotePlaybackAdjustment
usingNotePlaybackAdjustment.from_string
-
get
(note_property: str) → scamp.playback_adjustments.NotePlaybackAdjustment[source]¶ Get the
NotePlaybackAdjustment
for the given note_property. The note property can either be a key/value pair (e.g. “notehead: slash”) or a value, from which we infer the key (e.g. “staccato”, from which it is inferred as an articulation)- Parameters
note_property – name of the note property, e.g. “staccato” or “harmonic”
- Returns
the
NotePlaybackAdjustment
for that detail
-
clear
() → None. Remove all items from D.¶
-
copy
()¶
-
duplicate
() → T¶ Returns a copy of this object by serializing to and from JSON.
-
classmethod
fromkeys
(iterable, value=None)¶
-
items
() → a set-like object providing a view on D’s items¶
-
json_dumps
() → str¶ Dump this object as a JSON string. This uses a custom encoder that recognizes and appropriately converts any attributes that are object inheriting from SavesToJSON.
-
classmethod
json_loads
(s: str) → T¶ Load this object from a JSON string. This uses a custom decoder that looks for a “_type” key in any object/dictionary being parsed and converts it to the class specified (assuming it a subclass of SavesToJSON).
- Parameters
s – a string representing this object in JSON format
-
keys
() → a set-like object providing a view on D’s keys¶
-
classmethod
load_from_json
(file_path: str) → T¶ Load this object from a JSON file with the given path. This uses a custom decoder that looks for a “_type” key in any object/dictionary being parsed and converts it to the class specified (assuming it a subclass of SavesToJSON).
- Parameters
file_path – path for loading the file
-
pop
(k[, d]) → v, remove specified key and return the corresponding value.¶ If key is not found, d is returned if given, otherwise KeyError is raised.
-
popitem
() → (k, v), remove and return some (key, value) pair¶ as a 2-tuple; but raise KeyError if D is empty.
-
save_to_json
(file_path: str) → None¶ Save this object to a JSON file using the given path. This uses a custom encoder that recognizes and appropriately converts any attributes that are object inheriting from SavesToJSON.
- Parameters
file_path – path for saving the file
-
setdefault
(k[, d]) → D.get(k,d), also set D[k]=d if k not in D¶
-
update
([E, ]**F) → None. Update D from mapping/iterable E and F.¶ If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v
-
values
() → an object providing a view on D’s values¶
-