Module Duplex.Automation
Provide generic automation features for Duplex applications
In the Renoise API, each pattern-track can contain a list of automation envelopes which are listed in order-of-arrival.
This means that it's quite complicated to do something as simple as saying "write a point here for this parameter", because first you have to find the right envelope, or create it.
This class provides a much simpler way of writing automation, exposing just a single method, add_automation(). Provided with a track number, a parameter and a value, the rest happens automatically. If the continuous/latch recording mode is enabled, one also need to call the update() method with regular intervals to ensure that the envelope is being written ahead of the actual playback position.
To set up the Automation class, you need to instantiate it in your application (the __init()
method), and make sure that attachtosong()
is called when the application is initialized, and new songs are created.
Functions
__init () | Initialize the Automation class |
_get_extrapolation_strength () | Retrieve the extrapolation strength from Duplex setting |
update () | Update currently recording automation lanes (this method is designed to be called from within an idle loop) |
add_automation (track_idx, parameter, value, playmode) | Add a point at current time (will add new automations on the fly) |
get_current_line () | Retrieve the current line |
get_current_seq_index () | Retrieve the current sequence index |
add_point (ptrack_auto, line, value, automation_lane, playmode) | This method is an enhanced version of addpointat(), as it will wrap at pattern boundaries and create automation on the fly |
writeahead (amount, ptrack_auto, lane) | "Write-ahead" using extrapolated values (enabled when dealing with cubic/linear envelopes) |
find_or_create (ptrack, autolane, seq_idx, register) | Findorcreate will always return a PatternTrackAutomation index when provided with a valid PatternTrack. |
get_automation_index (ptrack, ptrack_auto) | Figure out the track automation's index |
get_device_by_param (track_idx, parameter) | Figure out the device by supplying a parameter |
stop_automation () | Stop all currently recording automation |
attach_to_song (new_song) | Attach to song (call this from the host application) |
_remove_notifiers (new_song) | Remove all notifiers associated with this class instance |
Fields
self.latch_record | (bool) set this to true when data is continuously output |
self.stop_at_loop | (bool) if true, recording will not cross pattern boundaries |
self.preferred_playmode | (enum) leave undefined, or set to renoise.PatternTrackAutomation.PLAYMODEPOINTS renoise.PatternTrackAutomation.PLAYMODELINEAR renoise.PatternTrackAutomation.PLAYMODE_CUBIC |
self.follow_pos | (enum) how position is determined |
self.extrapolate_strength | extrapolation strength, 3 is the default value range is from 1 and up, with higher values causing more overshooting (when recording, choose point envelopes to avoid extrapolation at all) |
self._automations | AutomationLane instances |
self._skip_updates | temporarily skip output while recording slider movements |
self.map | list of active observables |
self.parameter | automation indices are kept here |
Functions
- __init ()
- Initialize the Automation class
- _get_extrapolation_strength ()
- Retrieve the extrapolation strength from Duplex setting
- update ()
- Update currently recording automation lanes (this method is designed to be called from within an idle loop)
- add_automation (track_idx, parameter, value, playmode)
-
Add a point at current time (will add new automations on the fly)
Parameters:
- track_idx (int) the track index
- parameter (DeviceParameter object)
- value (number between 0-1)
- playmode (enum), renoise.PatternTrackAutomation.PLAYMODE_xxx
- get_current_line ()
-
Retrieve the current line
Returns:
-
int
- get_current_seq_index ()
-
Retrieve the current sequence index
Returns:
-
int
- add_point (ptrack_auto, line, value, automation_lane, playmode)
-
This method is an enhanced version of addpointat(), as it will wrap at
pattern boundaries and create automation on the fly
Parameters:
- ptrack_auto (PatternTrackAutomation)
- line (int), line in pattern
- value (number), between 0 and 1
- automation_lane (AutomationLane), when called from update()
- playmode (enum), [optional] renoise.PatternTrackAutomation.PLAYMODE_xxx
- writeahead (amount, ptrack_auto, lane)
-
"Write-ahead" using extrapolated values
(enabled when dealing with cubic/linear envelopes)
Parameters:
- amount (int), number of extrapolated points, 0 and up
- ptrack_auto (renoise.PatternTrackAutomation)
- lane (AutomationLane)
- find_or_create (ptrack, autolane, seq_idx, register)
-
Findorcreate will always return a PatternTrackAutomation index when
provided with a valid PatternTrack. The PatternTrackAutomation object is
created on-the-fly if not already present
note: when playback progress into pattern that does not (yet) contain
any automation, supply a negative value ("waiting for observable")
Parameters:
- ptrack (PatternTrack)
- autolane (AutomationLane)
- seq_idx (int) the sequence index
- register (bool) register as "waiting for observable"
Returns:
-
(int), the resulting index
- get_automation_index (ptrack, ptrack_auto)
-
Figure out the track automation's index
Parameters:
- ptrack (PatternTrack)
- ptrack_auto (PatternTrackAutomation)
Returns:
-
(int) the automation index
- get_device_by_param (track_idx, parameter)
-
Figure out the device by supplying a parameter
Parameters:
- track_idx (int)
- parameter (DeviceParameter)
Returns:
-
TrackDevice
- stop_automation ()
- Stop all currently recording automation
- attach_to_song (new_song)
-
Attach to song (call this from the host application)
Parameters:
- new_song
- _remove_notifiers (new_song)
-
Remove all notifiers associated with this class instance
Parameters:
- new_song (bool) if defined, do not attempt to remove notifiers
Fields
- self.latch_record
- (bool) set this to true when data is continuously output
- self.stop_at_loop
- (bool) if true, recording will not cross pattern boundaries
- self.preferred_playmode
- (enum) leave undefined, or set to renoise.PatternTrackAutomation.PLAYMODEPOINTS renoise.PatternTrackAutomation.PLAYMODELINEAR renoise.PatternTrackAutomation.PLAYMODE_CUBIC
- self.follow_pos
- (enum) how position is determined
- self.extrapolate_strength
- extrapolation strength, 3 is the default value range is from 1 and up, with higher values causing more overshooting (when recording, choose point envelopes to avoid extrapolation at all)
- self._automations
- AutomationLane instances
- self._skip_updates
- temporarily skip output while recording slider movements
- self.map
- list of active observables
- self.parameter
- automation indices are kept here