scamp_extensions.playback.multi_staff_instrument.MultiStaffInstrument

class scamp_extensions.playback.multi_staff_instrument.MultiStaffInstrument(name: str, staff_parts: Sequence[ScampInstrument], decision_protocol: Callable[[float], int] | Sequence = (60,))[source]

Bases: object

A convenient wrapper for bundling multiple ScampInstrument objects into a single meta instrument that represents a grand staff of group of staves.

Parameters:
  • name – name of this instrument

  • staff_parts – list of ScampInstrument objects that represent the different staves

  • decision_protocol – either a tuple of pitch boundaries that decide which part plays or a function that maps pitch to part index.

Methods

end_all_notes()

Ends all notes currently playing

num_notes_playing()

Returns the number of notes currently playing.

play_chord(pitches, volume, length[, ...])

Play a chord using this MultiPresetInstrument.

play_note(pitch, volume, length[, ...])

Play a note using this MultiStaffInstrument

send_midi_cc(cc_number, value_from_0_to_1)

Send a midi cc message to every ScampInstrument: used by this MultiPresetInstrument.

set_max_pitch_bend(semitones)

Set the max pitch bend for all midi playback implementations on this instrument

start_chord(pitches, volume[, properties, ...])

Start a note using this MultiPresetInstrument.

start_note(pitch, volume[, properties, ...])

Start a note using this MultiPresetInstrument.

Attributes

default_spelling_policy

The default spelling policy for notes played back by this instrument.

play_note(pitch, volume, length, properties: str | dict | Sequence | NoteProperty = None, force_staff: int = None, blocking: bool = True, clock: Clock = None) None[source]

Play a note using this MultiStaffInstrument

Parameters:
play_chord(pitches: Sequence, volume, length, properties: str | dict | Sequence | NoteProperty = None, force_staff: int = None, blocking: bool = True, clock: Clock = None) None[source]

Play a chord using this MultiPresetInstrument.

Parameters:
start_note(pitch: float, volume: float, properties: str | dict | Sequence | NoteProperty = None, force_staff: int = None, clock: Clock = None, max_volume: float = 1) MultiNoteHandle[source]

Start a note using this MultiPresetInstrument.

Parameters:
Returns:

a MultiNoteHandle with which to later manipulate the note

start_chord(pitches: Sequence[float], volume: float, properties: str | dict | Sequence | NoteProperty = None, force_staff: int = None, clock: Clock = None, max_volume: float = 1) MultiNoteHandle[source]

Start a note using this MultiPresetInstrument.

Parameters:
Returns:

a MultiNoteHandle with which to later manipulate the chord

send_midi_cc(cc_number: int, value_from_0_to_1: float) None[source]

Send a midi cc message to every ScampInstrument: used by this MultiPresetInstrument.

Parameters:
  • cc_number – MIDI cc number

  • value_from_0_to_1 – value to send (scaled from 0 to 1)

end_all_notes() None[source]

Ends all notes currently playing

num_notes_playing() int[source]

Returns the number of notes currently playing.

set_max_pitch_bend(semitones: int) None[source]

Set the max pitch bend for all midi playback implementations on this instrument

property default_spelling_policy

The default spelling policy for notes played back by this instrument. See ScampInstrument