Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: English - Français - Português - Русский
Scilabヘルプ >> Sound file handling > wavread

wavread

.wav サウンドファイルを読み込む

呼び出し手順

Info = wavread(wavfile, 'info')
s = wavread(wavfile, 'size')
y = wavread(wavfile)
y = wavread(wavfile, n)
y = wavread(wavfile, [i1 i2])
[y, Fs, bits] = wavread(..)

引数

wavfile

文字列. Included heading constant strings SCI, TMPDIR, SCIHOME, or home are automatically expanded. 拡張子が指定されない場合,拡張子 .wav が追加されます.

n

positive integer: number of first samples to get, per channel.

[i1 i2]

positive integers, to select and return from each channel the samples #i1 to #i2.

y

Matrix: values of sound amplitudes in [-1,+1], with one row per channel.

Fs

integer: sampling frequency in Hz = number of samples per second per channel.

bits

Positive integer: number of bits for y values.

Info

Row vector of 8 decimal integers describing the recorded signal. See the description section for details.

説明

.wavサウンドファイルを読み込む ユーティリティ関数. wavread(wavfile) は文字列wavfileで 指定されたサウンドファイルを読み込み,サンプルデータをyに返します. 大きさは [-1,+1]の範囲となります. 以下の形式の多チャネルデータをサポートします: 8-, 16-, および 32ビット,線形, および浮動小数点.

[y,Fs,bits]=wavread(wavfile) は, ファイル中のデータをエンコードする際に使用された サンプルレート(Fs) (単位:Hz),ビット数/サンプルを返します.

wavread(wavfile,n)は各チャネルの最初のnサンプルを 返します.

wavread(wavfile,[n1,n2]) はサンプル n1 から n2までを返します.

wavread(wavfile,'size') は, ファイル中に含まれるオーディオデータの大きさを [チャネル サンプル] のベクトルとして返します.

wavread(wavfile,'info') returns information about the audio data contained in the file, instead of the actual audio data, returning a row vector with the following components:

(1) encoding code: AKA format category: positive integer = standard id of the type of data encoding. Supported formats: 1 (PCM), 3 (normalized floating point).
(2) number of channels: Number of simultaneous single-valued collected signals = size(y,1).
(3) sampling frequency: number of samples recorded for each channel, per second.
(4) average bytes per second: For plain PCM it is the sampling rate multiplied by the number of channels and the number of bytes per sample. For compressed formats it is approximately the total data length in bytes divided by the duration of the sound.
(5) block alignment: The number of bytes associated with each sampling instant. For the plain PCM uncompressed format, it is equal to the number of channels multiplied by the number of bytes per channel.
(6) bits per sample (per channel): Number of bits used to quantize each value of the sound amplitude.
(7) bytes per sample (per channel): Number of bytes assigned to each individual value of the sound amplitude.
(8) length of sound data (per channel): The total number of samples on each channel = size(y,2). Hence, the record's duration is Info(8)/Info(3).

File = "SCI/modules/sound/demos/chimes.wav";
wavread(File, "size")
wavread(File, "info")
y = wavread(File, 5)     // 最初の5サンプル
y = wavread(File, [4 7]) // only samples #4 to #7
[y, Fs, bits] = wavread(File); Fs, bits
clf
subplot(2,1,1)
plot2d(y(1,:)) // 最初のチャネル
subplot(2,1,2)
plot2d(y(2,:)) // 2番目のチャネル
--> wavread(File, "size")
 ans  =
   2.   13921.

--> wavread(File, "info")
 ans  =
   1.   2.   22050.   88200.   4.   16.   2.   13921.

--> y = wavread(File, 5)     // the first five samples
 y  =
   0.000061    0.0002747   0.0002136   0.0001526   0.0000916
   0.0000916   0.0001831   0.000061    0.          0.0000916

--> y = wavread(File, [4 7]) // only samples #4 to #7
 y  =
   0.0001526   0.0000916   0.0000305  -0.0000305
   0.          0.0000916   0.000061    0.0000916

--> [y, Fs, bits] = wavread(File); Fs, bits
 Fs  =
   22050.

 bits  =
   16.

参照

Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Feb 25 08:53:23 CET 2020