Class fx_pitch_shift_fd

Inheritance Relationships

Base Type

Class Documentation

class fx_pitch_shift_fd : public fx_effect

Effect: Pitch shifter - shifts audio up or down in pitch.

This effect uses a phase vocoder to perform the pitch shift so it can perform multiple pitch shifts at the same time.

Public Functions

fx_pitch_shift_fd(float freq, float volume, float volume_clean)

Basic constructor/initializer for the frequency-domain based pitch shifter.

When setting the frequency, you can utilize a set of constants that define various semitone relationships. The constant SEMI_TONE_10, for example, is 10 semitones above the current note. Adding an N for negative moves the tones below the note. For example, the constant SEMI_TONE_N17 is 17 semitones below the current note.

fx_pitch_shift_fd    pitch_shift(SEMI_TONE_7,  // Set pitch shift to fifth above (7 semitones) or approx 1.5
                                 0.7,  // Pitch shift mix
                                 1.0); // Clean mix

Parameters
  • [in] freq: The relative frequency shift (2.0 would be an octave up, 0.5 would be an octave down)

  • [in] vol: The volume/mix of frequency shifted audio

  • [in] vol_clean: The volume/mix of the clean audio

fx_pitch_shift_fd(float freq_1, float volume_1, float freq_2, float volume_2, float volume_clean)

Advanced constructor/initializer for the frequency-domain based pitch shifter.

When setting the frequency, you can utilize a set of constants that define various semitone relationships. The constant SEMI_TONE_10, for example, is 10 semitones above the current note. Adding an N for negative moves the tones below the note. For example, the constant SEMI_TONE_N17 is 17 semitones below the current note.

fx_pitch_shift_fd    pitch_shift(SEMI_TONE_7,  // First shift is a fifth above
                                 0.7,  // First tone volume is 0.7
                                 SEMI_TONE_12,  // Second shift is an octave above
                                 0.5,  // Second tone volume is 0.5
                                 1.0); // Clean mix set to 1.0

Parameters
  • [in] freq_1: The first relative frequency shift (2.0 would be an octave up, 0.5 would be an octave down)

  • [in] volume_1: The volume of the first frequency shifted tone

  • [in] freq_2: The second relative frequency shift (2.0 would be an octave up, 0.5 would be an octave down)

  • [in] volume_2: The volume of the second frequency shifted tone

  • [in] volume_clean: The clean volume

void enable()

Enable the pitch shifter (it is enabled by default)

void bypass()

Bypass the pitch shifter (will just pass clean audio through)

void set_freq_shift_1(float new_freq_shift)

Sets the pitch shifter value. A freq_shift of 0.5 will drop down one octave. A value of 2.0 will go up one octave. A value of 1.0 will play at current pitch (no shift).

When setting the frequency, you can also utilize a set of constants that define various semitone relationships. The constant SEMI_TONE_10, for example, is 10 semitones above the current note. Adding an N for negative moves the tones below the note. For example, the constant SEMI_TONE_N17 is 17 semitones below the current note.

Parameters
  • [in] new_freq_shift: The frequency shift

void set_freq_shift_2(float new_freq_shift)

Sets the second pitch shifter value. A freq_shift of 0.5 will drop down one octave. A value of 2.0 will go up one octave. A value of 1.0 will play at current pitch (no shift).

When setting the frequency, you can also utilize a set of constants that define various semitone relationships. The constant SEMI_TONE_10, for example, is 10 semitones above the current note. Adding an N for negative moves the tones below the note. For example, the constant SEMI_TONE_N17 is 17 semitones below the current note.

Parameters
  • [in] new_freq_shift: The frequency shift

void set_vol_1(float new_vol_1)

Sets the volume/gain of the first pitch shift channel.

Parameters
  • [in] vol_1: The volume level (0.0 to 1.0)

void set_vol_2(float new_vol_2)

Sets the volume/gain of the second pitch shift channel (if used)

Parameters
  • [in] vol_2: The volume level (0.0 to 1.0)

void set_vol_clean(float new_vol_clean)

Sets the clean mix.

Parameters
  • [in] vol_2: The volume level (0.0 to 1.0)

void print_params(void)

Print the parameters for this effect.

Public Members

fx_audio_node *input

Audio routing node: primary audio input

fx_audio_node *output

Audio routing node: primary audio output

fx_control_node *freq_shift_1

Control routing node: first pitch shift amount

fx_control_node *freq_shift_2

Control routing node: second pitch shift amount

fx_control_node *vol_1

Control routing node: volume of first pitch shift channel

fx_control_node *vol_2

Control routing node: volume of second pitch shift channel

fx_control_node *vol_clean

Control routing node: clean mix