| 1 | |
| 2 | <refentry id="pitch"> |
| 3 | <indexterm id="IndexPitch"><primary>pitch</primary></indexterm> |
| 4 | <refentryinfo><title>Instrument Control:Sensing and Control</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>pitch</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>pitch</refname> |
| 13 | |
| 14 | <refpurpose> |
| 15 | Tracks the pitch of a signal. |
| 16 | </refpurpose> |
| 17 | </refnamediv> |
| 18 | |
| 19 | <refsect1> |
| 20 | <title>Description</title> |
| 21 | <para> |
| 22 | 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. |
| 23 | </para> |
| 24 | </refsect1> |
| 25 | |
| 26 | <refsect1> |
| 27 | <title>Syntax</title> |
| 28 | <synopsis>koct, kamp <command>pitch</command> asig, iupdte, ilo, ihi, idbthresh [, ifrqs] [, iconf] \ |
| 29 | [, istrt] [, iocts] [, iq] [, inptls] [, irolloff] [, iskip]</synopsis> |
| 30 | </refsect1> |
| 31 | |
| 32 | <refsect1> |
| 33 | <title>Initialization</title> |
| 34 | <para> |
| 35 | <emphasis>iupdte</emphasis> -- length of period, in seconds, that outputs are updated |
| 36 | </para> |
| 37 | |
| 38 | <para> |
| 39 | <emphasis>ilo</emphasis>, <emphasis>ihi</emphasis> -- range in which pitch is detected, expressed in octave point decimal |
| 40 | </para> |
| 41 | |
| 42 | <para> |
| 43 | <emphasis>idbthresh</emphasis> -- amplitude, expressed in decibels, necessary for the pitch to be detected. Once started it continues until it is 6 dB down. |
| 44 | </para> |
| 45 | |
| 46 | <para> |
| 47 | <emphasis>ifrqs</emphasis> (optional) -- number of divisons of an octave. Default is 12 and is limited to 120. |
| 48 | </para> |
| 49 | |
| 50 | <para> |
| 51 | <emphasis>iconf</emphasis> (optional) -- the number of conformations needed for an octave jump. Default is 10. |
| 52 | </para> |
| 53 | |
| 54 | <para> |
| 55 | <emphasis>istrt</emphasis> (optional) -- starting pitch for tracker. Default value is (<emphasis>ilo</emphasis> + <emphasis>ihi</emphasis>)/2. |
| 56 | </para> |
| 57 | |
| 58 | <para> |
| 59 | <emphasis>iocts</emphasis> (optional) -- number of octave decimations in spectrum. Default is 6. |
| 60 | </para> |
| 61 | |
| 62 | <para> |
| 63 | <emphasis>iq</emphasis> (optional) -- Q of analysis filters. Default is 10. |
| 64 | </para> |
| 65 | |
| 66 | <para> |
| 67 | <emphasis>inptls</emphasis> (optional) -- number of harmonics, used in matching. Computation time increases with the number of harmonics. Default is 4. |
| 68 | </para> |
| 69 | |
| 70 | <para> |
| 71 | <emphasis>irolloff</emphasis> (optional) -- amplitude rolloff for the set of filters expressed as fraction per octave. Values must be positive. Default is 0.6. |
| 72 | </para> |
| 73 | |
| 74 | <para> |
| 75 | <emphasis>iskip</emphasis> (optional) -- if non-zero, skips initialization. Default is 0. |
| 76 | </para> |
| 77 | </refsect1> |
| 78 | |
| 79 | <refsect1> |
| 80 | <title>Performance</title> |
| 81 | <para> |
| 82 | <emphasis>koct</emphasis> -- The pitch output, given in the octave point decimal format. |
| 83 | </para> |
| 84 | |
| 85 | <para> |
| 86 | <emphasis>kamp</emphasis> -- The amplitude output. |
| 87 | </para> |
| 88 | |
| 89 | <para> |
| 90 | <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. |
| 91 | </para> |
| 92 | |
| 93 | <para> |
| 94 | 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. |
| 95 | </para> |
| 96 | </refsect1> |
| 97 | |
| 98 | <refsect1> |
| 99 | <title>Examples</title> |
| 100 | <para> |
| 101 | Here is an example of the pitch opcode. It uses the file <ulink url="examples/pitch.csd"><citetitle>pitch.csd</citetitle></ulink>. |
| 102 | |
| 103 | <example> |
| 104 | <title>Example of the pitch opcode.</title> |
| 105 | |
| 106 | |
| 107 | |
| 108 | <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> |
| 109 | <xi:include href="examples-xml/pitch.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 110 | </example> |
| 111 | </para> |
| 112 | </refsect1> |
| 113 | |
| 114 | <refsect1> |
| 115 | <title>See also</title> |
| 116 | <para><link linkend="ControlSensing"><citetitle>Sensing and Control: Tempo and Pitch estimation</citetitle></link></para> |
| 117 | </refsect1> |
| 118 | |
| 119 | <refsect1> |
| 120 | <title>Credits</title> |
| 121 | <para> |
| 122 | <simplelist> |
| 123 | <member>Author: &namejohn;</member> |
| 124 | <member>University of Bath, Codemist Ltd.</member> |
| 125 | <member>Bath, UK</member> |
| 126 | <member>April 1999</member> |
| 127 | </simplelist> |
| 128 | </para> |
| 129 | |
| 130 | <para>New in Csound version 3.54</para> |
| 131 | </refsect1> |
| 132 | </refentry> |