Debian Codegraph @

docs/manual/Get_frame_number_from_time___.html

raw
1 <html><head><meta name="robots" content="index,follow"><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
2 <title>Get frame number from time...</title>
3 <style>
4 td { padding-left: 5pt; padding-right: 5pt; }
5 th { padding-left: 5pt; padding-right: 5pt; }
6 code { white-space: pre-wrap; }
7 dd { white-space: pre-wrap; }
8 </style>
9 </head><body bgcolor="#FFFFFF">
10
11 <table border=0 cellpadding=0 cellspacing=0><tr><td bgcolor="#CCCC00"><table border=4 cellpadding=9><tr><td align=middle bgcolor="#000000"><font face="Palatino,Times" size=6 color="#999900"><b>
12 Get frame number from time...
13 </b></font></table></table>
14 <p>A command that becomes available in the <a href="Query_submenu.html">Query submenu</a> if you select a sound-analysis object that is a function of time and that is evenly sampled in time (<a href="Pitch.html">Pitch</a>, <a href="Formant.html">Formant</a>, <a href="Intensity.html">Intensity</a>, <a href="Harmonicity.html">Harmonicity</a>).</p>
15 <p>The Info window will tell you the frame number belonging to the time that you specify. The result is presented as a real number.</p>
16 <h2>Setting</h2>
17 <dl>
18 <dt><b>Time (s)</b>
19 <dd>the time (in seconds) for which you want to know the frame number.</dd>
20 </dl>
21 <h2>Example</h2>
22 <p>If the Pitch object has a time step of 10 ms, and the first frame is centred around 18 ms, the frame number associated with a time of 0.1 seconds is 9.2.</p>
23 <h2>Scripting</h2>
24 <p>You can use this command to put the nearest frame centre into a script variable:</p>
25 <code> selectObject: "Pitch hallo"<br></code>
26 <code> frame = Get frame number from time... 0.1<br></code>
27 <code> nearestFrame = round (frame)<br></code>
28 <p>In this case, the value will not be written into the Info window. To round down or up, use</p>
29 <code> leftFrame = floor (frame)<br></code>
30 <code> rightFrame = ceiling (frame)<br></code>
31 <h2>Algorithm</h2>
32 <p>the result is</p>
33 <table width="100%" style="white-space:pre-wrap"><tr><td align=middle>1 + (<i>time</i> &#8211; <i>t</i><sub>1</sub>) / &#916;<i>t</i></table>
34 <p>where <i>t</i><sub>1</sub> is the time associated with the centre of the first frame, and &#916;<i>t</i> is the time step.</p>
35 <h2>Details for hackers</h2>
36 <p>If you select one of the above objects and click <a href="Inspect.html">Inspect</a>, you can see how the relation between frame numbers and times is stored in the object: <i>t</i><sub>1</sub> is the <b>x1</b> attribute, and &#916;<i>t</i> is the <b>dx</b> attribute.</p>
37 <hr>
38 <address>
39 <p>© ppgb 20221202</p>
40 </address>
41 </body>
42 </html>