Class fx_arpeggiator

Inheritance Relationships

Base Type

Class Documentation

class fx_arpeggiator : public fx_effect

Effect: Arpeggiator which can sequence rhythmic patterns of pitch, gain and parameters.

An arpeggiator is a control source that can play sequences of notes and other control signals.

The arpeggiator relies on a structure that you define at the top of your Arduino sketch that contains the sequence that the arpeggiator will run through. This sequence can have up to 16 steps. In this example, our sequence is called steps2 but you can name it whatever you’d like.

You can also add .param_1 and .param_2 to this struct for any additional control values. These control values can be wired into any type of control note (filters, distortions, etc.)

ARP_STEP steps2[] = {
{ .freq = SEMI_TONE_2, .vol = 0.3, .dur = 125.0 },
{ .freq = SEMI_TONE_0, .vol = 0.0, .dur = 375.0 },
{ .freq = SEMI_TONE_5, .vol = 0.3, .dur = 375.0 },
{ .freq = SEMI_TONE_7, .vol = 0.9, .dur = 125.0 }, 
};

Public Functions

fx_arpeggiator(int total_steps, ARP_STEP *steps)

Simple constructor for arpeggiator.

See above for a description of how to define an arpeggiator sequence.

// Define arp sequence with 4 steps with a total duration of 1 second
ARP_STEP steps2[] = {
  { .freq = SEMI_TONE_2, .vol = 0.3, .dur = 125.0 },
  { .freq = SEMI_TONE_0, .vol = 0.0, .dur = 375.0 },
  { .freq = SEMI_TONE_5, .vol = 0.3, .dur = 375.0 },
  { .freq = SEMI_TONE_7, .vol = 0.9, .dur = 125.0 }, 
};

// Define our arpeggiator
fx_arpeggiator  arp2(4,            // Total number of steps
                     &steps2[0]);  // Reference to our sequence

Parameters
  • [in] total_steps: The total arpeggiator steps

  • steps: A pointer to an array of ARP_STEP containing the steps

void set_time_scale(float new_time_scale)

Sets the time scale ratio of the arpeggiator.

Parameters
  • [in] new_time_scale: The new time scale ratio (1.0 is current time scale, > 1.0 is faster, < 1.0 is slower)

void set_duration_ms(float new_duration)

Sets the duration of the arpeggiator in milliseconds.

Parameters
  • [in] new_duration: The new duration in milliseconds

void print_params(void)

Public Members

fx_control_node *time_scale

Control routing node: Time scale of arpeggiator (aka playback rate). A value of 1.0 runs arpeggiator at default speed. Lower is slower, higher is faster.

fx_control_node *period_ms

Control routing node: Target duration of the arpeggiator. Arpeggiator will be scaled so the whole sequence fits within this time.

fx_control_node *freq

Control routing node: Frequency value for each stage of the arpeggiator

fx_control_node *vol

Control routing node: Volume value for each stage of the arpeggiator

fx_control_node *param_1

Control routing node: Auxiliary parameter #1 for each stage of the arpeggiator

fx_control_node *param_2

Control routing node: Auxiliary parameter #2 for each stage of the arpeggiator

fx_control_node *start

Control routing node: Restarts the arpeggiator - wire to new note event to start arp sequence with each note