OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 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 CHROME_BROWSER_SPEECH_ENDPOINTER_ENERGY_ENDPOINTER_PARAMS_H_ |
| 6 #define CHROME_BROWSER_SPEECH_ENDPOINTER_ENERGY_ENDPOINTER_PARAMS_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 |
| 10 namespace speech_input { |
| 11 |
| 12 // Input parameters for the EnergyEndpointer class. |
| 13 class EnergyEndpointerParams { |
| 14 public: |
| 15 EnergyEndpointerParams() { |
| 16 SetDefaults(); |
| 17 } |
| 18 |
| 19 void SetDefaults() { |
| 20 frame_period_ = 0.01f; |
| 21 frame_duration_ = 0.01f; |
| 22 endpoint_margin_ = 0.2f; |
| 23 onset_window_ = 0.15f; |
| 24 speech_on_window_ = 0.4f; |
| 25 offset_window_ = 0.15f; |
| 26 onset_detect_dur_ = 0.09f; |
| 27 onset_confirm_dur_ = 0.075f; |
| 28 on_maintain_dur_ = 0.10f; |
| 29 offset_confirm_dur_ = 0.12f; |
| 30 decision_threshold_ = 150.0f; |
| 31 min_decision_threshold_ = 50.0f; |
| 32 fast_update_dur_ = 0.2f; |
| 33 sample_rate_ = 8000.0f; |
| 34 min_fundamental_frequency_ = 57.143f; |
| 35 max_fundamental_frequency_ = 400.0f; |
| 36 contamination_rejection_period_ = 0.25f; |
| 37 } |
| 38 |
| 39 void operator=(const EnergyEndpointerParams& source) { |
| 40 frame_period_ = source.frame_period(); |
| 41 frame_duration_ = source.frame_duration(); |
| 42 endpoint_margin_ = source.endpoint_margin(); |
| 43 onset_window_ = source.onset_window(); |
| 44 speech_on_window_ = source.speech_on_window(); |
| 45 offset_window_ = source.offset_window(); |
| 46 onset_detect_dur_ = source.onset_detect_dur(); |
| 47 onset_confirm_dur_ = source.onset_confirm_dur(); |
| 48 on_maintain_dur_ = source.on_maintain_dur(); |
| 49 offset_confirm_dur_ = source.offset_confirm_dur(); |
| 50 decision_threshold_ = source.decision_threshold(); |
| 51 min_decision_threshold_ = source.min_decision_threshold(); |
| 52 fast_update_dur_ = source.fast_update_dur(); |
| 53 sample_rate_ = source.sample_rate(); |
| 54 min_fundamental_frequency_ = source.min_fundamental_frequency(); |
| 55 max_fundamental_frequency_ = source.max_fundamental_frequency(); |
| 56 contamination_rejection_period_ = source.contamination_rejection_period(); |
| 57 } |
| 58 |
| 59 // Accessors and mutators |
| 60 float frame_period() const { return frame_period_; } |
| 61 void set_frame_period(float frame_period) { |
| 62 frame_period_ = frame_period; |
| 63 } |
| 64 |
| 65 float frame_duration() const { return frame_duration_; } |
| 66 void set_frame_duration(float frame_duration) { |
| 67 frame_duration_ = frame_duration; |
| 68 } |
| 69 |
| 70 float endpoint_margin() const { return endpoint_margin_; } |
| 71 void set_endpoint_margin(float endpoint_margin) { |
| 72 endpoint_margin_ = endpoint_margin; |
| 73 } |
| 74 |
| 75 float onset_window() const { return onset_window_; } |
| 76 void set_onset_window(float onset_window) { onset_window_ = onset_window; } |
| 77 |
| 78 float speech_on_window() const { return speech_on_window_; } |
| 79 void set_speech_on_window(float speech_on_window) { |
| 80 speech_on_window_ = speech_on_window; |
| 81 } |
| 82 |
| 83 float offset_window() const { return offset_window_; } |
| 84 void set_offset_window(float offset_window) { |
| 85 offset_window_ = offset_window; |
| 86 } |
| 87 |
| 88 float onset_detect_dur() const { return onset_detect_dur_; } |
| 89 void set_onset_detect_dur(float onset_detect_dur) { |
| 90 onset_detect_dur_ = onset_detect_dur; |
| 91 } |
| 92 |
| 93 float onset_confirm_dur() const { return onset_confirm_dur_; } |
| 94 void set_onset_confirm_dur(float onset_confirm_dur) { |
| 95 onset_confirm_dur_ = onset_confirm_dur; |
| 96 } |
| 97 |
| 98 float on_maintain_dur() const { return on_maintain_dur_; } |
| 99 void set_on_maintain_dur(float on_maintain_dur) { |
| 100 on_maintain_dur_ = on_maintain_dur; |
| 101 } |
| 102 |
| 103 float offset_confirm_dur() const { return offset_confirm_dur_; } |
| 104 void set_offset_confirm_dur(float offset_confirm_dur) { |
| 105 offset_confirm_dur_ = offset_confirm_dur; |
| 106 } |
| 107 |
| 108 float decision_threshold() const { return decision_threshold_; } |
| 109 void set_decision_threshold(float decision_threshold) { |
| 110 decision_threshold_ = decision_threshold; |
| 111 } |
| 112 |
| 113 float min_decision_threshold() const { return min_decision_threshold_; } |
| 114 void set_min_decision_threshold(float min_decision_threshold) { |
| 115 min_decision_threshold_ = min_decision_threshold; |
| 116 } |
| 117 |
| 118 float fast_update_dur() const { return fast_update_dur_; } |
| 119 void set_fast_update_dur(float fast_update_dur) { |
| 120 fast_update_dur_ = fast_update_dur; |
| 121 } |
| 122 |
| 123 float sample_rate() const { return sample_rate_; } |
| 124 void set_sample_rate(float sample_rate) { sample_rate_ = sample_rate; } |
| 125 |
| 126 float min_fundamental_frequency() const { return min_fundamental_frequency_; } |
| 127 void set_min_fundamental_frequency(float min_fundamental_frequency) { |
| 128 min_fundamental_frequency_ = min_fundamental_frequency; |
| 129 } |
| 130 |
| 131 float max_fundamental_frequency() const { return max_fundamental_frequency_; } |
| 132 void set_max_fundamental_frequency(float max_fundamental_frequency) { |
| 133 max_fundamental_frequency_ = max_fundamental_frequency; |
| 134 } |
| 135 |
| 136 float contamination_rejection_period() const { |
| 137 return contamination_rejection_period_; |
| 138 } |
| 139 void set_contamination_rejection_period( |
| 140 float contamination_rejection_period) { |
| 141 contamination_rejection_period_ = contamination_rejection_period; |
| 142 } |
| 143 |
| 144 private: |
| 145 float frame_period_; // Frame period |
| 146 float frame_duration_; // Window size |
| 147 float onset_window_; // Interval scanned for onset activity |
| 148 float speech_on_window_; // Inverval scanned for ongoing speech |
| 149 float offset_window_; // Interval scanned for offset evidence |
| 150 float offset_confirm_dur_; // Silence duration required to confirm offset |
| 151 float decision_threshold_; // Initial rms detection threshold |
| 152 float min_decision_threshold_; // Minimum rms detection threshold |
| 153 float fast_update_dur_; // Period for initial estimation of levels. |
| 154 float sample_rate_; // Expected sample rate. |
| 155 |
| 156 // Time to add on either side of endpoint threshold crossings |
| 157 float endpoint_margin_; |
| 158 // Total dur within onset_window required to enter ONSET state |
| 159 float onset_detect_dur_; |
| 160 // Total on time within onset_window required to enter SPEECH_ON state |
| 161 float onset_confirm_dur_; |
| 162 // Minimum dur in SPEECH_ON state required to maintain ON state |
| 163 float on_maintain_dur_; |
| 164 // Minimum fundamental frequency for autocorrelation. |
| 165 float min_fundamental_frequency_; |
| 166 // Maximum fundamental frequency for autocorrelation. |
| 167 float max_fundamental_frequency_; |
| 168 // Period after start of user input that above threshold values are ignored. |
| 169 // This is to reject audio feedback contamination. |
| 170 float contamination_rejection_period_; |
| 171 }; |
| 172 |
| 173 } // namespace speech_input |
| 174 |
| 175 #endif // CHROME_BROWSER_SPEECH_ENDPOINTER_ENERGY_ENDPOINTER_PARAMS_H_ |
OLD | NEW |