Julius 4.2
関数 | 変数
libsent/src/adin/adin_sndfile.c

ファイル入力:libsndfile を用いた音声ファイル読み込み [詳細]

#include <sent/stddefs.h>
#include <sent/speech.h>
#include <sent/adin.h>
#include <sndfile.h>

ソースコードを見る。

関数

static boolean check_format (SF_INFO *s)
 Check if the file format is 16bit, monoral.
static void print_format (SF_INFO *s)
 Output format information to stdout (compliant to libsnd-0.0.23)
boolean adin_sndfile_standby (int freq, void *arg)
 Initialization: if listfile is specified, open it here.
static boolean adin_sndfile_open (char *filename)
 Open a file and check the format.
boolean adin_sndfile_begin (char *filename)
 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.

変数

static int sfreq
 Required sampling frequency in Hz.
static SF_INFO sinfo
 Wavefile information.
static SNDFILE * sp
 File handler.
static boolean from_file
 TRUE if reading filename from listfile.
static FILE * fp_list
 File pointer used for the listfile.
static char speechfilename [MAXPATHLEN]
 Buffer to hold input file name.

説明

ファイル入力:libsndfile を用いた音声ファイル読み込み

libsndfile を用いて音声ファイルからの入力を行なう関数です. Microsoft WAVE形式の音声ファイル,およびヘッダ無し(RAW)ファイルの他に, AU, AND, NIST, ADPCM など様々な形式のファイルを読み込むことができます. なお,チャンネル数は1(モノラル)に限られます.またRAWファイルの場合, データのバイトオーダーは big endian である必要があります.

ファイルのサンプリングレートはシステムの要求するサンプリングレート (adin_standby() で指定される値)と一致する必要があります. ファイルのサンプリングレートがこの指定値と一致しなければエラーとなります. RAWファイル入力の場合は,ファイルにヘッダ情報が無く録音時の サンプリングレートが不明なため,チェック無しでファイルの サンプリングレートが adin_standby() で指定された値である と仮定して処理されます.

入力ファイル名は,標準入力から読み込まれます. ファイル名を列挙したファイルリストファイルが指定された場合, そのファイルから入力ファイル名が順次読み込まれます.

libsndfile はconfigure 時に自動検出されます.検出に失敗した場合, ファイル入力には adin_file.c 内の関数が使用されます.

Libsndfile のバージョンは 1.0.x に対応しています.

参照:
http://www.mega-nerd.com/libsndfile/
作者:
Akinobu LEE
日付:
Mon Feb 14 12:13:27 2005
Revision:
1.5

adin_sndfile.c で定義されています。


関数

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
戻り値:
TRUE on success, FALSE on failure.

adin_sndfile.c202 行で定義されています。

参照元 adin_select().

static boolean adin_sndfile_open ( char *  filename) [static]

Open a file and check the format.

引数:
filename[in] file name to open
戻り値:
TRUE on success, FALSE on failure.

adin_sndfile.c230 行で定義されています。

参照元 adin_sndfile_begin().

boolean adin_sndfile_begin ( char *  filename)

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.

引数:
filename[in] file name to open or NULL for prompt
戻り値:
TRUE on success, FALSE on failure.

adin_sndfile.c287 行で定義されています。

参照元 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
戻り値:
actural number of read samples, -1 if EOF, -2 if error.

adin_sndfile.c341 行で定義されています。

参照元 adin_select().

boolean adin_sndfile_end ( )

End recording.

戻り値:
TRUE on success, FALSE on failure.

adin_sndfile.c362 行で定義されています。

参照元 adin_select().

char* adin_sndfile_get_current_filename ( )

A tiny function to get current input raw speech file name.

戻り値:
string of current input speech file.

adin_sndfile.c381 行で定義されています。

参照元 adin_select().