help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: wavread problems


From: Doug Stewart
Subject: Re: wavread problems
Date: Wed, 11 May 2005 13:26:25 -0500
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

John W. Eaton wrote:

On 11-May-2005, Doug Stewart wrote:

| I have been working at fixing wavread, and I have run into a snag.
| | I am running Andy Adler's port 2.1.42 and | | cygwin with 2.1.50 | | In 2.1.42 this code works | | | % read riff chunk ChunkID 4 bytes
| RIFF_str=char(fread(fid,4,'uchar'));
| if (strcmp(RIFF_str,'RIFF')==0)
|   fclose(fid);
|   error(sprintf('%s is not a WAV file',wavefile));
| end
| | but in 2.1.50 it doesn't
| but this does
| | % read riff chunk ChunkID 4 bytes
| RIFF_str=char(fread(fid,4,'uchar'));
| if (strcmp(RIFF_str','RIFF')==0)
|   fclose(fid);
|   error(sprintf('%s is not a WAV file',wavefile));
| end
| | I had to transpose the RIFF_str for the strcmp to work. | | So my question is
| 1 - is this a windows problem?
| 2 - did strcmp change  or char change?
| 3 - more importantly what way does the latest version work?

For compatibility, fread returns a column vector, even if the result
is a character string.  But you could also write

 char (fread (fid, [1, 4], "uchar"))

if you want a row vector.

BTW, you can write

 error ("%s is not a WAV file", wavefile);

instead of using sprintf because the error function processes
arguments the same as printf.

jwe



thanks this fixed it

char (fread (fid, [1, 4], "uchar"))

It is still interesting that the same code acts differently fro 2.1.42 and 2.1.50

Ok the wavread.m is redy for testing/release
It has some 24 bit code in it that I can't test but
Robert A. Macy has used it.


you can get it at

http://dougs.homeip.net/octave/wavread.m
Doug Stewart






-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]