
See also: wavwrite WAV.wavwrite - Functionįs=8000, nbits=0, compression=0, chunks::Vector = wavwrite(y, filename, nbits=sizeof(T)*8, compression=WAVE_FORMAT_IEEE_FLOAT) Wavread(filename::AbstractString, n, fmt) = wavread(filename, subrange=n, format=fmt)Įxample y, fs, nbits, opt = wavread("example.wav")
Wavread(filename::AbstractString, n) = wavread(filename, subrange=n) The following methods are also defined to make this function compatible with MATLAB’s former wavread function: wavread(filename::AbstractString, fmt::AbstractString) = wavread(filename, format=fmt) In order to obtain the contents of the format chunk, call WAV.getformat(opt). All valid WAV files will contain a fmt chunk, with id=Symbol("fmt ") (note the trailing space). The elements in the opt vector depend on the contents of the WAV file.
opt: A vector of WAVChunk elements representing optional chunksfound in the WAV file. nbits: the number of bits used to encode each sample. y: A 2-dimensional array containing the waveform samples, where the row index represents the time axis and the colum index the channel number. The function returns a 4-tuple with elements Passing a unitrange I:J returns length(I:J) consecutive samples from each channel, starting with the I-th sample. Passing an integer N (or equivalently the range 1:N) returns the first N samples of each channel. The default ( :) returns all samples in the file. Subrange controls which samples are returned. format="size" returns a 2-tuple ( n, m) containing the number of samples 'n' and the number of channels 'm' in the file (like size(y)), rather than the regular 4-tuple (y, Fs, nbits, opt) with the actual samples in y. format="native" returns the values as encoded in the file. format="double" (default) returns double-precision floating point ( Float64) values in the range −1.0 to 1.0. The available options, and the default values, are:įormat selects the form of data returned: The samples are converted to floating point values in the range −1.0 to 1.0 by default. Wavread(filename::AbstractString subrange=:, format="double") Wavread(io::IO subrange=:, format="double")