User Guide |
|
User Guide | Transform Guide | OSW on the Web |
Many real-time computer-music systems employ two different notions of time: “physical time” that is associated with hardware clocks and low-level scheduling, and “virtual time” which can be scaled or otherwise controlled by the user. OSW provides a unified user-configurable view of physical and virtual time that encompasses both system functions (such as scheduling and sample clocks) and user control.
All transforms that depend on time, such as the Sinewave transform, a sample playback transform or a MIDI sequencer are automatically synchronized to a single clock (by default, the clock of an audio device being used). Users can gain more explicit control over time by optionally connecting such time-dependent components to time machines, special transforms that map physical time from clocks to virtual time, or scale virtual time output from other time machines. Time machines include parameters for scaling virtual time or resetting to a specified value (i.e., "go to this time"), thus allowing users to control the flow of time in the connected signal-processing components. The control functions can be arbitrarily complex, and include user input from MIDI or high-resolution gestural input devices. Consider the following example that uses two time machines:
Both Sinewave transforms are explicitly synchronized to the same time source via time machine tm0. However, while slow is directly connected to tm0, fast is connected to tm0 through a second time machine, tm1, which scales time by a factor of 1.5 (i.e., time at tm1 “runs 1.5 times faster”). Even though both fast and slow are set to the same frequency (261Hz or Middle C), the explicit speedup of time into fast will cause it to sound 1.5 times (or a perfect fifth) higher. A similar example is used in the “rate controls pitch” tutorial.
Time machines can be used to mimic the speed control on profession record players or tape decks (see the sample loop tutorial example), or as an expressive tempo controller when playing scores.
When you connect a signal generator, such as a Sinewave or a noise generator, to an audio output, it will continuously generate samples as long as the audio output is turned on. However, if a Sinewave transform is connected to a time machine, it will only generate output when it receives time input. Thus, time machines can be used to switch signals on and off even while the audio output is on:
Turning the Toggle on sets the Switch to 1, routing time output from the time machine tm1 to the BrownNoise transform, which then outputs samples. If the Switch is set to 0 (by turning the toggle off), then output from the time machine will no longer be routed to the noise generator, which is effectively shut off.
You can also use time machines to switch among several potential signals in a patch:
Setting the Switch from 0, 1 or 2 switches on the sinewave, phasor or noise generator.
Open the switcheroo tutorial to try out the examples in this section.
Implicit and explicit time machines can be used to control not only signals, but events as well. The most general method for synchronizing events to the OSW time system is through the Ticker transform. The Ticker transform can be used to emit Units at regular time intervals that can be controlled by the user. Tickers can be used to design systems based on regular events, such as complex music sequencers. It is also used by transforms such as Wacom (the graphics-tablet interface) that poll input devices at regular intervals.
Music-playing transforms, such as the MidiSequencer for standard sequencing of MIDI files and the PlayScore for the more general OSW score format, can be controled via time machines (see chapter 4 for more details on the OSW score system). Time machines allow expressive control of both the tempo and control of such musical sequencers. Patches can also sequence events stored in OSW lists by attaching a Ticker to a list::Sequence transform.
Ticker allows users to synchronize events to regular time intervals. Events that happen at specific times rather than regular intervals can be triggered using the OneShot transform. OneShot emits a Unit value when its time input (either an implicit connection to the main clock or an explicit connection to a time machine) reaches a specified time. OneShot is useful for events that happen only once at a specific time during a program's execution, or at irregular intervals by explicit control via a time machine.