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:
objectA 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
Ends all notes currently 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
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:
pitch – see
play_note()volume – see
play_note()length – see
play_note()force_staff – force this note to play on the given staff index
properties – see
play_note()blocking – see
play_note()clock – see
play_note()
- 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:
pitches – see
play_chord()volume – see
play_chord()length – see
play_chord()properties – see
play_chord()force_staff – force this chord to play on the given staff index
blocking – see
play_chord()clock – see
play_chord()
- 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:
pitch – see
start_note()volume – see
start_note()properties – see
start_note()force_staff – force this note to play on the given staff index
clock – see
start_note()max_volume – see
start_note()
- Returns:
a
MultiNoteHandlewith 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:
pitches – see
start_chord()volume – see
start_chord()properties – see
start_chord()force_staff – force this chord to play on the given staff index
clock – see
start_chord()max_volume – see
start_chord()
- Returns:
a
MultiNoteHandlewith 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)
- 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