Class: Vapi::FourierDenoisingPlan
- Inherits:
-
Object
- Object
- Vapi::FourierDenoisingPlan
- Defined in:
- lib/vapi_server_sdk/types/fourier_denoising_plan.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#baseline_offset_db ⇒ Float
readonly
How far below the rolling baseline to filter audio, in dB.
-
#baseline_percentile ⇒ Float
readonly
Percentile to use for baseline calculation (1-99).
-
#enabled ⇒ Boolean
readonly
Whether Fourier denoising is enabled.
-
#media_detection_enabled ⇒ Boolean
readonly
Whether automatic media detection is enabled.
-
#static_threshold ⇒ Float
readonly
Static threshold in dB used as fallback when no baseline is established.
-
#window_size_ms ⇒ Float
readonly
Rolling window size in milliseconds for calculating the audio baseline.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::FourierDenoisingPlan
Deserialize a JSON object to an instance of FourierDenoisingPlan.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(enabled: OMIT, media_detection_enabled: OMIT, static_threshold: OMIT, baseline_offset_db: OMIT, window_size_ms: OMIT, baseline_percentile: OMIT, additional_properties: nil) ⇒ Vapi::FourierDenoisingPlan constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of FourierDenoisingPlan to a JSON object.
Constructor Details
#initialize(enabled: OMIT, media_detection_enabled: OMIT, static_threshold: OMIT, baseline_offset_db: OMIT, window_size_ms: OMIT, baseline_percentile: OMIT, additional_properties: nil) ⇒ Vapi::FourierDenoisingPlan
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/vapi_server_sdk/types/fourier_denoising_plan.rb', line 56 def initialize(enabled: OMIT, media_detection_enabled: OMIT, static_threshold: OMIT, baseline_offset_db: OMIT, window_size_ms: OMIT, baseline_percentile: OMIT, additional_properties: nil) @enabled = enabled if enabled != OMIT @media_detection_enabled = media_detection_enabled if media_detection_enabled != OMIT @static_threshold = static_threshold if static_threshold != OMIT @baseline_offset_db = baseline_offset_db if baseline_offset_db != OMIT @window_size_ms = window_size_ms if window_size_ms != OMIT @baseline_percentile = baseline_percentile if baseline_percentile != OMIT @additional_properties = additional_properties @_field_set = { "enabled": enabled, "mediaDetectionEnabled": media_detection_enabled, "staticThreshold": static_threshold, "baselineOffsetDb": baseline_offset_db, "windowSizeMs": window_size_ms, "baselinePercentile": baseline_percentile }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
31 32 33 |
# File 'lib/vapi_server_sdk/types/fourier_denoising_plan.rb', line 31 def additional_properties @additional_properties end |
#baseline_offset_db ⇒ Float (readonly)
Returns How far below the rolling baseline to filter audio, in dB. Lower values (e.g., -10) are more aggressive, higher values (e.g., -20) are more conservative.
22 23 24 |
# File 'lib/vapi_server_sdk/types/fourier_denoising_plan.rb', line 22 def baseline_offset_db @baseline_offset_db end |
#baseline_percentile ⇒ Float (readonly)
Returns Percentile to use for baseline calculation (1-99). Higher percentiles (e.g., 85) focus on louder speech, lower percentiles (e.g., 50) include quieter speech.
29 30 31 |
# File 'lib/vapi_server_sdk/types/fourier_denoising_plan.rb', line 29 def baseline_percentile @baseline_percentile end |
#enabled ⇒ Boolean (readonly)
Returns Whether Fourier denoising is enabled. Note that this is experimental and may not work as expected.
10 11 12 |
# File 'lib/vapi_server_sdk/types/fourier_denoising_plan.rb', line 10 def enabled @enabled end |
#media_detection_enabled ⇒ Boolean (readonly)
Returns Whether automatic media detection is enabled. When enabled, the filter will automatically detect consistent background TV/music/radio and switch to more aggressive filtering settings. Only applies when enabled is true.
16 17 18 |
# File 'lib/vapi_server_sdk/types/fourier_denoising_plan.rb', line 16 def media_detection_enabled @media_detection_enabled end |
#static_threshold ⇒ Float (readonly)
Returns Static threshold in dB used as fallback when no baseline is established.
18 19 20 |
# File 'lib/vapi_server_sdk/types/fourier_denoising_plan.rb', line 18 def static_threshold @static_threshold end |
#window_size_ms ⇒ Float (readonly)
Returns Rolling window size in milliseconds for calculating the audio baseline. Larger windows adapt more slowly but are more stable.
25 26 27 |
# File 'lib/vapi_server_sdk/types/fourier_denoising_plan.rb', line 25 def window_size_ms @window_size_ms end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::FourierDenoisingPlan
Deserialize a JSON object to an instance of FourierDenoisingPlan
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/vapi_server_sdk/types/fourier_denoising_plan.rb', line 81 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) enabled = parsed_json["enabled"] media_detection_enabled = parsed_json["mediaDetectionEnabled"] static_threshold = parsed_json["staticThreshold"] baseline_offset_db = parsed_json["baselineOffsetDb"] window_size_ms = parsed_json["windowSizeMs"] baseline_percentile = parsed_json["baselinePercentile"] new( enabled: enabled, media_detection_enabled: media_detection_enabled, static_threshold: static_threshold, baseline_offset_db: baseline_offset_db, window_size_ms: window_size_ms, baseline_percentile: baseline_percentile, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given
hash and check each fields type against the current object's property
definitions.
114 115 116 117 118 119 120 121 |
# File 'lib/vapi_server_sdk/types/fourier_denoising_plan.rb', line 114 def self.validate_raw(obj:) obj.enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.enabled is not the expected type, validation failed.") obj.media_detection_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.media_detection_enabled is not the expected type, validation failed.") obj.static_threshold&.is_a?(Float) != false || raise("Passed value for field obj.static_threshold is not the expected type, validation failed.") obj.baseline_offset_db&.is_a?(Float) != false || raise("Passed value for field obj.baseline_offset_db is not the expected type, validation failed.") obj.window_size_ms&.is_a?(Float) != false || raise("Passed value for field obj.window_size_ms is not the expected type, validation failed.") obj.baseline_percentile&.is_a?(Float) != false || raise("Passed value for field obj.baseline_percentile is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of FourierDenoisingPlan to a JSON object
104 105 106 |
# File 'lib/vapi_server_sdk/types/fourier_denoising_plan.rb', line 104 def to_json(*_args) @_field_set&.to_json end |