create loop for auload

View: New views
2 Messages — Rating Filter:   Alert me  

create loop for auload

by maolivar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hi,
 
 
I'm a student and i want to create a routine "m-file" to be able to read all the  "wav" files  that I have in my current directory. I found auload to do it like this:
 
payload = auload("audio.wav");
save audio.mat payload
auplot(payload);
 
but i want to create a loop or mayba change the fonction auload i mean in place to accept the name of the file, can accept a variable in order to read all wav files. Does anybody knows how can i do it?
 
Thanks
 
Miguel

Explore the seven wonders of the world Learn more!
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www.cae.wisc.edu/mailman/listinfo/help-octave

Re: create loop for auload

by Ben Abbott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On May 9, 2008, at 8:14 AM, miguel olivares varela wrote:

> Hi,
>
> I'm a student and i want to create a routine "m-file" to be able to  
> read all the  "wav" files  that I have in my current directory. I  
> found auload to do it like this:
>
> payload = auload("audio.wav");
> save audio.mat payload
> auplot(payload);
>
> but i want to create a loop or mayba change the fonction auload i  
> mean in place to accept the name of the file, can accept a variable  
> in order to read all wav files. Does anybody knows how can i do it?
>
> Thanks

I haven't tested it, but is this the sort of thing you're looking for?

function [wavdata] = auloadfiles(filter)
   if (nargin < 1)
     filter = "*.wav";
   endif
   wavfiles = dir (filter);
   N = numel(wavfiles);
   wavdata(N).name = "";
   wavdata(N).data = [];
   wavdata(N).rate = 0
   wavdata(N).fmt  = "";
   for n = 1:N
     wavdata(n).name = wavfiles(n).name;
     [wavdata(n).data, wavdata(n).rate, wavdata.fmt] = auload  
(wavdata(n).name);
   endfor
endfunction

Ben
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www.cae.wisc.edu/mailman/listinfo/help-octave
LightInTheBox - Buy quality products at wholesale price