#include <sent/stddefs.h>
#include <sent/speech.h>
adin.hのインクルード依存関係図
このグラフは、どのファイルから直接、間接的にインクルードされているかを示しています。
マクロ定義 | |
#define | DEFAULT_WSTEP 1000 |
Default unit size of speech input segment in bytes | |
#define | SUPPORTED_WAVEFILE_FORMAT "RAW(BE),WAV,AU,SND,NIST,ADPCM and more" |
#define | ZMEANSAMPLES 48000 |
列挙型 | |
enum | { SP_RAWFILE, SP_MIC, SP_ADINNET, SP_MFCFILE, SP_NETAUDIO, SP_STDIN } |
To select speech input source [詳細] | |
関数 | |
boolean | adin_select (int source) |
boolean | adin_standby (int freq, void *arg) |
boolean | adin_begin () |
boolean | adin_end () |
void | adin_setup_func (int(*cad_read)(SP16 *, int), boolean(*cad_pause)(), boolean(*cad_resume)(), boolean use_cut_def, boolean need_thread) |
void | adin_setup_param (int silence_cut, boolean strip_zero, int cthres, int czc, int margin, int tail_margin, int sample_freq, boolean ignore_speech, boolean need_zeromean) |
boolean | query_segment_on () |
boolean | query_thread_on () |
void | adin_reset_zmean () |
int | adin_go (int(*ad_process)(SP16 *, int), int(*ad_check)()) |
Top function to start input processing | |
boolean | adin_mic_standby (int freq, void *arg) |
boolean | adin_mic_start () |
boolean | adin_mic_stop () |
int | adin_mic_read (SP16 *buf, int sampnum) |
Read samples from the daemon. | |
boolean | adin_netaudio_standby (int freq, void *arg) |
boolean | adin_netaudio_start () |
boolean | adin_netaudio_stop () |
int | adin_netaudio_read (SP16 *buf, int sampnum) |
Read samples from the daemon. | |
int | NA_standby (int, char *) |
void | NA_start () |
void | NA_stop () |
int | NA_read (SP16 *buf, int sampnum) |
Read samples from NetAudio port. | |
char * | get_line (char *prompt) |
boolean | adin_file_standby (int freq, void *arg) |
boolean | adin_file_begin () |
Begin reading audio data from a file. | |
int | adin_file_read (SP16 *buf, int sampnum) |
boolean | adin_file_end () |
boolean | adin_stdin_standby (int freq, void *arg) |
boolean | adin_stdin_begin () |
Begin reading audio data from stdin | |
int | adin_stdin_read (SP16 *buf, int sampnum) |
boolean | adin_sndfile_standby (int freq, void *arg) |
boolean | adin_sndfile_begin () |
Begin reading audio data from a file. | |
int | adin_sndfile_read (SP16 *buf, int sampnum) |
boolean | adin_sndfile_end () |
boolean | adin_tcpip_standby (int freq, void *arg) |
boolean | adin_tcpip_begin () |
boolean | adin_tcpip_end () |
End recording. | |
int | adin_tcpip_read (SP16 *buf, int sampnum) |
boolean | adin_tcpip_send_pause () |
boolean | adin_tcpip_send_terminate () |
boolean | adin_tcpip_send_resume () |
void | init_count_zc_e (int c_trigger, int c_length, int c_offset) |
void | end_count_zc_e () |
int | count_zc_e (SP16 *buf, int step) |
int | count_zc_e_level (SP16 *buf, int step, int *levelp) |
void | zc_copy_buffer (SP16 *newbuf, int *len) |
void | zmean_reset () |
void | sub_zmean (SP16 *speech, int samplenum) |
Remove DC offset. |
adin.h で定義されています。
#define SUPPORTED_WAVEFILE_FORMAT "RAW(BE),WAV,AU,SND,NIST,ADPCM and more" |
String describing the list of supported wave file formats. It depends on HAVE_LIBSNDFILE.
参照元 detailed_help().
#define ZMEANSAMPLES 48000 |
Number of samples from beggining of input to be used for computing the zero mean of source channel (for microphone/network input).
参照元 sub_zmean().
anonymous enum |
boolean adin_select | ( | int | source | ) |
Select input source and setup device-specific functions.
source | [In] selection ID of input source |
参照元 adin_initialize().
boolean adin_standby | ( | int | freq, | |
void * | arg | |||
) |
Call device-specific initialization.
freq | [in] sampling frequency | |
arg | [in] device-dependent extra argument |
参照元 adin_initialize().
boolean adin_begin | ( | ) |
Call device-specific function to begin capturing of the audio stream.
boolean adin_end | ( | ) |
Call device-specific function to end capturing of the audio stream.
void adin_setup_func | ( | int(*)(SP16 *, int) | cad_read, | |
boolean(*)() | cad_pause, | |||
boolean(*)() | cad_resume, | |||
boolean | use_cut_def, | |||
boolean | need_thread | |||
) |
Store the given device-dependent functions and configuration values to local work area. This function will be called from adin_select() via adin_register_func().
cad_read | [in] function to read input samples |
cad_pause | [in] function to stop input |
cad_resume | [in] function to (re-)start input |
use_cut_def | [in] TRUE if the device needs speech segment detection by default |
need_thread | [in] TRUE if the device is live input and needs threading |
adin-cut.c の 179 行で定義されています。
参照元 adin_register_func().
void adin_setup_param | ( | int | silence_cut, | |
boolean | strip_zero, | |||
int | cthres, | |||
int | czc, | |||
int | head_margin, | |||
int | tail_margin, | |||
int | sample_freq, | |||
boolean | ignore_speech, | |||
boolean | need_zeromean | |||
) |
Setup silence detection parameters (should be called after adin_select()). If using pthread, the A/D-in and detection thread will be started at the end of this function.
silence_cut | [in] whether to perform silence cutting. 0=force off, 1=force on, 2=keep device-specific default | |
strip_zero | [in] TRUE if enables stripping of zero samples | |
cthres | [in] input level threshold (0-32767) | |
czc | [in] zero-cross count threshold in a second | |
head_margin | [in] header margin length in msec | |
tail_margin | [in] tail margin length in msec | |
sample_freq | [in] sampling frequency: just providing value for computing other variables | |
ignore_speech | [in] TRUE if ignore speech input between call, while waiting recognition process | |
need_zeromean | [in] TRUE if perform zero-mean subtraction |
adin-cut.c の 216 行で定義されています。
参照元 adin_initialize().
boolean query_segment_on | ( | ) |
Query function to check whether the input speech detection is on or off.
adin-cut.c の 254 行で定義されています。
boolean query_thread_on | ( | ) |
Query function to check whether the input threading is on or off.
adin-cut.c の 265 行で定義されています。
void adin_reset_zmean | ( | ) |
Reset zero mean data to re-estimate zero mean at the next input.
adin-cut.c の 275 行で定義されています。
int adin_go | ( | int(*)(SP16 *, int) | ad_process, | |
int(*)() | ad_check | |||
) |
Top function to start input processing
If threading mode is enabled, this function simply enters to adin_thread_process() to process triggered samples detected by another running A/D-in thread.
If threading mode is not available or disabled by either device requirement or OS capability, this function simply calls adin_cut() to detect speech segment from input device and process them concurrently by one process.
ad_process | [in] function to process the recorded fragments | |
ad_check | [in] function to be called periodically for checking incoming user command in module mode. |
adin-cut.c の 1126 行で定義されています。
boolean adin_mic_standby | ( | int | sfreq, | |
void * | dummy | |||
) |
Device initialization: check device capability and open for recording.
sfreq | [in] required sampling frequency. | |
dummy | [in] a dummy data |
adin_esd.c の 51 行で定義されています。
参照元 adin_select().
boolean adin_mic_start | ( | ) |
boolean adin_mic_stop | ( | ) |
int adin_mic_read | ( | SP16 * | buf, | |
int | sampnum | |||
) |
Read samples from the daemon.
Try to read sampnum samples and returns actual number of recorded samples currently available. This function will block until at least some samples are obtained.
buf | [out] samples obtained in this function | |
sampnum | [in] wanted number of samples to be read |
adin_esd.c の 104 行で定義されています。
参照元 adin_select().
boolean adin_netaudio_standby | ( | int | sfreq, | |
void * | arg | |||
) |
Connection initialization: check connectivity and open for recording.
sfreq | [in] required sampling frequency | |
arg | [in] server device name string to connect |
adin_netaudio.c の 57 行で定義されています。
参照元 adin_select().
boolean adin_netaudio_start | ( | ) |
Start recording.
adin_netaudio.c の 71 行で定義されています。
参照元 adin_select().
boolean adin_netaudio_stop | ( | ) |
Stop recording.
adin_netaudio.c の 84 行で定義されています。
参照元 adin_select().
int adin_netaudio_read | ( | SP16 * | buf, | |
int | sampnum | |||
) |
Read samples from the daemon.
Try to read sampnum samples and returns actual number of recorded samples currently available. This function will block until at least one sample can be obtained.
buf | [out] samples obtained in this function | |
sampnum | [in] wanted number of samples to be read |
adin_netaudio.c の 103 行で定義されています。
参照元 adin_select().
int NA_standby | ( | int | sfreq, | |
char * | server_devname | |||
) |
Initialize NetAudio device.
sfreq | [in] sampling frequency | |
server_devname | [in] server host name |
void NA_start | ( | ) |
void NA_stop | ( | ) |
int NA_read | ( | SP16 * | buf, | |
int | sampnum | |||
) |
Read samples from NetAudio port.
Try to read sampnum samples and returns actual number of recorded samples currently available. This function will block until at least some samples are obtained.
buf | [out] samples obtained in this function | |
sampnum | [in] wanted number of samples to be read |
参照元 adin_netaudio_read().
char* get_line | ( | char * | prompt | ) |
Get one file name from stdin with a prompt . Blank line is omitted.
prompt | [in] prompt string |
adin_file.c の 314 行で定義されています。
参照元 adin_file_begin()・adin_sndfile_begin()・main_recognition_loop().
boolean adin_file_standby | ( | int | freq, | |
void * | arg | |||
) |
Initialization: if listfile is specified, open it here.
freq | [in] required sampling frequency. | |
arg | [in] file name of listfile, or NULL if not use |
adin_file.c の 355 行で定義されています。
参照元 adin_select().
boolean adin_file_begin | ( | ) |
Begin reading audio data from a file.
If listfile was specified in adin_file_standby(), the next filename will be read from the listfile. Otherwise, the filename will be obtained from stdin. Then the file will be opened here.
adin_file.c の 385 行で定義されています。
参照元 adin_select().
int adin_file_read | ( | SP16 * | buf, | |
int | sampnum | |||
) |
Try to read sampnum samples and returns actual sample num recorded.
buf | [out] samples obtained in this function | |
sampnum | [in] wanted number of samples to be read |
adin_file.c の 429 行で定義されています。
参照元 adin_select().
boolean adin_file_end | ( | ) |
End recording.
adin_file.c の 476 行で定義されています。
参照元 adin_select().
boolean adin_stdin_standby | ( | int | freq, | |
void * | arg | |||
) |
Initialization for speech input via stdin.
freq | [in] required sampling frequency. | |
arg | dummy, ignored |
adin_file.c の 492 行で定義されています。
参照元 adin_select().
boolean adin_stdin_begin | ( | ) |
Begin reading audio data from stdin
adin_file.c の 505 行で定義されています。
参照元 adin_select().
int adin_stdin_read | ( | SP16 * | buf, | |
int | sampnum | |||
) |
Try to read sampnum samples and returns actual sample num recorded.
buf | [out] samples obtained in this function | |
sampnum | [in] wanted number of samples to be read |
adin_file.c の 528 行で定義されています。
参照元 adin_select().
boolean adin_sndfile_standby | ( | int | freq, | |
void * | arg | |||
) |
Initialization: if listfile is specified, open it here. Else, just store the required frequency.
freq | [in] required sampling frequency | |
arg | [in] file name of listfile, or NULL if not use |
adin_sndfile.c の 202 行で定義されています。
参照元 adin_select().
boolean adin_sndfile_begin | ( | ) |
Begin reading audio data from a file.
If listfile was specified in adin_sndfile_standby(), the next filename will be read from the listfile. Otherwise, the filename will be obtained from stdin. Then the file will be opened here.
adin_sndfile.c の 232 行で定義されています。
参照元 adin_select().
int adin_sndfile_read | ( | SP16 * | buf, | |
int | sampnum | |||
) |
Try to read sampnum samples and returns actual sample num recorded.
buf | [out] samples obtained in this function | |
sampnum | [in] wanted number of samples to be read |
adin_sndfile.c の 313 行で定義されています。
参照元 adin_select().
boolean adin_sndfile_end | ( | ) |
End recording.
adin_sndfile.c の 334 行で定義されています。
参照元 adin_select().
boolean adin_tcpip_standby | ( | int | freq, | |
void * | port_str | |||
) |
Initialize as adinnet server: prepare to become server.
freq | [in] required sampling frequency | |
port_str | [in] port number in string |
adin_tcpip.c の 78 行で定義されています。
参照元 adin_select().
boolean adin_tcpip_begin | ( | ) |
Wait for connection from adinnet client and begin audio input stream.
adin_tcpip.c の 100 行で定義されています。
参照元 adin_select().
boolean adin_tcpip_end | ( | ) |
End recording.
If last input segment was segmented by end of connection, close socket and wait for next connection. Otherwise, it means that the last input segment was segmented by either end-of-segment signal from client side or speech detection function in server side, so just wait for a next input in the current socket.
adin_tcpip.c の 146 行で定義されています。
参照元 adin_select().
int adin_tcpip_read | ( | SP16 * | buf, | |
int | sampnum | |||
) |
Try to read sampnum samples and returns actual sample num recorded. This function will not block.
If data of zero length has been received, it is treated as a end-of-segment marker from the client. If data below zero length has been received, it means the client has finished the overall input stream transmission and want to disconnect.
buf | [out] samples obtained in this function | |
sampnum | [in] wanted number of samples to be read |
adin_tcpip.c の 177 行で定義されています。
参照元 adin_select().
boolean adin_tcpip_send_pause | ( | ) |
Tell the adinnet client to pause transfer.
adin_tcpip.c の 223 行で定義されています。
参照元 msock_exec_command().
boolean adin_tcpip_send_terminate | ( | ) |
Tell the adinnet client to terminate transfer.
adin_tcpip.c の 257 行で定義されています。
参照元 msock_exec_command().
boolean adin_tcpip_send_resume | ( | ) |
Tell the adinnet client to resume the paused transfer.
adin_tcpip.c の 240 行で定義されています。
参照元 msock_exec_command().
void init_count_zc_e | ( | int | c_trigger, | |
int | c_length, | |||
int | c_offset | |||
) |
Initialize all parameters and buffers for zero-cross counting.
c_trigger | [in] Tgigger level threshold | |
c_length | [in] Cycle buffer size = Number of samples to hold | |
c_offset | [in] Static DC offset of input data |
参照元 adin_cut().
void end_count_zc_e | ( | ) |
int count_zc_e | ( | SP16 * | buf, | |
int | step | |||
) |
Adding buf[0..step-1] to the cycle buffer and update the count of zero cross. Also swap them with the oldest ones in the cycle buffer.
buf | [I/O] new samples given, and swapped samples will be returned. | |
step | [in] length of above. |
参照元 adin_cut().
int count_zc_e_level | ( | SP16 * | buf, | |
int | step, | |||
int * | levelp | |||
) |
Adding buf[0..step-1] to the cycle buffer and update the count of zero cross. Also swap them with the oldest ones in the cycle buffer. Also get the maximum level in the cycle buffer.
buf | [I/O] new samples, will be swapped by old samples when returned. | |
step | [in] length of above. | |
levelp | [out] maximum level in the cycle buffer. |
void zc_copy_buffer | ( | SP16 * | newbuf, | |
int * | len | |||
) |
Flush samples in the current cycle buffer.
newbuf | [out] the samples in teh cycle buffer will be written here. | |
len | [out] length of above. |
参照元 adin_cut().
void zmean_reset | ( | ) |
void sub_zmean | ( | SP16 * | speech, | |
int | samplenum | |||
) |
Remove DC offset.
The DC offset is estimated by the first samples after zmean_reset() was called. If the first input segment is longer than ZMEANSAMPLES, the whole input is used to estimate the zero mean. Otherwise, the zero mean will continue to be updated until the read length exceed ZMEANSAMPLES.
speech | [I/O] input speech data, will be subtracted by DC offset. | |
samplenum | [in] length of above. |
参照元 adin_cut().