sim3.py simulation testbed¶
The sim3.py
script is a testbed for building event-driven performance controllers with the kf Python library.
The script and libraries are packaged as sim3.zip. The individual files can be browsed
at sim3.py and kf.
Sim3 improves upon sim2 by incorporating MIDI sound output and several generator object demos: concentric loop, particle orbits, and waves.
A simulated winch system with GUI.
-
class
sim3.
ControlLogic
[source]¶ Core performance logic for processing MIDI input into winch commands.
-
connect_winches
(winches)[source]¶ Attach a winch output device to the performance logic, either physical or simulated.
-
metronome_tick
()[source]¶ Callback invoked at regular intervals governed by the metronome timer. In this particular example, the metronome can trigger a regular series of alternating forward and back movements to excite the path generator oscillators.
-
set_metronome_tempo
(tempo)[source]¶ Adjust the metronome timer rate. N.B. the underlying Qt QTimer accepts intervals in milliseconds, so this is fairly precise for beats but will be approximate for small subdivisions. E.g. a 120 BPM timer at 500 ms is precise, but the 32nd note subdivision at 62.5 ms would be rounded to 62 ms and run about 1% slow.
Parameters: tempo – tempo in BPM
-
-
class
sim3.
SimWindow
[source]¶ A custom main window which provides all GUI controls. This generally follows a model-view-controller convention in which this window provides the views, passing events to the application controller via callbacks.
-
connect_midi_listener
(listener)[source]¶ Connect a MIDI input listener to the port configuration control.
-
connect_midi_processor
(processor)[source]¶ Connect an object to receive synthetic MIDI events; the object is assumed to have MIDIProcessor methods.
-
connect_midi_sender
(sender)[source]¶ Connect a MIDI output sender to the port configuration control.
-