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