scamp.instruments.ChordHandle

class scamp.instruments.ChordHandle(note_handles: Sequence[NoteHandle], intervals: Sequence[float])[source]

Bases: object

This handle, returned by instrument.start_chord, allows us to manipulate a chord that we have started, (i.e. by changing pitch, volume, or another other parameter, or by ending the note). You would never create one of these directly.

Parameters:
  • note_handles – the handles of the notes that make up this chord

  • intervals – the original pitch intervals between the chord tones

Variables:

note_handles – the handles of the notes that make up this chord

Methods

change_parameter(param_name, ...[, ...])

Change a custom playback parameter for all notes in this chord to a given target value or values, over a given duration and with a given curve shape.

change_pitch(target_value_or_values[, ...])

Change the pitches of this chord such that the first note of the chord goes to the given target value or values, over a given duration and with a given curve shape.

change_volume(target_value_or_values[, ...])

Change the volume for all notes in this chord to a given target value or values, over a given duration and with a given curve shape.

end()

Ends all notes in this chord.

split()

Adds a split point to this chord, causing it later to be rendered as tied pieces.

change_parameter(param_name: str, target_value_or_values: Union[float, Sequence[float]], transition_length_or_lengths: Union[float, Sequence[float]] = 0, transition_curve_shape_or_shapes: Union[float, Sequence[float]] = 0, clock: Optional[Clock] = None) None[source]

Change a custom playback parameter for all notes in this chord to a given target value or values, over a given duration and with a given curve shape.

Parameters:
  • param_name – name of the parameter to change

  • target_value_or_values – either a single value or a list of values to which we want to change the parameter of interest.

  • transition_length_or_lengths – the duration (in beats) that we want it to take to reach the target value. The default value of 0 represents an instantaneous change. If multiple target values were given, a list of durations should be given for each segment.

  • transition_curve_shape_or_shapes – the curve shape used in transitioning to the new target value. The default value of 0 represents an linear change, a value greater than zero represents late change, and a value less than 0 represents early change. If multiple target values were given, a list of curve shapes should be given (unless it is left as the default 0, in which case all segments are linear).

  • clock – The clock with which to interpret the transition timings. The default value of “from_note”, which you likely don’t want to change, carries out the timings on the clock on which the note was started.

change_pitch(target_value_or_values: Union[float, Sequence[float]], transition_length_or_lengths: Union[float, Sequence[float]] = 0, transition_curve_shape_or_shapes: Union[float, Sequence[float]] = 0, clock: Optional[Clock] = None) None[source]

Change the pitches of this chord such that the first note of the chord goes to the given target value or values, over a given duration and with a given curve shape.

Parameters:
  • target_value_or_values – either a single target pitch or a list of target pitches. Note that this is the pitch that the first note of the chord gets changed to; all of the other notes in the chord follow suit, maintaining the same interval as before with the first note of the chord.

  • transition_length_or_lengths – the duration (in beats) that we want it to take to reach the target pitch. The default value of 0 represents an instantaneous change. If multiple target values were given, a list of durations should be given for each segment.

  • transition_curve_shape_or_shapes – the curve shape used in transitioning to the new target pitch. The default value of 0 represents an linear change, a value greater than zero represents late change, and a value less than 0 represents early change. If multiple target values were given, a list of curve shapes should be given (unless it is left as the default 0, in which case all segments are linear).

  • clock – The clock with which to interpret the transition timings. The default value of “from_note”, which you likely don’t want to change, carries out the timings on the clock on which the note was started.

change_volume(target_value_or_values: Union[float, Sequence[float]], transition_length_or_lengths: Union[float, Sequence[float]] = 0, transition_curve_shape_or_shapes: Union[float, Sequence[float]] = 0, clock: Optional[Clock] = None) None[source]

Change the volume for all notes in this chord to a given target value or values, over a given duration and with a given curve shape.

Parameters:
  • target_value_or_values – either a single target volume or a list of target volumes.

  • transition_length_or_lengths – the duration (in beats) that we want it to take to reach the target volume. The default value of 0 represents an instantaneous change. If multiple target values were given, a list of durations should be given for each segment.

  • transition_curve_shape_or_shapes – the curve shape used in transitioning to the new target volume. The default value of 0 represents an linear change, a value greater than zero represents late change, and a value less than 0 represents early change. If multiple target values were given, a list of curve shapes should be given (unless it is left as the default 0, in which case all segments are linear).

  • clock – The clock with which to interpret the transition timings. The default value of “from_note”, which you likely don’t want to change, carries out the timings on the clock on which the note was started.

split() None[source]

Adds a split point to this chord, causing it later to be rendered as tied pieces.

end() None[source]

Ends all notes in this chord.