Hello,
is it possible to compute with an Xpath query (or using any other XML tool) the total duration of a .aup file ?
Best regards,
Michel
file duration
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
Re: file duration
Not easily.
Audacity Projects may contain multiple audio clips in the same track, each with a start position offset.
You would need to identify the final audio clip (<sequence> ... </sequence>) in a track and its offset value, then add together the offset time with the sequence "numsamples" converted to seconds, then repeat for each track in the project and output the largest value.
Audacity Projects may contain multiple audio clips in the same track, each with a start position offset.
You would need to identify the final audio clip (<sequence> ... </sequence>) in a track and its offset value, then add together the offset time with the sequence "numsamples" converted to seconds, then repeat for each track in the project and output the largest value.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
Re: file duration
Thanks for your answer Steve.
The files I deal with contain only one audio clip, so it should make the things simpler. However , I have difficulties to figure out how to perform the computation you propose.
Can you please give an example on the file below (the actual duration is around 71s) ?
Best
M.
The files I deal with contain only one audio clip, so it should make the things simpler. However , I have difficulties to figure out how to perform the computation you propose.
Can you please give an example on the file below (the actual duration is around 71s) ?
Best
M.
steve wrote:Not easily.
Audacity Projects may contain multiple audio clips in the same track, each with a start position offset.
You would need to identify the final audio clip (<sequence> ... </sequence>) in a track and its offset value, then add together the offset time with the sequence "numsamples" converted to seconds, then repeat for each track in the project and output the largest value.
Code: Select all
<?xml version="1.0" standalone="no"?>
<!DOCTYPE project PUBLIC "-//audacityproject-1.3.0//DTD//EN" "http://audacityteam.org/xml/audacityproject-1.3.0.dtd">
<project xmlns="http://audacityteam.org/xml/" projname="020_data" version="1.3.0" audacityversion="1.3.13-beta" sel0="28.1890249433" sel1="28.1890249433" vpos="0" h="25.0311111111" zoom="86.1328125000" rate="44100.0">
<tags/>
<wavetrack name="Mixer" channel="2" linked="0" mute="0" solo="0" height="150" minimized="0" rate="44100" gain="1.0" pan="0.0">
<waveclip offset="0.00000000">
<sequence maxsamples="262144" sampleformat="262159" numsamples="3150747">
<waveblock start="0">
<simpleblockfile filename="e00007fe.au" len="262144" min="-0.216187" max="0.250671" rms="0.043167"/>
</waveblock>
<waveblock start="262144">
<simpleblockfile filename="e0000661.au" len="262144" min="-0.186707" max="0.284424" rms="0.057777"/>
</waveblock>
<waveblock start="524288">
<simpleblockfile filename="e0000730.au" len="262144" min="-0.188629" max="0.315247" rms="0.049921"/>
</waveblock>
<waveblock start="786432">
<simpleblockfile filename="e000080f.au" len="262144" min="-0.315643" max="0.349243" rms="0.050288"/>
</waveblock>
<waveblock start="1048576">
<simpleblockfile filename="e0000de9.au" len="262144" min="-0.243683" max="0.396942" rms="0.058242"/>
</waveblock>
<waveblock start="1310720">
<simpleblockfile filename="e00003db.au" len="262144" min="-0.212891" max="0.338654" rms="0.05351"/>
</waveblock>
<waveblock start="1572864">
<simpleblockfile filename="e00000d2.au" len="262144" min="-0.279816" max="0.368225" rms="0.058814"/>
</waveblock>
<waveblock start="1835008">
<simpleblockfile filename="e00005a2.au" len="262144" min="-0.248749" max="0.283569" rms="0.051571"/>
</waveblock>
<waveblock start="2097152">
<simpleblockfile filename="e00003d1.au" len="262144" min="-0.236389" max="0.297821" rms="0.059904"/>
</waveblock>
<waveblock start="2359296">
<simpleblockfile filename="e0000c2b.au" len="262144" min="-0.240967" max="0.298462" rms="0.048832"/>
</waveblock>
<waveblock start="2621440">
<simpleblockfile filename="e0000815.au" len="262144" min="-0.221466" max="0.321503" rms="0.04221"/>
</waveblock>
<waveblock start="2883584">
<simpleblockfile filename="e0000467.au" len="262144" min="-0.224884" max="0.252655" rms="0.044508"/>
</waveblock>
<waveblock start="3145728">
<simpleblockfile filename="e0000a5d.au" len="5019" min="-0.00824" max="0.006683" rms="0.000828"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
</wavetrack>
</project>
Re: file duration
Here's the relevant part of the file:
The sample rate is 44100 Hz.
The offset is 0.00000000
The number of samples is 3150747
To calculate the length:
offset + (numsamples / sample rate)
0.000000 + (3150747 / 44100)
= 71.445510204 seconds.
Code: Select all
<wavetrack name="Mixer" channel="2" linked="0" mute="0" solo="0" height="150" minimized="0" rate="44100" gain="1.0" pan="0.0">
<waveclip offset="0.00000000">
<sequence maxsamples="262144" sampleformat="262159" numsamples="3150747">The offset is 0.00000000
The number of samples is 3150747
To calculate the length:
offset + (numsamples / sample rate)
0.000000 + (3150747 / 44100)
= 71.445510204 seconds.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
Re: file duration
Great help, Steve !
Thanks a lot.
Michel
Thanks a lot.
Michel
steve wrote:Here's the relevant part of the file:The sample rate is 44100 Hz.Code: Select all
<wavetrack name="Mixer" channel="2" linked="0" mute="0" solo="0" height="150" minimized="0" rate="44100" gain="1.0" pan="0.0"> <waveclip offset="0.00000000"> <sequence maxsamples="262144" sampleformat="262159" numsamples="3150747">
The offset is 0.00000000
The number of samples is 3150747
To calculate the length:
offset + (numsamples / sample rate)
0.000000 + (3150747 / 44100)
= 71.445510204 seconds.