Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.2 - Français

Change language to:
English - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Aide de Scilab >> Sons - fichiers audio > wavread

wavread

load .wav sound file

Syntax

y=wavread(wavfile)
y=wavread(wavfile,ext)
[y,Fs,bits]=wavread(wavfile)
[y,Fs,bits]=wavread(wavfile,ext)

Arguments

wavfile

string (The .wav extension is appended if no extension is given)

Fs

integer, frequency sampling in Hz (number of samples per second).

ext

string ('size') or string('info') or integer (to read n samples) or 1 x 2 integer vector [n1,n2] (to read from n1 to n2).

Description

Utility function to read .wav sound file. wavread(wavfile) loads a sound file specified by the string wavfile, returning the sampled data in y. Amplitude values are in the range [-1,+1]. Supports multi-channel data in the following formats: 8-bit mu-law, 8-, 16-, and 32-bit linear, and floating point.

[y,Fs,bits]=wavread(wavfile) returns the sample rate (Fs) in Hertz and the number of bits per sample used to encode the data in the file.

wavread(wavfile,n) returns the first n samples from each channel.

wavread(wavfile,[n1,n2]) returns samples n1 to n2.

wavread(wavfile,'size') returns the size of the audio data contained in the file in place of the actual audio data, returning the vector as [channels samples].

wavread(wavfile,'info') returns information about the audio data contained in the file in place of the actual audio data, returning the vector as [data format, number of channels, samples per second per channel, estimate of bytes per second needed, byte alignment of a basic sample block, bits per sample, length of sound data in bytes, bytes per sample (per channel)].

Examples

wavread("SCI/modules/sound/demos/chimes.wav","size")
[y,Fs,bits]=wavread("SCI/modules/sound/demos/chimes.wav");Fs,bits
subplot(2,1,1)
plot2d(y(1,:)) // first channel
subplot(2,1,2)
plot2d(y(2,:)) // second channel
y=wavread("SCI/modules/sound/demos/chimes.wav",[1 5]) //the first five samples

See also

  • auread — load .au sound file
  • savewave — save data into a sound wav file.
  • analyze — frequency plot of a sound signal
  • mapsound — Plots a sound map
Report an issue
<< soundsec Sons - fichiers audio wavwrite >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Feb 14 14:59:59 CET 2019