May 21, 2012, 19:33:02
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Help
Search
Login
Register
Vamp Plugins Forum
>
Development Topics
>
Plugin Development
>
Get the length of audio file
Pages: [
1
]
« previous
next »
Print
Author
Topic: Get the length of audio file (Read 732 times)
grh
Newbie
Posts: 9
Get the length of audio file
«
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
http://grh.mur.at
cannam
Administrator
Full Member
Posts: 189
Re: Get the length of audio file
«
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
Re: Get the length of audio file
«
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
http://grh.mur.at
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Using Vamp Plugins and Hosts
-----------------------------
=> Getting and Using Vamp Plugins
=> Plugin and Host Announcements
=> Host Forum: Sonic Visualiser
-----------------------------
Development Topics
-----------------------------
=> Plugin Development
=> Host Development
Loading...