PocketSphinx  5.0.0
A small speech recognizer
endpointer.h
Go to the documentation of this file.
1 /* -*- c-basic-offset:4; indent-tabs-mode: nil -*- */
2 /* ====================================================================
3  * Copyright (c) 2022 David Huggins-Daines. All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * 2. Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in
14  * the documentation and/or other materials provided with the
15  * distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
18  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20  * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
21  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
25  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
27  * OF THE POSSIBILITY OF SUCH DAMAGE.
28  * ====================================================================
29  */
38 #ifndef __PS_ENDPOINTER_H__
39 #define __PS_ENDPOINTER_H__
40 
41 
42 #include <pocketsphinx/prim_type.h>
43 #include <pocketsphinx/export.h>
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 #if 0
49 }
50 #endif
51 
52 #include <pocketsphinx/prim_type.h>
53 #include <pocketsphinx/export.h>
54 #include <pocketsphinx/vad.h>
55 
60 typedef struct ps_endpointer_s ps_endpointer_t;
61 
65 #define PS_ENDPOINTER_DEFAULT_WINDOW 0.3
66 
69 #define PS_ENDPOINTER_DEFAULT_RATIO 0.9
70 
99 POCKETSPHINX_EXPORT
100 ps_endpointer_t *ps_endpointer_init(double window,
101  double ratio,
102  ps_vad_mode_t mode,
103  int sample_rate, double frame_length);
104 
112 POCKETSPHINX_EXPORT
114 
122 POCKETSPHINX_EXPORT
124 
133 POCKETSPHINX_EXPORT
135 
139 #define ps_endpointer_frame_size(ep) ps_vad_frame_size(ps_endpointer_vad(ep))
140 
144 #define ps_endpointer_frame_length(ep) ps_vad_frame_length(ps_endpointer_vad(ep))
145 
149 #define ps_endpointer_sample_rate(ep) ps_vad_sample_rate(ps_endpointer_vad(ep))
150 
164 POCKETSPHINX_EXPORT
165 const int16 *ps_endpointer_process(ps_endpointer_t *ep,
166  const int16 *frame);
167 
182 POCKETSPHINX_EXPORT
184  const int16 *frame,
185  size_t nsamp,
186  size_t *out_nsamp);
187 
203 POCKETSPHINX_EXPORT
205 
210 POCKETSPHINX_EXPORT
212 
217 POCKETSPHINX_EXPORT
219 
220 #ifdef __cplusplus
221 }
222 #endif
223 
224 #endif /* __PS_ENDPOINTER_H__ */
ps_endpointer_t::ps_endpointer_process
const POCKETSPHINX_EXPORT int16 * ps_endpointer_process(ps_endpointer_t *ep, const int16 *frame)
prim_type.h
Basic type definitions used in Sphinx.
ps_endpointer_t::ps_endpointer_free
POCKETSPHINX_EXPORT int ps_endpointer_free(ps_endpointer_t *ep)
ps_endpointer_t::ps_endpointer_speech_start
POCKETSPHINX_EXPORT double ps_endpointer_speech_start(ps_endpointer_t *ep)
ps_endpointer_t::ps_endpointer_retain
POCKETSPHINX_EXPORT ps_endpointer_t * ps_endpointer_retain(ps_endpointer_t *ep)
vad.h
Simple voice activity detection.
ps_endpointer_t::ps_endpointer_in_speech
POCKETSPHINX_EXPORT int ps_endpointer_in_speech(ps_endpointer_t *ep)
ps_endpointer_t::ps_endpointer_end_stream
const POCKETSPHINX_EXPORT int16 * ps_endpointer_end_stream(ps_endpointer_t *ep, const int16 *frame, size_t nsamp, size_t *out_nsamp)
ps_endpointer_t::ps_endpointer_init
POCKETSPHINX_EXPORT ps_endpointer_t * ps_endpointer_init(double window, double ratio, ps_vad_mode_t mode, int sample_rate, double frame_length)
ps_endpointer_t::ps_endpointer_vad
POCKETSPHINX_EXPORT ps_vad_t * ps_endpointer_vad(ps_endpointer_t *ep)
ps_endpointer_t
Simple voice activity detection based endpointing.
ps_endpointer_t::ps_endpointer_speech_end
POCKETSPHINX_EXPORT double ps_endpointer_speech_end(ps_endpointer_t *ep)
ps_vad_t
Voice activity detector.