| 1 | |
| 2 | <refentry id="fof2"> |
| 3 | <indexterm id="IndexFof2"><primary>fof2</primary></indexterm> |
| 4 | <refentryinfo><title>Signal Generators:Granular Synthesis</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>fof2</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>fof2</refname> |
| 11 | <refpurpose> |
| 12 | Produces sinusoid bursts including k-rate incremental indexing with each successive burst. |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para> |
| 19 | Audio output is a succession of sinusoid bursts initiated at frequency <emphasis>xfund</emphasis> with a spectral peak at <emphasis>xform</emphasis>. For <emphasis>xfund</emphasis> above 25 Hz these bursts produce a speech-like formant with spectral characteristics determined by the k-input parameters. For lower fundamentals this generator provides a special form of granular synthesis. |
| 20 | </para> |
| 21 | |
| 22 | <para> |
| 23 | <emphasis>fof2</emphasis> implements k-rate incremental indexing into <emphasis>ifna</emphasis> function with each successive burst. |
| 24 | </para> |
| 25 | </refsect1> |
| 26 | |
| 27 | <refsect1> |
| 28 | <title>Syntax</title> |
| 29 | <synopsis>ares <command>fof2</command> xamp, xfund, xform, koct, kband, kris, kdur, kdec, iolaps, \ |
| 30 | ifna, ifnb, itotdur, kphs, kgliss [, iskip]</synopsis> |
| 31 | </refsect1> |
| 32 | |
| 33 | <refsect1> |
| 34 | <title>Initialization</title> |
| 35 | <para> |
| 36 | <emphasis>iolaps</emphasis> -- number of preallocated spaces needed to hold overlapping burst data. Overlaps are frequency dependent, and the space required depends on the maximum value of <emphasis>xfund * kdur</emphasis>. Can be over-estimated at no computation cost. Uses less than 50 bytes of memory per <emphasis>iolap</emphasis>. |
| 37 | </para> |
| 38 | |
| 39 | <para> |
| 40 | <emphasis>ifna, ifnb</emphasis> -- table numbers of two stored functions. The first is a sine table for sineburst synthesis (size of at least 4096 recommended). The second is a rise shape, used forwards and backwards to shape the sineburst rise and decay; this may be linear (<link linkend="GEN07"><citetitle>GEN07</citetitle></link>) or perhaps a sigmoid (<link linkend="GEN19"><citetitle>GEN19</citetitle></link>). |
| 41 | </para> |
| 42 | |
| 43 | <para> |
| 44 | <emphasis>itotdur</emphasis> -- total time during which this <emphasis>fof</emphasis> will be active. Normally set to p3. No new sineburst is created if it cannot complete its <emphasis>kdur</emphasis> within the remaining <emphasis>itotdur</emphasis>. |
| 45 | </para> |
| 46 | |
| 47 | <para> |
| 48 | <emphasis>iskip</emphasis> (optional, default=0) -- If non-zero, skip initialization (allows legato use). |
| 49 | </para> |
| 50 | </refsect1> |
| 51 | |
| 52 | <refsect1> |
| 53 | <title>Performance</title> |
| 54 | <para> |
| 55 | <emphasis>xamp</emphasis> -- peak amplitude of each sineburst, observed at the true end of its rise pattern. The rise may exceed this value given a large bandwidth (say, Q < 10) and/or when the bursts are overlapping. |
| 56 | </para> |
| 57 | |
| 58 | <para> |
| 59 | <emphasis>xfund</emphasis> -- the fundamental frequency (in Hertz) of the impulses that create new sinebursts. |
| 60 | </para> |
| 61 | |
| 62 | <para> |
| 63 | <emphasis>xform</emphasis> -- the formant frequency, i.e. freq of the sinusoid burst induced by each <emphasis>xfund</emphasis> impulse. This frequency can be fixed for each burst or can vary continuously. |
| 64 | </para> |
| 65 | |
| 66 | <para> |
| 67 | <emphasis>koct</emphasis> -- octaviation index, normally zero. If greater than zero, lowers the effective <emphasis>xfund</emphasis> frequency by attenuating odd-numbered sinebursts. Whole numbers are full octaves, fractions transitional. |
| 68 | </para> |
| 69 | |
| 70 | <para> |
| 71 | <emphasis>kband</emphasis> -- the formant bandwidth (at -6dB), expressed in Hz. The bandwidth determines the rate of exponential decay throughout the sineburst, before the enveloping described below is applied. |
| 72 | </para> |
| 73 | |
| 74 | <para> |
| 75 | <emphasis>kris, kdur, kdec</emphasis> -- rise, overall duration, and decay times (in seconds) of the sinusoid burst. These values apply an enveloped duration to each burst, in similar fashion to a Csound <emphasis>linen</emphasis> generator but with rise and decay shapes derived from the <emphasis>ifnb</emphasis> input. <emphasis>kris</emphasis> inversely determines the skirtwidth (at -40 dB) of the induced formant region. <emphasis>kdur</emphasis> affects the density of sineburst overlaps, and thus the speed of computation. Typical values for vocal imitation are .003,.02,.007. |
| 76 | </para> |
| 77 | |
| 78 | <para> |
| 79 | <emphasis>kphs</emphasis> -- allows k-rate indexing of function table <emphasis>ifna</emphasis> with each successive burst, making it suitable for time-warping applications. Values of <emphasis>kphs</emphasis> are normalized from 0 to 1, 1 being the end of the function table <emphasis>ifna</emphasis>. |
| 80 | </para> |
| 81 | |
| 82 | <para> |
| 83 | <emphasis>kgliss</emphasis> -- sets the end pitch of each grain relative to the initial pitch, in octaves. Thus <emphasis>kgliss</emphasis> = 2 means that the grain ends two octaves above its initial pitch, while <emphasis>kgliss</emphasis> = -3/4 has the grain ending a major sixth below. Each 1/12 added to <emphasis>kgliss</emphasis> raises the ending frequency one half-step. If you want no glissando, set <emphasis>kgliss</emphasis> to 0. |
| 84 | </para> |
| 85 | <para> |
| 86 | Csound's <link linkend="fof"><citetitle>fof</citetitle></link> generator is loosely based on Michael Clarke's C-coding of IRCAM's <emphasis>CHANT</emphasis> program (Xavier Rodet et al.). Each <emphasis>fof</emphasis> produces a single formant, and the output of four or more of these can be summed to produce a rich vocal imitation. <emphasis>fof</emphasis> synthesis is a special form of granular synthesis, and this implementation aids transformation between vocal imitation and granular textures. Computation speed depends on <emphasis>kdur, xfund</emphasis>, and the density of any overlaps. |
| 87 | </para> |
| 88 | <note> |
| 89 | <para>The ending frequency of any grain is equal to <emphasis>kform</emphasis> * (2 ^ <emphasis>kgliss</emphasis>), so setting <emphasis>kgliss</emphasis> too high may result in aliasing. For example, <emphasis>kform</emphasis> = 3000 and <emphasis>kgliss</emphasis> = 3 places the ending frequency over the Nyquist if <emphasis>sr</emphasis> = 44100. It is a good idea to scale <emphasis>kgliss</emphasis> accordingly.</para> |
| 90 | </note> |
| 91 | </refsect1> |
| 92 | |
| 93 | <refsect1> |
| 94 | <title>Examples</title> |
| 95 | <para> |
| 96 | Here is an example of the fof2 opcode. It uses the file <ulink url="examples/fof2.csd"><citetitle>fof2.csd</citetitle></ulink>. |
| 97 | |
| 98 | <example> |
| 99 | <title>Example of the fof2 opcode.</title> |
| 100 | <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> |
| 101 | <xi:include href="examples-xml/fof2.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 102 | </example> |
| 103 | </para> |
| 104 | <para> |
| 105 | Here is another example of the fof2 opcode, which generates vowel tones using formants generated by fof2 coinciding with values from the <link linkend="MiscFormants"><citetitle>Formant Values</citetitle></link> appendix. It uses the file <ulink url="examples/fof2-2.csd"><citetitle>fof2-2.csd</citetitle></ulink>. |
| 106 | |
| 107 | <example> |
| 108 | <title>Example of the fof2 opcode to produce vowel sounds.</title> |
| 109 | |
| 110 | <xi:include href="examples-xml/fof2-2.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 111 | </example> |
| 112 | </para> |
| 113 | </refsect1> |
| 114 | |
| 115 | <refsect1> |
| 116 | <title>See Also</title> |
| 117 | <para> |
| 118 | <link linkend="SiggenGranular"><citetitle>Granular Synthesis</citetitle></link> |
| 119 | </para> |
| 120 | </refsect1> |
| 121 | |
| 122 | <refsect1> |
| 123 | <title>Credits</title> |
| 124 | <para> |
| 125 | <simplelist> |
| 126 | <member>Author: &namerasmus;</member> |
| 127 | <member><emphasis>fof2</emphasis> is a modification of <emphasis>fof</emphasis> by &namerasmus;</member> |
| 128 | </simplelist> |
| 129 | </para> |
| 130 | <para>New in Csound 3.45</para> |
| 131 | </refsect1> |
| 132 | </refentry> |