#include <sent/stddefs.h>
#include <sent/speech.h>
データ構造 | |
struct | DS_FILTER |
down sampling filter [詳細] | |
struct | DS_BUFFER |
down sampling data [詳細] | |
struct | ZEROCROSS |
Work area for zero-cross computation [詳細] | |
マクロ定義 | |
#define | HAS_ALSA |
#define | HAS_ESD |
#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" |
String describing the list of supported wave file formats. | |
#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). | |
#define | DS_RBSIZE 512 |
Filter size | |
#define | DS_BUFSIZE 256 |
Work area buffer size for x[] | |
#define | DS_BUFSIZE_Y 512 |
Work area buffer size for y[] | |
#define | ZC_UNDEF 2 |
Undefined mark for zerocross | |
#define | ZC_POSITIVE 1 |
Positive mark used for zerocross | |
#define | ZC_NEGATIVE -1 |
Negative mark used for zerocross | |
列挙型 | |
enum | { INPUT_WAVEFORM, INPUT_VECTOR } |
Speech input type | |
enum | { SP_RAWFILE, SP_MIC, SP_ADINNET, SP_MFCFILE, SP_NETAUDIO, SP_STDIN, SP_MFCMODULE } |
Speech input source [詳細] | |
enum | { SP_INPUT_DEFAULT, SP_INPUT_ALSA, SP_INPUT_OSS, SP_INPUT_ESD } |
Input device | |
関数 | |
boolean | adin_mic_standby (int freq, void *arg) |
Device initialization: check device capability and open for recording. | |
boolean | adin_mic_begin () |
Start recording. | |
boolean | adin_mic_end () |
Stop recording. | |
int | adin_mic_read (SP16 *buf, int sampnum) |
Read samples from device | |
boolean | adin_alsa_standby (int freq, void *arg) |
Device initialization: check device capability and open for recording. | |
boolean | adin_alsa_begin () |
Start recording. | |
boolean | adin_alsa_end () |
Stop recording. | |
int | adin_alsa_read (SP16 *buf, int sampnum) |
Read samples from device | |
boolean | adin_oss_standby (int freq, void *arg) |
Device initialization: check device capability and open for recording. | |
boolean | adin_oss_begin () |
Start recording. | |
boolean | adin_oss_end () |
Stop recording. | |
int | adin_oss_read (SP16 *buf, int sampnum) |
Read samples from device | |
boolean | adin_esd_standby (int freq, void *arg) |
Connection initialization: check connectivity and open for recording. | |
boolean | adin_esd_begin () |
Start recording. | |
boolean | adin_esd_end () |
Stop recording. | |
int | adin_esd_read (SP16 *buf, int sampnum) |
Read samples from the daemon. | |
boolean | adin_netaudio_standby (int freq, void *arg) |
Connection initialization: check connectivity and open for recording. | |
boolean | adin_netaudio_begin () |
Start recording. | |
boolean | adin_netaudio_end () |
Stop recording. | |
int | adin_netaudio_read (SP16 *buf, int sampnum) |
Read samples from the daemon. | |
int | NA_standby (int, char *) |
Initialize NetAudio device. | |
void | NA_start () |
Begin recording. | |
void | NA_stop () |
Pause the recording. | |
int | NA_read (SP16 *buf, int sampnum) |
Read samples from NetAudio port. | |
boolean | adin_file_standby (int freq, void *arg) |
Initialization: if listfile is specified, open it here. | |
boolean | adin_file_begin () |
Begin reading audio data from a file. | |
int | adin_file_read (SP16 *buf, int sampnum) |
Try to read sampnum samples and returns actual sample num recorded. | |
boolean | adin_file_end () |
End recording. | |
boolean | adin_stdin_standby (int freq, void *arg) |
Initialization for speech input via stdin. | |
boolean | adin_stdin_begin () |
Begin reading audio data from stdin | |
int | adin_stdin_read (SP16 *buf, int sampnum) |
Try to read sampnum samples and returns actual sample num recorded. | |
char * | adin_file_get_current_filename () |
A tiny function to get current input raw speech file name. | |
boolean | adin_sndfile_standby (int freq, void *arg) |
Initialization: if listfile is specified, open it here. | |
boolean | adin_sndfile_begin () |
Begin reading audio data from a file. | |
int | adin_sndfile_read (SP16 *buf, int sampnum) |
Try to read sampnum samples and returns actual sample num recorded. | |
boolean | adin_sndfile_end () |
End recording. | |
char * | adin_sndfile_get_current_filename () |
A tiny function to get current input raw speech file name. | |
boolean | adin_tcpip_standby (int freq, void *arg) |
Initialize as adinnet server: prepare to become server. | |
boolean | adin_tcpip_begin () |
Wait for connection from adinnet client and begin audio input stream. | |
boolean | adin_tcpip_end () |
End recording. | |
int | adin_tcpip_read (SP16 *buf, int sampnum) |
Try to read sampnum samples and returns actual sample num recorded. | |
boolean | adin_tcpip_send_pause () |
Tell the adinnet client to pause transfer. | |
boolean | adin_tcpip_send_terminate () |
Tell the adinnet client to terminate transfer. | |
boolean | adin_tcpip_send_resume () |
Tell the adinnet client to resume the paused transfer. | |
void | init_count_zc_e (ZEROCROSS *zc, int length) |
Allocate buffers for zerocross counting. | |
void | reset_count_zc_e (ZEROCROSS *zc, int c_trigger, int c_length, int c_offset) |
Initialize all parameters and buffers for zero-cross counting. | |
void | free_count_zc_e (ZEROCROSS *zc) |
End procedure: free all buffers. | |
int | count_zc_e (ZEROCROSS *zc, SP16 *buf, int step) |
Adding buf[0. | |
void | zc_copy_buffer (ZEROCROSS *zc, SP16 *newbuf, int *len) |
Flush samples in the current cycle buffer. | |
void | zmean_reset () |
Reset status. | |
void | sub_zmean (SP16 *speech, int samplenum) |
Remove DC offset. | |
DS_BUFFER * | ds48to16_new () |
Setup for down sampling | |
void | ds48to16_free (DS_BUFFER *ds) |
Free the down sampling buffer. | |
int | ds48to16 (SP16 *dst, SP16 *src, int srclen, int maxdstlen, DS_BUFFER *ds) |
Perform down sampling of input samples to 1/3. |
このファイルには, さまざまなソースからの音声入力処理と音声区間の検出 に関連するいくつかの定義が含まれています.
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.
anonymous enum |
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_mic_darwin_coreaudio.c の 285 行で定義されています。
参照元 adin_select().
boolean adin_mic_begin | ( | ) |
Start recording.
adin_mic_darwin_coreaudio.c の 571 行で定義されています。
参照元 adin_select().
boolean adin_mic_end | ( | ) |
Stop recording.
adin_mic_darwin_coreaudio.c の 572 行で定義されています。
参照元 adin_select().
int adin_mic_read | ( | SP16 * | buf, | |
int | sampnum | |||
) |
Read samples from device
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_mic_freebsd.c の 234 行で定義されています。
参照元 adin_select().
boolean adin_alsa_standby | ( | int | sfreq, | |
void * | dummy | |||
) |
Device initialization: check device capability and open for recording.
sfreq | [in] required sampling frequency. | |
dummy | [in] a dummy data |
< Pointer to device hardware parameters
adin_mic_linux_alsa.c の 163 行で定義されています。
boolean adin_alsa_begin | ( | ) |
boolean adin_alsa_end | ( | ) |
int adin_alsa_read | ( | SP16 * | buf, | |
int | sampnum | |||
) |
Read samples from device
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_mic_linux_alsa.c の 483 行で定義されています。
boolean adin_oss_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_mic_linux_oss.c の 115 行で定義されています。
boolean adin_oss_begin | ( | ) |
boolean adin_oss_end | ( | ) |
int adin_oss_read | ( | SP16 * | buf, | |
int | sampnum | |||
) |
Read samples from device
Try to read sampnum samples and returns actual number of recorded samples currently available. This function will block at most MAXPOLLINTERVAL msec, until at least one sample can be obtained. If no data has been obtained after waiting for MAXPOLLINTERVAL msec, returns 0.
When stereo input, only left channel will be used.
buf | [out] samples obtained in this function | |
sampnum | [in] wanted number of samples to be read |
adin_mic_linux_oss.c の 396 行で定義されています。
boolean adin_esd_standby | ( | int | sfreq, | |
void * | dummy | |||
) |
Connection initialization: check connectivity and open for recording.
sfreq | [in] required sampling frequency | |
dummy | [in] a dummy data |
adin_esd.c の 54 行で定義されています。
boolean adin_esd_begin | ( | ) |
boolean adin_esd_end | ( | ) |
int adin_esd_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_esd.c の 112 行で定義されています。
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 の 58 行で定義されています。
参照元 adin_select().
boolean adin_netaudio_begin | ( | ) |
Start recording.
adin_netaudio.c の 72 行で定義されています。
参照元 adin_select().
boolean adin_netaudio_end | ( | ) |
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 |
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().
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 の 326 行で定義されています。
参照元 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 の 356 行で定義されています。
参照元 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 の 397 行で定義されています。
参照元 adin_select().
boolean adin_file_end | ( | ) |
End recording.
adin_file.c の 460 行で定義されています。
参照元 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 の 476 行で定義されています。
参照元 adin_select().
boolean adin_stdin_begin | ( | ) |
Begin reading audio data from stdin
adin_file.c の 489 行で定義されています。
参照元 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 の 514 行で定義されています。
参照元 adin_select().
char* adin_file_get_current_filename | ( | ) |
A tiny function to get current input raw speech file name.
adin_file.c の 570 行で定義されています。
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 の 310 行で定義されています。
参照元 adin_select().
boolean adin_sndfile_end | ( | ) |
End recording.
adin_sndfile.c の 331 行で定義されています。
参照元 adin_select().
char* adin_sndfile_get_current_filename | ( | ) |
A tiny function to get current input raw speech file name.
adin_sndfile.c の 350 行で定義されています。
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 の 149 行で定義されています。
参照元 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 の 180 行で定義されています。
参照元 adin_select().
boolean adin_tcpip_send_pause | ( | ) |
Tell the adinnet client to pause transfer.
adin_tcpip.c の 224 行で定義されています。
参照元 adin_select().
boolean adin_tcpip_send_terminate | ( | ) |
Tell the adinnet client to terminate transfer.
adin_tcpip.c の 290 行で定義されています。
参照元 adin_select().
boolean adin_tcpip_send_resume | ( | ) |
Tell the adinnet client to resume the paused transfer.
adin_tcpip.c の 242 行で定義されています。
参照元 adin_select().
void init_count_zc_e | ( | ZEROCROSS * | zc, | |
int | length | |||
) |
Allocate buffers for zerocross counting.
zc | [i/o] zerocross work area | |
length | [in] Cycle buffer size = Number of samples to hold |
void reset_count_zc_e | ( | ZEROCROSS * | zc, | |
int | c_trigger, | |||
int | c_length, | |||
int | c_offset | |||
) |
Initialize all parameters and buffers for zero-cross counting.
zc | [i/o] zerocross work area | |
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 free_count_zc_e | ( | ZEROCROSS * | zc | ) |
End procedure: free all buffers.
zc | [i/o] zerocross work area |
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.
zc | [i/o] zerocross work area | |
buf | [I/O] new samples, will be swapped by old samples when returned. | |
step | [in] length of above. |
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().
DS_BUFFER* ds48to16_new | ( | ) |
Setup for down sampling
ds48to16.c の 269 行で定義されています。
参照元 adin_setup_all().
void ds48to16_free | ( | DS_BUFFER * | ds | ) |
Free the down sampling buffer.
ds | [i/o] down sampling buffer to free |
ds48to16.c の 307 行で定義されています。
参照元 adin_free_param().
Perform down sampling of input samples to 1/3.
dst | [out] store the resulting samples | |
src | [in] input samples | |
srclen | [in] number of input samples | |
maxdstlen | [in] maximum length of dst | |
ds | [i/o] down sampling buffer |
ds48to16.c の 332 行で定義されています。
参照元 adin_cut().