Debian Codegraph @

docs/manual/Script_for_analysing_pitch_with_a_TextGrid.html

raw
1 <html><head><meta name="robots" content="index,follow"><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
2 <title>Script for analysing pitch with a TextGrid</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 Script for analysing pitch with a TextGrid
13 </b></font></table></table>
14 <p>"I want the mean pitch of every interval that has a non-empty label on tier 5."</p>
15 <code> if numberOfSelected ("Sound") &lt;&gt; 1 or numberOfSelected ("TextGrid") &lt;&gt; 1<br></code>
16 <code> exitScript: "Please select a Sound and a TextGrid first."<br></code>
17 <code> endif<br></code>
18 <code> sound = selected ("Sound")<br></code>
19 <code> textgrid = selected ("TextGrid")<br></code>
20 <code> writeInfoLine: "Result:"<br></code>
21 <code> selectObject: sound<br></code>
22 <code> pitch = To Pitch: 0.0, 75, 600<br></code>
23 <code> selectObject: textgrid<br></code>
24 <code> n = Get number of intervals: 5<br></code>
25 <code> for i to n<br></code>
26 <code> tekst$ = Get label of interval: 5, i<br></code>
27 <code> if tekst$ &lt;&gt; ""<br></code>
28 <code> t1 = Get starting point: 5, i<br></code>
29 <code> t2 = Get end point: 5, i<br></code>
30 <code> selectObject: pitch<br></code>
31 <code> f0 = Get mean: t1, t2, "Hertz"<br></code>
32 <code> appendInfoLine: fixed$ (t1, 3), " ", fixed$ (t2, 3), " ", round (f0), " ", tekst$<br></code>
33 <code> selectObject: textgrid<br></code>
34 <code> endif<br></code>
35 <code> endfor<br></code>
36 <code> selectObject: sound, textgrid<br></code>
37 <h3>Links to this page</h3>
38 <ul>
39 <li><a href="Scripting_examples.html">Scripting examples</a>
40 </ul>
41 <hr>
42 <address>
43 <p>© ppgb 20201229</p>
44 </address>
45 </body>
46 </html>