Line data Source code
1 : // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 : //
3 : // Redistribution and use in source and binary forms, with or without
4 : // modification, are permitted provided that the following conditions are
5 : // met:
6 : //
7 : // * Redistributions of source code must retain the above copyright
8 : // notice, this list of conditions and the following disclaimer.
9 : // * Redistributions in binary form must reproduce the above
10 : // copyright notice, this list of conditions and the following disclaimer
11 : // in the documentation and/or other materials provided with the
12 : // distribution.
13 : // * Neither the name of Google Inc. nor the names of its
14 : // contributors may be used to endorse or promote products derived from
15 : // this software without specific prior written permission.
16 : //
17 : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 : // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 : // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 : // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 : // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 : // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 : // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 : // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 : // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 : // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 :
29 : #ifndef CONTENT_BROWSER_SPEECH_ENDPOINTER_ENERGY_ENDPOINTER_PARAMS_H_
30 : #define CONTENT_BROWSER_SPEECH_ENDPOINTER_ENERGY_ENDPOINTER_PARAMS_H_
31 :
32 : namespace mozilla {
33 :
34 : // Input parameters for the EnergyEndpointer class.
35 : class EnergyEndpointerParams {
36 : public:
37 : EnergyEndpointerParams();
38 :
39 : void SetDefaults();
40 :
41 : void operator=(const EnergyEndpointerParams& source);
42 :
43 : // Accessors and mutators
44 0 : float frame_period() const { return frame_period_; }
45 0 : void set_frame_period(float frame_period) {
46 0 : frame_period_ = frame_period;
47 0 : }
48 :
49 0 : float frame_duration() const { return frame_duration_; }
50 0 : void set_frame_duration(float frame_duration) {
51 0 : frame_duration_ = frame_duration;
52 0 : }
53 :
54 0 : float endpoint_margin() const { return endpoint_margin_; }
55 0 : void set_endpoint_margin(float endpoint_margin) {
56 0 : endpoint_margin_ = endpoint_margin;
57 0 : }
58 :
59 0 : float onset_window() const { return onset_window_; }
60 0 : void set_onset_window(float onset_window) { onset_window_ = onset_window; }
61 :
62 0 : float speech_on_window() const { return speech_on_window_; }
63 0 : void set_speech_on_window(float speech_on_window) {
64 0 : speech_on_window_ = speech_on_window;
65 0 : }
66 :
67 0 : float offset_window() const { return offset_window_; }
68 0 : void set_offset_window(float offset_window) {
69 0 : offset_window_ = offset_window;
70 0 : }
71 :
72 0 : float onset_detect_dur() const { return onset_detect_dur_; }
73 0 : void set_onset_detect_dur(float onset_detect_dur) {
74 0 : onset_detect_dur_ = onset_detect_dur;
75 0 : }
76 :
77 0 : float onset_confirm_dur() const { return onset_confirm_dur_; }
78 0 : void set_onset_confirm_dur(float onset_confirm_dur) {
79 0 : onset_confirm_dur_ = onset_confirm_dur;
80 0 : }
81 :
82 0 : float on_maintain_dur() const { return on_maintain_dur_; }
83 0 : void set_on_maintain_dur(float on_maintain_dur) {
84 0 : on_maintain_dur_ = on_maintain_dur;
85 0 : }
86 :
87 0 : float offset_confirm_dur() const { return offset_confirm_dur_; }
88 0 : void set_offset_confirm_dur(float offset_confirm_dur) {
89 0 : offset_confirm_dur_ = offset_confirm_dur;
90 0 : }
91 :
92 0 : float decision_threshold() const { return decision_threshold_; }
93 0 : void set_decision_threshold(float decision_threshold) {
94 0 : decision_threshold_ = decision_threshold;
95 0 : }
96 :
97 0 : float min_decision_threshold() const { return min_decision_threshold_; }
98 0 : void set_min_decision_threshold(float min_decision_threshold) {
99 0 : min_decision_threshold_ = min_decision_threshold;
100 0 : }
101 :
102 0 : float fast_update_dur() const { return fast_update_dur_; }
103 0 : void set_fast_update_dur(float fast_update_dur) {
104 0 : fast_update_dur_ = fast_update_dur;
105 0 : }
106 :
107 0 : float sample_rate() const { return sample_rate_; }
108 0 : void set_sample_rate(float sample_rate) { sample_rate_ = sample_rate; }
109 :
110 0 : float min_fundamental_frequency() const { return min_fundamental_frequency_; }
111 0 : void set_min_fundamental_frequency(float min_fundamental_frequency) {
112 0 : min_fundamental_frequency_ = min_fundamental_frequency;
113 0 : }
114 :
115 0 : float max_fundamental_frequency() const { return max_fundamental_frequency_; }
116 0 : void set_max_fundamental_frequency(float max_fundamental_frequency) {
117 0 : max_fundamental_frequency_ = max_fundamental_frequency;
118 0 : }
119 :
120 0 : float contamination_rejection_period() const {
121 0 : return contamination_rejection_period_;
122 : }
123 0 : void set_contamination_rejection_period(
124 : float contamination_rejection_period) {
125 0 : contamination_rejection_period_ = contamination_rejection_period;
126 0 : }
127 :
128 : private:
129 : float frame_period_; // Frame period
130 : float frame_duration_; // Window size
131 : float onset_window_; // Interval scanned for onset activity
132 : float speech_on_window_; // Inverval scanned for ongoing speech
133 : float offset_window_; // Interval scanned for offset evidence
134 : float offset_confirm_dur_; // Silence duration required to confirm offset
135 : float decision_threshold_; // Initial rms detection threshold
136 : float min_decision_threshold_; // Minimum rms detection threshold
137 : float fast_update_dur_; // Period for initial estimation of levels.
138 : float sample_rate_; // Expected sample rate.
139 :
140 : // Time to add on either side of endpoint threshold crossings
141 : float endpoint_margin_;
142 : // Total dur within onset_window required to enter ONSET state
143 : float onset_detect_dur_;
144 : // Total on time within onset_window required to enter SPEECH_ON state
145 : float onset_confirm_dur_;
146 : // Minimum dur in SPEECH_ON state required to maintain ON state
147 : float on_maintain_dur_;
148 : // Minimum fundamental frequency for autocorrelation.
149 : float min_fundamental_frequency_;
150 : // Maximum fundamental frequency for autocorrelation.
151 : float max_fundamental_frequency_;
152 : // Period after start of user input that above threshold values are ignored.
153 : // This is to reject audio feedback contamination.
154 : float contamination_rejection_period_;
155 : };
156 :
157 : } // namespace mozilla
158 :
159 : #endif // CONTENT_BROWSER_SPEECH_ENDPOINTER_ENERGY_ENDPOINTER_PARAMS_H_
|