PocketSphinx 5.1.0
A small speech recognizer
Loading...
Searching...
No Matches
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
43#include <pocketsphinx/export.h>
44
45#ifdef __cplusplus
46extern "C" {
47#endif
48#if 0
49}
50#endif
51
53#include <pocketsphinx/export.h>
54#include <pocketsphinx/vad.h>
55
60typedef struct ps_endpointer_s ps_endpointer_t;
61
72typedef double (*ps_endpointer_timestamp_cb_t)(void *user_data);
73
77#define PS_ENDPOINTER_DEFAULT_WINDOW 0.3
81#define PS_ENDPOINTER_DEFAULT_RATIO 0.9
82
111POCKETSPHINX_EXPORT
113 double ratio,
114 ps_vad_mode_t mode,
115 int sample_rate, double frame_length);
116
124POCKETSPHINX_EXPORT
126
134POCKETSPHINX_EXPORT
136
145POCKETSPHINX_EXPORT
147
153#define ps_endpointer_frame_size(ep) ps_vad_frame_size(ps_endpointer_vad(ep))
154
158#define ps_endpointer_frame_length(ep) ps_vad_frame_length(ps_endpointer_vad(ep))
159
163#define ps_endpointer_sample_rate(ep) ps_vad_sample_rate(ps_endpointer_vad(ep))
164
178POCKETSPHINX_EXPORT
180 const int16 *frame);
181
196POCKETSPHINX_EXPORT
198 const int16 *frame,
199 size_t nsamp,
200 size_t *out_nsamp);
201
217POCKETSPHINX_EXPORT
219
224POCKETSPHINX_EXPORT
226
231POCKETSPHINX_EXPORT
233
251POCKETSPHINX_EXPORT
254 void *user_data);
255
267POCKETSPHINX_EXPORT
269
270#ifdef __cplusplus
271}
272#endif
273
274#endif /* __PS_ENDPOINTER_H__ */
double(* ps_endpointer_timestamp_cb_t)(void *user_data)
Definition endpointer.h:72
Basic type definitions used in Sphinx.
Simple voice activity detection based endpointing.
POCKETSPHINX_EXPORT ps_vad_t * ps_endpointer_vad(ps_endpointer_t *ep)
POCKETSPHINX_EXPORT ps_endpointer_t * ps_endpointer_init(double window, double ratio, ps_vad_mode_t mode, int sample_rate, double frame_length)
POCKETSPHINX_EXPORT int ps_endpointer_set_timestamp_func(ps_endpointer_t *ep, ps_endpointer_timestamp_cb_t cb, void *user_data)
POCKETSPHINX_EXPORT const int16 * ps_endpointer_end_stream(ps_endpointer_t *ep, const int16 *frame, size_t nsamp, size_t *out_nsamp)
POCKETSPHINX_EXPORT const int16 * ps_endpointer_process(ps_endpointer_t *ep, const int16 *frame)
POCKETSPHINX_EXPORT double ps_endpointer_speech_start(ps_endpointer_t *ep)
POCKETSPHINX_EXPORT ps_endpointer_t * ps_endpointer_retain(ps_endpointer_t *ep)
POCKETSPHINX_EXPORT double ps_endpointer_speech_end(ps_endpointer_t *ep)
POCKETSPHINX_EXPORT int ps_endpointer_free(ps_endpointer_t *ep)
POCKETSPHINX_EXPORT int ps_endpointer_in_speech(ps_endpointer_t *ep)
POCKETSPHINX_EXPORT double ps_endpointer_timestamp(ps_endpointer_t *ep)
Voice activity detector.
Simple voice activity detection.