Dwalk:
Filter:
miSCellaneous_lib/Classes (extension) | Libraries > miSCellaneous

Dwalk
ExtensionExtension

demand rate ugen for (random) walks

Description

Dwalk can be used for general purposes in a way similar to Pwalk, but can also return data in a form, which is especially suited for usage with ZeroXBufRd. A sequence of Integers (stepsPerDir) determines the number of consequential additions of numbers (stepWidth) before directional changes. Dwalk returns the current sum and, optionally, the current direction (plus or minus 1).

For buffer modulation with ZeroXBufRd a stepWidth of 1 allows stepping through adjacent segments. There are two ways to achieve smooth directional changes of the read pointer: (1) at zero crossings of the original waveform together with inverting it or (2) at the positions where the waveform changes direction (up/down) or in other words: its slope crosses zero.

NOTE: For implementational reasons Dwalk doesn't multichannel expand, use duplication of Functions instead.
NOTE: If withDirs is set to 1 and many values are polled, extended memory size is recommended: a high bufSize is needed for Dunique (as – and especially – with ZeroXBufRd).
NOTE: Ordinary ugens for stepWidth and steps per direction (via stepsPerDirMulUGen and stepsPerDirAddUGen) should be avoided in combination with ZeroXBufRd.

Class Methods

.new

Arguments:

stepsPerDir

Integer or demand rate ugen determining the integer number of steps into one direction. If withDirs equals 0 also an ordinary ugens might be passed. If withDirs equals 1 a Dunique is used internally, in this case for passing an ordinary ugen alone or in combination with a demand rate ugen use stepsPerDirMulUGen or stepsPerDirAddUGen. Defaults to 1.

stepWidth

Number, demand rate or other ugen determining the step width. Defaults to 1. How stepWidth is interpreted in case of a demand rate or other ugen depends on the value of stepMode. An ordinary ugens should not be chosen when using Dwalk for ZeroXBufRd.

stepMode

Determines how stepWidth is interpreted in case of a demand rate or other ugen:

  • 0 – one step width is taken for all steps into one direction
  • 1 – step width changes per step.

Defaults to 0.

start

The start value, which is returned anyway. Defaults to 0.

lo

Low boundary value, causes clipping. Directional changes apply after clipping. Might also be demand rate or other ugen, defaults to -inf.

hi

High boundary value, causes clipping. Directional changes apply after clipping. Might also be demand rate or other ugen, defaults to inf.

startDir

The start direction, which is returned anyway. Defaults to 1.

dirChangeMode

Determines if directional changes should apply immediately (1) or after a repetition of the current value (0, default). The latter corresponds to the convention of ZeroXBufRd: if a segment should be played in reverse direction, the index (the zeroX arg) would stay the same whereas the direction (the dir arg) is multiplied with -1.

withDirs

0, 1, false or true. Defaults to 0. Determines if direction values (plus or minus 1) should be returned. In this case the result is an array of two demand rate ugens returning the summed numbers and the direction values. If set to 1 a Dunique is used internally and stepsPerDir must not get an ordinary ugen.

stepsPerDirMulUGen

Ordinary ugen to be multiplied with stepsPerDir. This option is only necessary in the case that withDirs equals 1 and should not be used in combination with ZeroXBufRd. The number of steps per direction is calculated by stepsPerDir * stepsPerDirMulUGen + stepsPerDirAddUGen. Defaults to 1.

stepsPerDirAddUGen

Ordinary ugen to be multiplied with stepsPerDir. This option is only necessary in the case that withDirs equals 1 and should not be used in combination with ZeroXBufRd. The number of steps per direction is calculated by stepsPerDir * stepsPerDirMulUGen + stepsPerDirAddUGen. Defaults to 0.

dUniqueBufSize

Determines the buffer size for a Dunique object which has to be used in case that withDirs is set to 1. Defaults to 1048576.

Examples

 

Ex.1: Basic usage

 

Ex.2: Stochastic synthesis

 

Ex.3: Smooth concatenation of adjacent wavesets

See ZeroXBufRd: Ex. 9

 

Ex.4: Smooth concatenation of adjacent segments restricted by turning points resp. local minima or maxima

See ZeroXBufRd: Ex. 10