| 1 | |
| 2 | <refentry id="semitone"> |
| 3 | <indexterm id="IndexSemitone"><primary>semitone</primary></indexterm> |
| 4 | <refentryinfo><title>Pitch Converters:Functions</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>semitone</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>semitone</refname> |
| 13 | <refpurpose> |
| 14 | Calculates a factor to raise/lower a frequency by a given amount of semitones. |
| 15 | </refpurpose> |
| 16 | </refnamediv> |
| 17 | |
| 18 | <refsect1> |
| 19 | <title>Description</title> |
| 20 | <para> |
| 21 | Calculates a factor to raise/lower a frequency by a given amount of semitones. |
| 22 | </para> |
| 23 | </refsect1> |
| 24 | |
| 25 | <refsect1> |
| 26 | <title>Syntax</title> |
| 27 | <synopsis><command>semitone</command>(x)</synopsis> |
| 28 | |
| 29 | <para> |
| 30 | This function works at a-rate, i-rate, and k-rate. |
| 31 | </para> |
| 32 | </refsect1> |
| 33 | |
| 34 | <refsect1> |
| 35 | <title>Initialization</title> |
| 36 | <para> |
| 37 | <emphasis>x</emphasis> -- a value expressed in semitones. |
| 38 | </para> |
| 39 | </refsect1> |
| 40 | |
| 41 | <refsect1> |
| 42 | <title>Performance</title> |
| 43 | <para> |
| 44 | The value returned by the <emphasis>semitone</emphasis> function is a factor. You can multiply a frequency by this factor to raise/lower it by the given amount of semitones. |
| 45 | </para> |
| 46 | </refsect1> |
| 47 | |
| 48 | <refsect1> |
| 49 | <title>Examples</title> |
| 50 | <para> |
| 51 | Here is an example of the semitone opcode. It uses the file <ulink url="examples/semitone.csd"><citetitle>semitone.csd</citetitle></ulink>. |
| 52 | <example> |
| 53 | <title>Example of the semitone opcode.</title> |
| 54 | <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> |
| 55 | <xi:include href="examples-xml/semitone.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 56 | </example> |
| 57 | Its output should include lines like: |
| 58 | <screen> |
| 59 | i1 880.00000 |
| 60 | i1 2.00000 |
| 61 | i1 830.65625 |
| 62 | i1 1.88786 |
| 63 | i1 783.94665 |
| 64 | i1 1.78170 |
| 65 | i1 739.98885 |
| 66 | i1 1.68179 |
| 67 | i1 698.49586 |
| 68 | i1 1.58749 |
| 69 | i1 659.21793 |
| 70 | i1 1.49822 |
| 71 | i1 622.25397 |
| 72 | i1 1.41421 |
| 73 | i1 587.36267 |
| 74 | i1 1.33492 |
| 75 | i1 554.33399 |
| 76 | i1 1.25985 |
| 77 | i1 523.25113 |
| 78 | i1 1.18921 |
| 79 | i1 493.91116 |
| 80 | i1 1.12253 |
| 81 | i1 466.13747 |
| 82 | i1 1.05940 |
| 83 | i1 440.00000 |
| 84 | i1 1.00000 |
| 85 | ....... |
| 86 | </screen> |
| 87 | </para> |
| 88 | </refsect1> |
| 89 | |
| 90 | <refsect1> |
| 91 | <title>See also</title> |
| 92 | <para><link linkend="PitchFuncs"><citetitle>Pitch Converters: Functions</citetitle></link></para> |
| 93 | </refsect1> |
| 94 | |
| 95 | <refsect1> |
| 96 | <title>Credits</title> |
| 97 | <para>New in version 4.16</para> |
| 98 | </refsect1> |
| 99 | </refentry> |