[Python-doc-jp 239] libsndhdr訳しました
hiroyuki yoshimura
vivant @ fli.freeserve.ne.jp
2002年 11月 22日 (金) 19:30:01 JST
吉村です。
libsndhdr.texを訳してみました。長くなりますが、末尾にペーストします。
自信ないのでお聞きしたいのですが...
1.内容もそうですが、日本語としてどうかな?というところと、
2.関数whathdrで
Determines the type of sound data stored in a file based on the file
header.
ファイルのヘッダ情報をもとに、保存されたサウンドデータの形式を識別し
ます。
「ファイルのヘッダ情報」という用語でいいのでしょうか。typeは
http://python.jp/moin/index.cgi/Type
でも「型」とありますが、ここでは変数やオブジェクトのtypeではなくサウンド
データなので「形式」にしましたがいかがでしょう?
Macのリファレンスをざっと読んだことしかなかったので、不安があって細かい
質問で申しわけありません。MLで発言したこともなかったし、私の訳文を見てい
ただいておこうとも思ったもので。
この程度でよければこれからバリバリ(気持ちは)やりますので、突っ込んでい
ただければ幸いです。
libsndhdr.tex(TEXのタグ?は一部省略)
----------------------------------------------
\section{\module{sndhdr} ---
% Determine type of sound file}
--- サウンドファイルの識別}
The \module{sndhdr} provides utility functions which attempt to
determine the type of sound data which is in a file. When these
functions are able to determine what type of sound data is stored in a
file, they return a tuple \code{(\var{type}, \var{sampling_rate},
\var{channels}, \var{frames}, \var{bits_per_sample})}. The value for
\var{type} indicates the data type and will be one of the strings
\code{'aifc'}, \code{'aiff'}, \code{'au'}, \code{'hcom'},
\code{'sndr'}, \code{'sndt'}, \code{'voc'}, \code{'wav'},
\code{'8svx'}, \code{'sb'}, \code{'ub'}, or \code{'ul'}. The
\var{sampling_rate} will be either the actual value or \code{0} if
unknown or difficult to decode. Similarly, \var{channels} will be
either the number of channels or \code{0} if it cannot be determined
or if the value is difficult to decode. The value for \var{frames}
will be either the number of frames or \code{-1}. The last item in
the tuple, \var{bits_per_sample}, will either be the sample size in
bits or \code{'A'} for A-LAW\index{A-LAW} or \code{'U'} for
u-LAW\index{u-LAW}.
\module{sndhdr}モジュールには、ファイルに保存されたサウンドデータの形式
を識別するのに便利な関数が定義されています。
どんな形式のサウンドデータがファイルに保存されているのか識別可能な場合、
これらの関数は\code{(\var{type}、\var{sampling_rate}、
\var{channels}、\var{frames}、\var{bits_per_sample})}のタプルを返しま
す。
\var{type}はデータの形式を示す文字列で、\code{'aifc'}、\code{'aiff'}、
\code{'au'}、\code{'hcom'}、\code{'sndr'}、\code{'sndt'}、\code{'voc'}、
\code{'wav'}、\code{'8svx'}、\code{'sb'}、\code{'ub'}、\code{'ul'}のうち
の一つです。
\var{sampling_rate}は実際のサンプリングレート値で、未知の場合やデコー
ドが困難な場合は\code{0}です。
同様に、\var{channels}はチャンネル数で、識別できない場合やデコードが困難
な場合は\code{0}です。\var{frames}はフレーム数で、識別できない場合は
\code{-1}です。
タプルの最後の要素\var{bits_per_sample}はサンプルサイズを示すビット数
ですが、A-LAW\index{A-LAW}なら\code{'A'}、u-LAW\index{u-LAW}なら
\code{'U'}です。
\begin{funcdesc}{what}{filename}
Determines the type of sound data stored in the file \var{filename}
using \function{whathdr()}. If it succeeds, returns a tuple as
described above, otherwise \code{None} is returned.
\function{whathdr()}を使って、ファイル\var{filename}に保存されたサウン
ドデータの形式を識別します。
識別可能なら上記のタプルを返し、識別できない場合は\code{None}を返しま
す 。
\end{funcdesc}
\begin{funcdesc}{whathdr}{filename}
Determines the type of sound data stored in a file based on the file
header. The name of the file is given by \var{filename}. This
function returns a tuple as described above on success, or
\code{None}.
ファイルのヘッダ情報をもとに、保存されたサウンドデータの形式を識別し
ます。
ファイル名は\var{filename}で渡されます。
識別可能なら上記のタプルを返し、識別できない場合は\code{None}を
返します。
\end{funcdesc}
--------------------------------
吉村 浩幸
DQB00103 @ nifty.ne.jp
Python-doc-jp メーリングリストの案内