PocketSphinx  5.0.0rc5
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  */
35 #ifndef __PS_ENDPOINTER_H__
36 #define __PS_ENDPOINTER_H__
37 
38 
39 #include <pocketsphinx/prim_type.h>
40 #include <pocketsphinx/export.h>
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 #if 0
46 }
47 #endif
48 
49 #include <pocketsphinx/prim_type.h>
50 #include <pocketsphinx/export.h>
51 #include <pocketsphinx/vad.h>
52 
57 typedef struct ps_endpointer_s ps_endpointer_t;
58 
62 #define PS_ENDPOINTER_DEFAULT_WINDOW 0.3
63 
66 #define PS_ENDPOINTER_DEFAULT_RATIO 0.9
67 
95 POCKETSPHINX_EXPORT
96 ps_endpointer_t *ps_endpointer_init(double window,
97  double ratio,
98  ps_vad_mode_t mode,
99  int sample_rate, double frame_length);
100 
107 POCKETSPHINX_EXPORT
109 
116 POCKETSPHINX_EXPORT
118 
126 POCKETSPHINX_EXPORT
128 
132 #define ps_endpointer_frame_size(ep) ps_vad_frame_size(ps_endpointer_vad(ep))
133 
137 #define ps_endpointer_sample_rate(ep) ps_vad_sample_rate(ps_endpointer_vad(ep))
138 
151 POCKETSPHINX_EXPORT
152 const int16 *ps_endpointer_process(ps_endpointer_t *ep,
153  const int16 *frame);
154 
168 POCKETSPHINX_EXPORT
170  const int16 *frame,
171  size_t nsamp,
172  size_t *out_nsamp);
173 
188 POCKETSPHINX_EXPORT
190 
194 POCKETSPHINX_EXPORT
196 
200 POCKETSPHINX_EXPORT
202 
203 #ifdef __cplusplus
204 }
205 #endif
206 
207 #endif /* __PS_ENDPOINTER_H__ */
ps_endpointer_in_speech
POCKETSPHINX_EXPORT int ps_endpointer_in_speech(ps_endpointer_t *ep)
prim_type.h
Basic type definitions used in Sphinx.
ps_endpointer_speech_start
POCKETSPHINX_EXPORT double ps_endpointer_speech_start(ps_endpointer_t *ep)
vad.h
Simple voice activity detection.
ps_endpointer_speech_end
POCKETSPHINX_EXPORT double ps_endpointer_speech_end(ps_endpointer_t *ep)
ps_endpointer_retain
POCKETSPHINX_EXPORT ps_endpointer_t * ps_endpointer_retain(ps_endpointer_t *ep)
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_vad
POCKETSPHINX_EXPORT ps_vad_t * ps_endpointer_vad(ps_endpointer_t *ep)
ps_vad_t
struct ps_vad_s ps_vad_t
Definition: vad.h:52
ps_endpointer_free
POCKETSPHINX_EXPORT int ps_endpointer_free(ps_endpointer_t *ep)
ps_endpointer_process
const POCKETSPHINX_EXPORT int16 * ps_endpointer_process(ps_endpointer_t *ep, const int16 *frame)
ps_endpointer_t
Simple voice activity detection based endpointing.
ps_vad_mode_t
enum ps_vad_mode_e ps_vad_mode_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)