Class: FMOD::Effects::PitchShift

Inherits:
Dsp
  • Object
show all
Defined in:
lib/fmod/effects/pitch_shift.rb

Overview

Note:

This filter is very computationally expensive! Similar to a vocoder, it requires several overlapping FFT and IFFT’s to produce smooth output, and can require around 440mhz for 1 stereo 48khz signal using the default settings.

Reducing the signal to mono will half the CPU usage.

Reducing this will lower audio quality, but what settings to use are largely dependant on the sound being played. A noisy polyphonic signal will need higher FFT size compared to a speaking voice for example.

This unit bends the pitch of a sound without changing the speed of playback.

This pitch shifting unit can be used to change the pitch of a sound without speeding it up or slowing it down.

It can also be used for time stretching or scaling, for example if the pitch was doubled, and the frequency of the sound was halved, the pitch of the sound would sound correct but it would be twice as slow.

Instance Attribute Summary collapse

Attributes inherited from Dsp

#active, #bypass, #channel_format, #input_count, #output_count, #parameter_count, #parent, #type, #wet_dry_mix

Attributes inherited from Handle

#user_data

Method Summary

Methods inherited from Dsp

#[], #[]=, #add_input, bool_param, data_param, #disconnect, #disconnect_from, #enable_metering, float_param, from_handle, #get_bool, #get_data, #get_float, #get_integer, #idle?, #info, #input, #input_connection, #input_metering?, integer_param, #name, #output, #output_connection, #output_format, #output_metering?, #param_info, #play, #reset, #set_bool, #set_data, #set_float, #set_integer, #set_wet_dry_mix, #show_dialog, #to_s, type_map, #version

Methods inherited from Handle

#initialize, #int_ptr, #release, #to_s

Constructor Details

This class inherits a constructor from FMOD::Handle

Instance Attribute Details

#max_channelsFloat

Maximum channels supported. 0 = same as FMOD’s default output polyphony, 1 = mono, 2 = stereo etc.

  • Minimum: 0

  • Maximum: 16

  • Default: 0 (strongly recommended to leave at 0!)

Returns:

  • (Float)

    the current value of max_channels



41
42
43
# File 'lib/fmod/effects/pitch_shift.rb', line 41

def max_channels
  @max_channels
end

#pitchFloat

Pitch value.

  • Minimum: 0.5 (one octave lower)

  • Maximum: 2.0 (one octave higher)

  • Default: 1.0 (normal)

Returns:

  • (Float)

    the current value of pitch



41
42
43
# File 'lib/fmod/effects/pitch_shift.rb', line 41

def pitch
  @pitch
end

#window_sizeFloat

FFT window size. Increase this to reduce “smearing”. This effect is a warbling sound similar to when an MP3 is encoded at very low bit-rates.

  • Minimum: 256

  • Maximum: 4096

  • Default: 1024

  • Valid: 256, 512, 1024, 2048, 4096

Returns:

  • (Float)

    the current value of window_size



41
42
43
# File 'lib/fmod/effects/pitch_shift.rb', line 41

def window_size
  @window_size
end