help-octave
[Top][All Lists]
Advanced

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

Urgent help required..plzz comment


From: Sengupta Sourav
Subject: Urgent help required..plzz comment
Date: Tue, 17 Apr 2001 11:30:32 -0700 (PDT)

URGENT HELP REQUIRED EVERYBODY..
Sir,

I installed matcompat functions in etc..

so now if i run octave(2.0.16) as root all functions
get accessed from there..however the main problem i'm
facing is i loaded the wavread.m file you had sent
me...its reproduced below.. i copid it into the
/usr/local/share/octave/2.0.16/m /audio directory

i can access it but when i run the debugf file
attached with this mail.. i get the following error !!


octave:3> debugf
wavread is the file: /root/matcompat/audio/wavread.m

 WAVREAD  Load Microsoft Windows .WAV format sound
files.

  [sig, sf, bits] = wavread(wavfile [, siz])
   
        sig : signal
         sf : sampling freq.
       bits : the number of bits per sample
    wavfile : file name 
              (The ".wav" extension is appended if no
extension is given
        siz : 'size' returns the size of the audio
data
            : [N1 N2] returns only samples N1 through
N2


Additional help for builtin functions, operators, and
variables
is available in the on-line version of the manual. 
Use the command
`help -i <topic>' to search the manual index.

Help and information about Octave is also available on
the WWW
at http://www.che.wisc.edu/octave/octave.html and via
the
address@hidden mailing list.
error: `x' undefined near line 12 column 21
error: evaluating expression near line 12, column 21
error: evaluating argument list element number 1
error: evaluating index expression near line 12,
column 14
error: evaluating assignment expression near line 12,
column 13
error: near line 12 of file
`/root/matcompat/audio/debugf.m'
error: evaluating expression near line 3, column 1



I'm completely at my wits end, please advice me what
to do to make this script run, even the simple sound
command doesn't run..(after copying into the req.
dir.)

The debugf.m file used for ADPCM on a wav file is
attached with this mail.

Regards,

Sourav Sengupta

here's the wavread file u sent me..




> % WAVREAD  Load Microsoft Windows .WAV format sound
> files.
> %
> %  [sig, sf, bits] = wavread(wavfile [, siz])
> %   
> %        sig : signal
> %         sf : sampling freq.
> %       bits : the number of bits per sample
> %    wavfile : file name 
> %              (The ".wav" extension is appended if
> no extension is given.)
> %        siz : 'size' returns the size of the audio
> data
> %            : [N1 N2] returns only samples N1
> through N2
> 
> if nargin < 1
>   help wavread;
>   return;
> end
> 
> if isempty(findstr(wavefile,'.'))
>   wavefile=[wavefile,'.wav'];
> end
> 
> fid=fopen(wavefile,'r','ieee-le');
> if fid == -1
>   error('Can''t open .WAV file for input!');
> end;
> 
> % read riff chunk
> header=fread(fid,4,'uchar');
> header=fread(fid,1,'ulong');
> header=fread(fid,4,'uchar');
> 
> % read format sub-chunk
> header=fread(fid,4,'uchar');
> header=fread(fid,1,'ulong');
> 
> format(1)=fread(fid,1,'ushort');                %
> Format 
> format(2)=fread(fid,1,'ushort');                %
> Channel
> format(3)=fread(fid,1,'ulong');                 %
> Samples per second
> header=fread(fid,1,'ulong');
> block=fread(fid,1,'ushort');
> format(4)=fread(fid,1,'ushort');                %
> Bits per sample
> 
> % read data sub-chunck
> header=fread(fid,4,'uchar');
> nbyteforsamples=fread(fid,1,'ulong');
> 
> nsamples=nbyteforsamples/block;
> if(nargin < 2)
>   siz = [1 nsamples];
> end
> 
> sf = format(3);
> bits = format(4);
> if(strcmp(siz, 'size'))
>   sig = [nsamples, format(2)];
>   fclose(fid);
>   return;
> end
> 
> st = siz(1);
> et = siz(2);
> 
> if (format(4)+format(2) == 9)
>   fseek(fid, (st-1), 0);
>   [sig, cnt] = fread(fid, [1, et-st+1],'uchar');
>   sig = (sig-128)/128;
> end
> if (format(4)+format(2) == 10)
>   fseek(fid, (st-1)*2, 0);
>   [sig, cnt] = fread(fid, [2,et-st+1], 'uchar');
>   sig = (sig-128)/128;
> end
> 
> if (format(4)+format(2) == 17)
>   fseek(fid, (st-1)*2, 0);
>   [sig, cnt] = fread(fid, [1, et-st+1], 'short');
>   sig = sig/32768;
> end
> 
> if (format(4)+format(2) == 18)
>   fseek(fid, (st-1)*4, 0);
>   [sig, cnt] = fread(fid,[2,et-st+1],'short');
>   sig = sig/32768;
> end
> fclose(fid);
> 
> sig = sig';
> 
> _/_/_/  _/  _/            _/            _/_/       
> Akira NISHIMURA
>  _/    _/  _/            _/             | Dept. of
> Media and Cultural Studies
> _/okyo _/_/niversity of _/nformation _/_/ciences
> address@hidden
>                    http://www.rsch.tuis.ac.jp/~akira


=====
Sourav Sengupta

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/



-------------------------------------------------------------
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]