scamp.settings.GlissandiSettings

class scamp.settings.GlissandiSettings(settings_dict: Optional[dict] = None, suppress_warnings: bool = False)[source]

Bases: _ScampSettings

Namespace containing the settings relevant to the engraving of glissandi.

Parameters:

settings_dict – dictionary from which to set all settings attributes

Variables:
  • control_point_policy

    Can be either “grace”, “split”, or “none”:

    • if “grace”, the rhythm is expressed as simply as possible and they are engraved as headless grace notes

    • if “split”, the note is split rhythmically at the control points

    • if “none”, control points are ignored

  • consider_non_extrema_control_points – if true, we consider all gliss control points in the engraving process. If false, we only consider local extrema (i.e. points where the gliss changes direction).

  • include_end_grace_note – if true, the final pitch reached is expressed as a gliss up to a headless grace note.

  • inner_grace_relevance_threshold – this threshold helps determine which gliss control points are worth expressing in notation. The further a control point is from its neighbors, and the further it deviates from the linearly interpolated pitch at that point, the higher its relevance score. The relevance score must be above this threshold to show up.

  • max_inner_graces_music_xml – integer (probably 1) capping the number of inner grace notes between notes of a glissando that we put in when outputting music xml. (Most programs can’t even handle 1 appropriately, but there’s nothing inherently unclear about including more in the XML.)

Inherited Methods

duplicate()

Returns a copy of this object by serializing to and from JSON.

factory_default()

Returns a factory default version of this settings object.

json_dumps()

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.

make_persistent()

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

factory_defaults

Default glissandi-related settings (from when SCAMP was installed)

factory_defaults = {'consider_non_extrema_control_points': True, 'control_point_policy': 'split', 'include_end_grace_note': True, 'inner_grace_relevance_threshold': 1.5, 'max_inner_graces_music_xml': 1, 'slur_glisses': True}

Default glissandi-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