[mirtoolbox] Re: miraudio(..., 'Extract') reads entire song?

  • From: Cheng-ya Sha <ads901119@xxxxxxxxx>
  • To: mirtoolbox@xxxxxxxxxxxxx
  • Date: Mon, 11 Jun 2012 22:38:30 +0800

Hi Oliver,

This is the serious part of my code,

miraudio(filename,'Extract',0,30,'s','Sampling',22050,'Normal');
r = mirfeatures(a);

X = zeros(1,N);
idx = 1;

data = mirgetdata(r.fluctuation.peak); if any(isnan(data)) data=-1; end
X(idx) = data; idx = idx + 1;
data = mirgetdata(r.fluctuation.centroid); if isempty(data) data=-1; end
                X(idx) = data; idx = idx + 1;

...
repeat filling data into X


The error occurs before mirfeatures() and it reads:

Here are the error message returned by each reader:
> Error using wavread (line 165)
> Not a WAVE file.
> Error using auread>read_sndhdr (line 91)
> Not a NeXT/Sun sound file.
> Error using wavread (line 165)
> Out of memory. Type HELP MEMORY for your options.
> Error using aiffread (line 127)
> Unknown file extension '.mp3'.



ans =
> ERROR using MIRREAD: Cannot open file D:\project\music\test.mp3



I also found that the tmp wav file generated by mp3read is 579MB while the
original mp3 file is only 52.5 MB.
It's strange, maybe a bug of mpg123?


Sincerely,
Alan


On Mon, Jun 11, 2012 at 6:17 PM, Olivier Lartillot <olartillot@xxxxxxxxx>wrote:

> Hi Alan,
>
> No, the file is not read entirely. mpg123 is called with the specified
> temporal region that was specified by 'Extract'. So the temporary wav file
> just contains the desired part.
>
>   % Run the decode
>   cmd=['"',mpg123,'"', downsampstr, chansstr, skipstr, lenstr, ...
>        ' -q -w "', tmpfile,'"  "',FILE,'"'];
>   %w =
>   mysystem(cmd);
>
>
> skipstr skips the blocks before the part, lenstr takes just what we need
> in the selected region.
>
> So I still don't understand why you have memory problem. Could you show me
> the whole mirtoolbox script you use?
>
> Regards,
>
> Olivier
>
> On 11.6.2012, at 11.53, Cheng-ya Sha wrote:
>
> Hi Oliver,
>
> I use miraudio(filename,'Extract',0,30,'s','Sampling',22050,'Normal');
>
> When I looked into the source code of mp3read, I found that it uses mpg123 to
> convert mp3 into wav, and then wavread the entire converted wav into
> Matlab. Finally it extracts the desired part.
> It explains all...
>
> Thanks for your reply!
>
>
> Sincerely,
> Alan
>
> On Mon, Jun 11, 2012 at 5:42 PM, Olivier Lartillot 
> <olartillot@xxxxxxxxx>wrote:
>
>> Hi,
>>
>> miraudio('filename','Extract',...) should read just the specified part of
>> filename, not the entire file.
>>
>> What is exactly the miraudio command you use?
>>
>> Cheers,
>>
>> Olivier
>>
>> On 11.6.2012, at 3.39, Cheng-ya Sha wrote:
>>
>> Hi all,
>>
>> Does miraudio(..., 'Extract') read the *entire *song and then clip the
>> part specified in the arguments? Or does it just read part of the song
>> specified in the arguments?
>> Is it the same for both .wav and .mp3?
>>
>> I have this question because when I use miraudio to read the first 30
>> seconds of a very long mp3 file, the memory usage of MATLAB rises
>> dramatically and finally I got out of memory error. However if the mp3 file
>> is shorter there won't be this kind of problem.
>>
>> Thanks very much for your reply in advance!
>>
>>
>> Sincerely,
>> Alan Sha
>>
>>
>>
>
>

Other related posts: