scamp.transcriber.Transcriber
- class scamp.transcriber.Transcriber[source]
Bases:
object
Class responsible for transcribing notes played by instruments into a
Performance
. It is possible to run multiple transcriptions simultaneously, for instance starting at different times, recording different instruments, or recording relative to different clocks.Methods
Checks if any transcriptions are in progress.
register_note
(instrument, note_info)Called when an instrument wants to register that it finished a note, records note in all transcriptions
start_transcribing
(...[, units])Starts transcribing new performance on the given clock, consisting of the given instrument
stop_transcribing
([which_performance, ...])Stops transcribing a Performance and returns it.
Attributes
Tuple of all current transcriptions.
- property transcriptions_in_progress: tuple[Performance]
Tuple of all current transcriptions.
- start_transcribing(instrument_or_instruments: Union[ScampInstrument, Sequence[ScampInstrument]], clock: Clock, units: str = 'beats') Performance [source]
Starts transcribing new performance on the given clock, consisting of the given instrument
- Parameters:
instrument_or_instruments – the instruments we notate in this Performance
clock – which clock all timings are relative to
units – one of [“beats”, “time”]. Do we use the beats of the clock or the time?
- Returns:
the Performance that this transcription writes to, which will be updated as notes are played and acts as a handle when calling stop_transcribing.
- register_note(instrument: ScampInstrument, note_info: dict) None [source]
Called when an instrument wants to register that it finished a note, records note in all transcriptions
- Parameters:
instrument – the ScampInstrument that played the note
note_info – the note info dictionary on that note, containing time stamps, parameter changes, etc.
- stop_transcribing(which_performance=None, tempo_envelope_tolerance=0.001) Performance [source]
Stops transcribing a Performance and returns it. Defaults to the oldest started performance, unless otherwise specified.
- Parameters:
which_performance – which performance to stop transcribing; defaults to oldest started
tempo_envelope_tolerance – error tolerance when extracting the absolute tempo envelope for the Performance
- Returns:
the created Performance