Skip to content
Igor Zinken edited this page Dec 27, 2018 · 1 revision

See <modules/arpeggiator.h>

The Arpeggiator module can be used to sequence the shifting of the base frequency of any given note (as represented by an instance of BaseSynthEvent) during its lifetime. Arpeggiator is a submodule of the Synthesizer generator.

The Arpeggiator maintains a list of semitone pitch shifts, which it will cycle through at a fixed step interval. Whenever the end of the list is reached, the Arpeggiator will read again from the beginning of the list.

Public methods

int getStepSize()
void setStepSize( int value )

The step size determines at what frequency the arpeggiator should proceed to the next note. This is defined in samples. To shift the step on every quarter note, you can calculate the sample amount as such:

( sample Rate in Hz * 60 seconds ) / tempo

Which for a sequence running at 120 BPM at a 44.1 kHz sample rate is: (( 44100 * 60 ) / 120 ) == 22050 samples.

int getAmountOfSteps()
void setAmountOfSteps( int value )

The amount of steps in the Arpeggiator sequence. Each step represents a shift. The maximum amount is 16 steps.

int getShiftForStep( int step )
void setShiftForStep( int step, int shift )

Gets/sets the pitch shift for a step in semitones. For instance: to shift the pitch up by a full octave on the 2nd step: setShiftForStep( 2, 12 ). Negative shifts are also supported.

int getStep()
void setStep( int step )

Gets/sets the current step in the Arpeggiator sequence.

bool peek()

Increments the Arpeggiators internal sequence position and will move to the next sequenced step when applicable. Will return true when the sequence will step to a new pitch shift. This method should be called for each iteration of the source signals render (for instance: in the Synthesizers waveform render method).

float getPitchForStep( int step, float basePitch )

Returns the resulting frequency given basePitch is translated to when applying to shift associated with given step. This method should be called for each iteration of the source signals render (after invocation of peek()).

int getBufferPosition()
void setBufferPosition( int value )

Sets the internal sequence position for the Arpeggiator.

Clone this wiki locally