Vamp Plugins Forum
May 21, 2012, 19:33:02 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Get the length of audio file  (Read 732 times)
grh
Newbie
*
Posts: 9


View Profile WWW
« on: November 17, 2010, 08:56:06 »

Hallo!

Is it possible to get the length of the audio file which I want to analyze ?

In one algorithm I want to analyze the whole audio file at once and now I am thinking about a good way to do it:
a) I could set the blocksize to the length of the whole audio file (therefore I would need the length of the file)
b) or process the file in small blocks, save them and call getRemainingFeatures at the end

But also in b) I need the file length, because it would be nice to allocate the big buffer arrays before (and not always resize them each block).

Thanks for any hints how this could be achieved in a nice way,
LG
Georg

PS: I am using python/vampy, but I guess the same problem is valid for C++ plugins ...
Logged

cannam
Administrator
Full Member
*****
Posts: 189


View Profile
« Reply #1 on: November 19, 2010, 14:31:56 »

Hello there.

You can't get the length of the audio file ahead of processing it -- apart from anything else, the host does not necessarily know it (it could be reading from a stream, though most existing hosts use files).

You therefore need to take option (b), and work out the length of the file yourself by counting the frames that are passed to process() calls.


Chris
Logged
grh
Newbie
*
Posts: 9


View Profile WWW
« Reply #2 on: November 19, 2010, 17:38:18 »

Ok, that's sad .. then I have to reallocate the big buffer array all the time, because I don't know how big the file will be ...

However, thanks for the information and have a good weekend,
LG
Georg
Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.14 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!