summaryrefslogtreecommitdiff
path: root/opcodes/pitch.xml
blob: 07d67434dded3a5d6fd07e60eb768e0fcb292d0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<refentry id="pitch">
<indexterm id="IndexPitch"><primary>pitch</primary></indexterm>
  <refentryinfo><title>Instrument Control:Sensing and Control</title></refentryinfo>
  <refmeta>
    <refentrytitle>pitch</refentrytitle>
  </refmeta>


 
  <refnamediv>
    <refname>pitch</refname>

    <refpurpose>
      Tracks the pitch of a signal.
          </refpurpose>
  </refnamediv>
 
  <refsect1>
    <title>Description</title>
    <para>
      Using the same techniques as <link linkend="spectrum"><citetitle>spectrum</citetitle></link> and <link linkend="specptrk"><citetitle>specptrk</citetitle></link>, pitch tracks the pitch of the signal in octave point decimal form, and amplitude in dB.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis>koct, kamp <command>pitch</command> asig, iupdte, ilo, ihi, idbthresh [, ifrqs] [, iconf] \
      [, istrt] [, iocts] [, iq] [, inptls] [, irolloff] [, iskip]</synopsis> 
  </refsect1>
 
  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>iupdte</emphasis> -- length of period, in seconds, that outputs are updated
    </para>

    <para>
      <emphasis>ilo</emphasis>, <emphasis>ihi</emphasis> -- range in which pitch is detected, expressed in octave point decimal
    </para>

    <para>
      <emphasis>idbthresh</emphasis> -- amplitude, expressed in decibels, necessary for the pitch to be detected.  Once started it continues until it is 6 dB down.
    </para>

    <para>
      <emphasis>ifrqs</emphasis> (optional) -- number of divisons of an octave. Default is 12 and is limited to 120.
    </para>

    <para>
      <emphasis>iconf</emphasis> (optional) -- the number of conformations needed for an octave jump.  Default is 10. 
    </para>

    <para>
      <emphasis>istrt</emphasis> (optional) -- starting pitch for tracker. Default value is (<emphasis>ilo</emphasis> + <emphasis>ihi</emphasis>)/2.
    </para>

    <para>
      <emphasis>iocts</emphasis> (optional) -- number of octave decimations in spectrum. Default is 6.
    </para>

    <para>
      <emphasis>iq</emphasis> (optional) -- Q of analysis filters. Default is 10.
    </para>

    <para>
      <emphasis>inptls</emphasis> (optional) -- number of harmonics, used in matching. Computation time increases with the number of harmonics. Default is 4.
    </para>

    <para>
      <emphasis>irolloff</emphasis> (optional) -- amplitude rolloff for the set of filters expressed as fraction per octave. Values must be positive. Default is 0.6.
    </para>

    <para>
      <emphasis>iskip</emphasis> (optional) -- if non-zero, skips initialization. Default is 0.
    </para>
  </refsect1>

  <refsect1>
    <title>Performance</title>
    <para>
      <emphasis>koct</emphasis> -- The pitch output, given in the octave point decimal format.
    </para>

    <para>
      <emphasis>kamp</emphasis> -- The amplitude output.
    </para>

    <para>
      <emphasis>pitch</emphasis> analyzes the input signal, <emphasis>asig</emphasis>, to give a pitch/amplitude pair of outputs, for the strongest frequency in the signal. The value is updated every <emphasis>iupdte</emphasis> seconds.
    </para>

    <para>
      The number of partials and rolloff fraction can effect the pitch tracking, so some experimentation may be necessary. Suggested values are 4 or 5 harmonics, with rolloff 0.6, up to 10 or 12 harmonics with rolloff 0.75 for complex timbres, with a weak fundamental.
    </para>
  </refsect1>

  <refsect1>
    <title>Examples</title>
    <para>
      Here is an example of the pitch opcode. It uses the file <ulink url="examples/pitch.csd"><citetitle>pitch.csd</citetitle></ulink> and <ulink url="examples/mary.wav"><citetitle>mary.wav</citetitle></ulink>.

      <example>
        <title>Example of the pitch opcode.</title>

        

        <para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para>
          <xi:include href="examples-xml/pitch.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
      </example>
    </para>
  </refsect1>

  <refsect1>
    <title>Credits</title>
    <para>
      <simplelist>
        <member>Author: &namejohn;</member>
        <member>University of Bath, Codemist Ltd.</member>
        <member>Bath, UK</member>
        <member>April 1999</member>
      </simplelist>
    </para>
    <para>Example written by &namekevin;.</para>

    <para>New in Csound version 3.54</para>
  </refsect1>
</refentry>