scamp_extensions.playback.supercollider.sc_playback_implementation.SCPlaybackImplementation
- class scamp_extensions.playback.supercollider.sc_playback_implementation.SCPlaybackImplementation(synth_def: str)[source]
Bases:
OSCPlaybackImplementation
A subclass of
OSCPlaybackImplementation
designed to communicate with a running copy of SCLang (via anSCLangInstance
).- Parameters:
host_instrument – the host instrument for this playback implementation
synth_def – a string of SCLang code representing the SynthDef to run. This should take at least the the arguments “freq” (to which the pitch is sent), “volume” (to which the not volume is sent), and “gate” (which is used to start and stop the note).
Inherited Methods
change_note_parameter
(note_id, ...)Method that implements the change of a parameter other than pitch or volume
change_note_pitch
(note_id, new_pitch)Method that implements the change of a note's pitch
change_note_volume
(note_id, new_volume)Method that implements the change of a note's volume
Returns a copy of this object by serializing to and from JSON.
end_note
(note_id)Method that implements the end of a note
Dump this object as a JSON string.
json_loads
(s)Load this object from a JSON string.
load_from_json
(file_path)Load this object from a JSON file with the given path.
save_to_json
(file_path)Save this object to a JSON file using the given path.
set_max_pitch_bend
(semitones)This method does nothing in the case of an OSC-based implementation
start_note
(note_id, pitch, volume, ...)Method that implements the start of a note
Attributes
- sclang_instance = None
- change_note_parameter(note_id: int, parameter_name: str, new_value: float) None
Method that implements the change of a parameter other than pitch or volume
- Parameters:
note_id – unique identifier of the note to effect
parameter_name – name of the parameter to change
new_value – new floating-point value of that parameter
- change_note_pitch(note_id: int, new_pitch: float) None
Method that implements the change of a note’s pitch
- Parameters:
note_id – unique identifier of the note whose pitch to change
new_pitch – new (floating-point) MIDI pitch value
- change_note_volume(note_id: int, new_volume: float) None
Method that implements the change of a note’s volume
- Parameters:
note_id – unique identifier of the note whose volume to change
new_volume – new floating point volume value from 0 to 1
- duplicate() T
Returns a copy of this object by serializing to and from JSON.
- end_note(note_id: int) None
Method that implements the end of a note
- Parameters:
note_id – unique identifier of the note to end
- 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_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
- 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
- set_max_pitch_bend(semitones: int) None
This method does nothing in the case of an OSC-based implementation
- start_note(note_id: int, pitch: float, volume: float, properties: NoteProperties, note_info_dict: dict) None
Method that implements the start of a note
- Parameters:
note_id – unique identifier for the note we are starting
pitch – floating-point MIDI pitch value
volume – floating-point volume value (from 0 to 1)
properties – a NotePropertiesDictionary
other_parameter_values – dictionary mapping parameter name to parameter value for parameters other than pitch and volume. (This information was extracted from the properties dictionary.)
note_info_dict – dictionary with auxiliary info about this note (e.g. the clock it’s running on, time stamp, various flags)