scamp.settings.TempoSettings
- class scamp.settings.TempoSettings(settings_dict: Optional[dict] = None, suppress_warnings: bool = False)[source]
Bases:
_ScampSettings
Namespace containing the settings relevant to the engraving of tempo changes.
- Parameters:
settings_dict – dictionary from which to set all settings attributes
- Variables:
guide_mark_resolution – grid that the guide marks are snapped to, in beats. Actual appearance of a guide mark depends on guide_mark_sensitivity.
guide_mark_sensitivity – guide_mark_sensitivity represents how much a tempo has to change proportionally to put a guide mark. For instance, if it’s 0.1 and the last notated tempo was 60, we’ll put a guide mark when the tempo reaches 60 +/- 0.1 * 60 = 54 or 66.
include_guide_marks – Whether or not to include tempo guide marks, i.e. marks showing the tempo at points in between explicit tempo targets.
parenthesize_guide_marks – Whether or not to place tempo guide marks in parentheses.
Inherited Methods
Returns a copy of this object by serializing to and from JSON.
Returns a factory default version of this settings object.
Dump this object as a JSON string.
json_loads
(s)Load this object from a JSON string.
load
()Loads and instance of this settings object from its corresponding JSON file.
load_from_json
(file_path)Load this object from a JSON file with the given path.
Rewrites the JSON file from which settings are loaded, meaning that this reset will persist to the running of scripts in the future.
open_json_file
(*command_and_flags)Open the JSON file for these settings.
restore_factory_defaults
([persist])Restores settings back to their "factory defaults" (the defaults when SCAMP was installed).
save_to_json
(file_path)Save this object to a JSON file using the given path.
Attributes
Default tempo-related settings (from when SCAMP was installed)
- factory_defaults = {'guide_mark_resolution': 0.125, 'guide_mark_sensitivity': 0.08, 'include_guide_marks': True, 'parenthesize_guide_marks': True}
Default tempo-related settings (from when SCAMP was installed)
- duplicate() T
Returns a copy of this object by serializing to and from JSON.
- classmethod factory_default()
Returns a factory default version of this settings object.
- 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
- classmethod load()
Loads and instance of this settings object from its corresponding JSON file. If no such file exists, or it is corrupted in some way, then this creates a fresh JSON file there. This doesn’t work with settings that are nested within other settings (like GlissandiSettings), since they do not have corresponding JSON files,
- 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
- make_persistent() None
Rewrites the JSON file from which settings are loaded, meaning that this reset will persist to the running of scripts in the future.
- open_json_file(*command_and_flags)
Open the JSON file for these settings.
- Parameters:
command_and_flags – the command-line tool with which to open the file, and any associated flags. Defaults to a platform-specific generic open command.
- restore_factory_defaults(persist=False) None
Restores settings back to their “factory defaults” (the defaults when SCAMP was installed). Unless the persist argument is set, this is temporary to the running of the current script.
- Parameters:
persist – if True, rewrites the JSON file from which defaults are loaded, meaning that this reset will persist to the running of scripts in the future.
- 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