Class: Deftones::Core::Normalize
- Inherits:
-
ComputedSignal
- Object
- Signal
- ComputedSignal
- Deftones::Core::Normalize
- Defined in:
- lib/deftones/core/signal_shapers.rb
Constant Summary
Constants inherited from Signal
Instance Attribute Summary collapse
-
#max ⇒ Object
readonly
Returns the value of attribute max.
-
#min ⇒ Object
readonly
Returns the value of attribute min.
Attributes inherited from ComputedSignal
Attributes inherited from Signal
#clamp_values, #context, #convert_values, #default_value, #input, #max_value, #min_value, #output, #units
Instance Method Summary collapse
-
#initialize(input:, min:, max:, context: nil) ⇒ Normalize
constructor
A new instance of Normalize.
- #value_at(time) ⇒ Object
Methods inherited from ComputedSignal
#coerce_signal, #default_units, #exponentiate, #integer_like?, #process, #ramp_to, #resolve_context, #value, #value=
Methods inherited from Signal
#add_event, #apply, #automation_anchor_time, #automation_event_count, #automation_events?, #bounded_value, #cancel_and_hold_at_time, #cancel_scheduled_values, #coerce_value, #connect, #convert, #convert=, #convert_frequency, #convert_generic, #convert_without_units, #curve_value, #db_to_gain, #disconnect, #dispose, #disposed?, #event_sort_key, #exponential_approach_value_at_time, #exponential_ramp_to, #exponential_ramp_to_value_at_time, #get, #get_defaults, #get_value_at_time, #immediate, #insert_event, #interpolate, #linear_ramp_to, #linear_ramp_to_value_at_time, #name, #now, #overridden?, #process, #ramp_to, #resolve_automation_start_time, #resolve_time, #safe_exponential_value, #sample_time, #schedule_automation, #set, #set_ramp_point, #set_target_at_time, #set_value_at_time, #set_value_curve_at_time, #target_ramp_to, #target_value, #to_frequency, #to_s, #to_seconds, #to_ticks, #value, #value=
Methods included from SignalOperatorMethods
#abs, #add, #equal_power_gain, #greater_than, #greater_than_zero, #modulo, #multiply, #negate, #normalize, #pow, #scale, #scale_exp, #subtract, #to_audio, #to_gain, #wave_shaper
Constructor Details
#initialize(input:, min:, max:, context: nil) ⇒ Normalize
Returns a new instance of Normalize.
30 31 32 33 34 |
# File 'lib/deftones/core/signal_shapers.rb', line 30 def initialize(input:, min:, max:, context: nil) super(input: input, units: :number, context: context) @min = coerce_signal(min, units: :number) @max = coerce_signal(max, units: :number) end |
Instance Attribute Details
#max ⇒ Object (readonly)
Returns the value of attribute max.
28 29 30 |
# File 'lib/deftones/core/signal_shapers.rb', line 28 def max @max end |
#min ⇒ Object (readonly)
Returns the value of attribute min.
28 29 30 |
# File 'lib/deftones/core/signal_shapers.rb', line 28 def min @min end |
Instance Method Details
#value_at(time) ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/deftones/core/signal_shapers.rb', line 36 def value_at(time) min_value = @min.value_at(time) max_value = @max.value_at(time) span = max_value - min_value return 0.0 if span.zero? (@input.value_at(time) - min_value) / span end |