comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » reading wav files
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Reading Wav files [message #31848 is a reply to message #23347] Wed, 21 August 2002 13:24 Go to previous messageGo to previous message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Wed, 21 Aug 2002 09:08:35 -0700, Mike Alport wrote:

> This seems a trivial problem: the IDL 5.5 documentation gives the
> following syntax for reading sound .wav files: Result = READ_WAV (
> Filename [, Rate] ) So, when I try it, I get: IDL> Result = READ_WAV(
> "ramsay0150.wav" ) % Variable is undefined: READ_WAV.
>
> Have they switched the calling procedure name on us? Thanks, Mike Alport

This is probably related to the ()/[] degeneracy in IDL array indexing.
I can replicate your error:

IDL> result = read_wav('/usr/share/licq/sounds/fun/Auth.wav')
% Compiled module: READ_WAV.
IDL> read_wav=2
IDL> result = read_wav('/usr/share/licq/sounds/fun/Auth.wav')
IDL> help,result
RESULT BYTE = Array[5400]

No problem thus far.. but what if I start IDL again with:

IDL> read_wav=1
IDL> r=temporary(read_wav)
IDL> help
% At $MAIN$
I INT = 167
R INT = 1
READ_WAV UNDEFINED = <Undefined>

Uh, oh, an "undefined variable" READ_WAV exists. You can imagine what
will happen now:

IDL> result = read_wav('/usr/share/licq/sounds/fun/Auth.wav')
% Variable is undefined: READ_WAV.
% Execution halted at: $MAIN$

IDL thinks you're trying to index an undefined variable! The problem
is, variables sometimes exists as "undefined" zombies, even after you
think they're gone. In this state, that can still "shadow" or overlap
with function calls. A few options for solving the problem:

1. Find out where the undefined variable READ_WAV is getting created,
and eliminate that.

2. Use "compile_opt STRICTARR" at the beginning of your procedure, or
at the main level:

IDL> compile_opt STRICTARR
IDL> result = read_wav('/usr/share/licq/sounds/fun/Auth.wav')
% Compiled module: READ_WAV.

3. Use "forward_function READ_WAV" to declare it a function.

4. Clamor for RSI to make STRICTARR the default (though duck as Craig
throws an eraser at your head.)

You could also just put "compile_opt STRICTARR" in your startup file,
and I think it then applies to all routines and interactive commands
(anybody know for sure?).

Good luck,

JD
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Extracting arrays into txt files
Next Topic: Extracting the resultant angles from the Hough transform

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 04:50:32 PDT 2025

Total time taken to generate the page: 0.56217 seconds