David Ghandehari | 878ef3e | 2016-11-13 21:06:36 -0800 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CONTENT_BROWSER_SPEECH_ENDPOINTER_ENERGY_ENDPOINTER_PARAMS_H_ |
| 6 | #define CONTENT_BROWSER_SPEECH_ENDPOINTER_ENERGY_ENDPOINTER_PARAMS_H_ |
| 7 | |
Andrew Top | 0d1858f | 2019-05-15 22:01:47 -0700 | [diff] [blame] | 8 | #include "content/common/content_export.h" |
| 9 | |
David Ghandehari | 878ef3e | 2016-11-13 21:06:36 -0800 | [diff] [blame] | 10 | namespace content { |
| 11 | |
| 12 | // Input parameters for the EnergyEndpointer class. |
Andrew Top | 0d1858f | 2019-05-15 22:01:47 -0700 | [diff] [blame] | 13 | class CONTENT_EXPORT EnergyEndpointerParams { |
David Ghandehari | 878ef3e | 2016-11-13 21:06:36 -0800 | [diff] [blame] | 14 | public: |
| 15 | EnergyEndpointerParams(); |
| 16 | |
| 17 | void SetDefaults(); |
| 18 | |
| 19 | void operator=(const EnergyEndpointerParams& source); |
| 20 | |
| 21 | // Accessors and mutators |
| 22 | float frame_period() const { return frame_period_; } |
Kaido Kert | e51ce0a | 2023-08-12 21:43:21 -0700 | [diff] [blame] | 23 | void set_frame_period(float frame_period) { frame_period_ = frame_period; } |
David Ghandehari | 878ef3e | 2016-11-13 21:06:36 -0800 | [diff] [blame] | 24 | |
| 25 | float frame_duration() const { return frame_duration_; } |
| 26 | void set_frame_duration(float frame_duration) { |
| 27 | frame_duration_ = frame_duration; |
| 28 | } |
| 29 | |
| 30 | float endpoint_margin() const { return endpoint_margin_; } |
| 31 | void set_endpoint_margin(float endpoint_margin) { |
| 32 | endpoint_margin_ = endpoint_margin; |
| 33 | } |
| 34 | |
| 35 | float onset_window() const { return onset_window_; } |
| 36 | void set_onset_window(float onset_window) { onset_window_ = onset_window; } |
| 37 | |
| 38 | float speech_on_window() const { return speech_on_window_; } |
| 39 | void set_speech_on_window(float speech_on_window) { |
| 40 | speech_on_window_ = speech_on_window; |
| 41 | } |
| 42 | |
| 43 | float offset_window() const { return offset_window_; } |
| 44 | void set_offset_window(float offset_window) { |
| 45 | offset_window_ = offset_window; |
| 46 | } |
| 47 | |
| 48 | float onset_detect_dur() const { return onset_detect_dur_; } |
| 49 | void set_onset_detect_dur(float onset_detect_dur) { |
| 50 | onset_detect_dur_ = onset_detect_dur; |
| 51 | } |
| 52 | |
| 53 | float onset_confirm_dur() const { return onset_confirm_dur_; } |
| 54 | void set_onset_confirm_dur(float onset_confirm_dur) { |
| 55 | onset_confirm_dur_ = onset_confirm_dur; |
| 56 | } |
| 57 | |
| 58 | float on_maintain_dur() const { return on_maintain_dur_; } |
| 59 | void set_on_maintain_dur(float on_maintain_dur) { |
| 60 | on_maintain_dur_ = on_maintain_dur; |
| 61 | } |
| 62 | |
| 63 | float offset_confirm_dur() const { return offset_confirm_dur_; } |
| 64 | void set_offset_confirm_dur(float offset_confirm_dur) { |
| 65 | offset_confirm_dur_ = offset_confirm_dur; |
| 66 | } |
| 67 | |
| 68 | float decision_threshold() const { return decision_threshold_; } |
| 69 | void set_decision_threshold(float decision_threshold) { |
| 70 | decision_threshold_ = decision_threshold; |
| 71 | } |
| 72 | |
| 73 | float min_decision_threshold() const { return min_decision_threshold_; } |
| 74 | void set_min_decision_threshold(float min_decision_threshold) { |
| 75 | min_decision_threshold_ = min_decision_threshold; |
| 76 | } |
| 77 | |
| 78 | float fast_update_dur() const { return fast_update_dur_; } |
| 79 | void set_fast_update_dur(float fast_update_dur) { |
| 80 | fast_update_dur_ = fast_update_dur; |
| 81 | } |
| 82 | |
| 83 | float sample_rate() const { return sample_rate_; } |
| 84 | void set_sample_rate(float sample_rate) { sample_rate_ = sample_rate; } |
| 85 | |
| 86 | float min_fundamental_frequency() const { return min_fundamental_frequency_; } |
| 87 | void set_min_fundamental_frequency(float min_fundamental_frequency) { |
| 88 | min_fundamental_frequency_ = min_fundamental_frequency; |
| 89 | } |
| 90 | |
| 91 | float max_fundamental_frequency() const { return max_fundamental_frequency_; } |
| 92 | void set_max_fundamental_frequency(float max_fundamental_frequency) { |
| 93 | max_fundamental_frequency_ = max_fundamental_frequency; |
| 94 | } |
| 95 | |
| 96 | float contamination_rejection_period() const { |
| 97 | return contamination_rejection_period_; |
| 98 | } |
| 99 | void set_contamination_rejection_period( |
| 100 | float contamination_rejection_period) { |
| 101 | contamination_rejection_period_ = contamination_rejection_period; |
| 102 | } |
| 103 | |
| 104 | private: |
Kaido Kert | e51ce0a | 2023-08-12 21:43:21 -0700 | [diff] [blame] | 105 | float frame_period_; // Frame period |
| 106 | float frame_duration_; // Window size |
| 107 | float onset_window_; // Interval scanned for onset activity |
| 108 | float speech_on_window_; // Interval scanned for ongoing speech |
| 109 | float offset_window_; // Interval scanned for offset evidence |
| 110 | float offset_confirm_dur_; // Silence duration required to confirm offset |
| 111 | float decision_threshold_; // Initial rms detection threshold |
David Ghandehari | 878ef3e | 2016-11-13 21:06:36 -0800 | [diff] [blame] | 112 | float min_decision_threshold_; // Minimum rms detection threshold |
Kaido Kert | e51ce0a | 2023-08-12 21:43:21 -0700 | [diff] [blame] | 113 | float fast_update_dur_; // Period for initial estimation of levels. |
| 114 | float sample_rate_; // Expected sample rate. |
David Ghandehari | 878ef3e | 2016-11-13 21:06:36 -0800 | [diff] [blame] | 115 | |
| 116 | // Time to add on either side of endpoint threshold crossings |
| 117 | float endpoint_margin_; |
| 118 | // Total dur within onset_window required to enter ONSET state |
| 119 | float onset_detect_dur_; |
| 120 | // Total on time within onset_window required to enter SPEECH_ON state |
| 121 | float onset_confirm_dur_; |
| 122 | // Minimum dur in SPEECH_ON state required to maintain ON state |
| 123 | float on_maintain_dur_; |
| 124 | // Minimum fundamental frequency for autocorrelation. |
| 125 | float min_fundamental_frequency_; |
| 126 | // Maximum fundamental frequency for autocorrelation. |
| 127 | float max_fundamental_frequency_; |
| 128 | // Period after start of user input that above threshold values are ignored. |
| 129 | // This is to reject audio feedback contamination. |
| 130 | float contamination_rejection_period_; |
| 131 | }; |
| 132 | |
| 133 | } // namespace content |
| 134 | |
| 135 | #endif // CONTENT_BROWSER_SPEECH_ENDPOINTER_ENERGY_ENDPOINTER_PARAMS_H_ |