scamp.instruments.NoteHandle

class scamp.instruments.NoteHandle(note_id: int, instrument: scamp.instruments.ScampInstrument)[source]

Bases: object

This handle, which is returned by instrument.start_note, allows us to manipulate the note 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_id – the reference id of the note

  • instrument – the instrument playing the note

Variables
  • note_id – the reference id of the note

  • instrument – the instrument playing the note

Methods

change_parameter(param_name, …[, …])

Change a custom playback parameter for this note 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 pitch of this note to a given target value or values, over a given duration and with a given curve shape.

change_volume(target_value_or_values[, …])

Change the volume of this note to a given target value or values, over a given duration and with a given curve shape.

end()

Ends this note.

split()

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

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

Change a custom playback parameter for this note 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], transition_length_or_lengths: Union[float, Sequence] = 0, transition_curve_shape_or_shapes: Union[float, Sequence] = 0, clock: clockblocks.clock.Clock = None) → None[source]

Change the pitch of this note 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 pitch or a list of target pitches.

  • 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], transition_length_or_lengths: Union[float, Sequence] = 0, transition_curve_shape_or_shapes: Union[float, Sequence] = 0, clock: clockblocks.clock.Clock = None) → None[source]

Change the volume of this note 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 note, causing it later to be rendered as tied pieces.

end() → None[source]

Ends this note.