scamp.settings.QuantizationSettings

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

Bases: _ScampSettings

Namespace containing the settings relevant to the quantization of Performances in preparation for Score creation.

Parameters:

settings_dict – dictionary from which to set all settings attributes

Variables:
  • onset_weighting – float representing how much note start times are weighted compared with note end times and tie split points in determining how beats are divided. (All that matters is the relative size of the values.)

  • termination_weighting – float representing how much note end times are weighted compared with note start times and tie split points in determining how beats are divided. (All that matters is the relative size of the values.)

  • inner_split_weighting – float representing how much tie split points are weighted compared with note end times and note start times in determining how beats are divided. (All that matters is the relative size of the values.)

  • max_divisor – int representing the default maximum divisor allowed for a beat

  • max_divisor_indigestibility – float representing the default cap on the indigestibility of beat divisors. (See BeatQuantizationScheme)

  • simplicity_preference – float representing the default degree of preference for simple beat divisors. (See BeatQuantizationScheme)

  • default_time_signature – string (e.g. “4/4”) representing the default time signature to use when one is not specified.

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 quantization settings (from when SCAMP was installed)

factory_defaults = {'default_time_signature': '4/4', 'inner_split_weighting': 0.75, 'max_divisor': 8, 'max_divisor_indigestibility': None, 'onset_weighting': 1.0, 'simplicity_preference': 2.0, 'termination_weighting': 0.5}

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