| 1 |
|
| 2 |
<refentry id="oscil"> |
| 3 |
<indexterm id="IndexOscil"><primary>oscil</primary></indexterm> |
| 4 |
<refentryinfo><title>Signal Generators:Basic Oscillators</title></refentryinfo> |
| 5 |
<refmeta> |
| 6 |
<refentrytitle>oscil</refentrytitle> |
| 7 |
</refmeta> |
| 8 |
<refnamediv> |
| 9 |
<refname>oscil</refname> |
| 10 |
<refpurpose> |
| 11 |
A simple oscillator without any interpolation. |
| 12 |
</refpurpose> |
| 13 |
</refnamediv> |
| 14 |
|
| 15 |
<refsect1> |
| 16 |
<title>Description</title> |
| 17 |
<para> |
| 18 |
<emphasis>oscil</emphasis> reads table <emphasis>ifn</emphasis> sequentially and repeatedly at a frequency <emphasis>xcps</emphasis>. The amplitude is scaled by <emphasis>xamp</emphasis>. |
| 19 |
</para> |
| 20 |
</refsect1> |
| 21 |
|
| 22 |
<refsect1> |
| 23 |
<title>Syntax</title> |
| 24 |
<synopsis>ares <command>oscil</command> xamp, xcps [, ifn, iphs]</synopsis> |
| 25 |
<synopsis>kres <command>oscil</command> kamp, kcps [, ifn, iphs]</synopsis> |
| 26 |
</refsect1> |
| 27 |
|
| 28 |
<refsect1> |
| 29 |
<title>Initialization</title> |
| 30 |
<para> |
| 31 |
<emphasis>ifn</emphasis> -- (optional) function table |
| 32 |
number. Requires a wrap-around guard point. The table number |
| 33 |
defaults to -1 which indicates a sinewave. |
| 34 |
</para> |
| 35 |
|
| 36 |
<para> |
| 37 |
<emphasis>iphs</emphasis> (optional, default=0) -- initial phase of sampling, expressed as a fraction of a cycle (0 to 1). A negative value will cause phase initialization to be skipped. The default value is 0. |
| 38 |
</para> |
| 39 |
</refsect1> |
| 40 |
|
| 41 |
<refsect1> |
| 42 |
<title>Performance</title> |
| 43 |
<para> |
| 44 |
<emphasis>kamp, xamp</emphasis> -- amplitude |
| 45 |
</para> |
| 46 |
|
| 47 |
<para> |
| 48 |
<emphasis>kcps, xcps</emphasis> -- frequency in cycles per second. |
| 49 |
</para> |
| 50 |
|
| 51 |
<para> |
| 52 |
The <emphasis>oscil</emphasis> opcode generates periodic control (or audio) signals consisting of the value of <emphasis>kamp</emphasis> (<emphasis>xamp</emphasis>) times the value returned from control rate (audio rate) sampling of a stored function table. The internal phase is simultaneously advanced in accordance with the <emphasis>kcps</emphasis> or <emphasis>xcps</emphasis> input value. |
| 53 |
</para> |
| 54 |
<para> |
| 55 |
Table <emphasis>ifn</emphasis> is incrementally sampled modulo the table length and the value obtained is multiplied by <emphasis>amp</emphasis>. |
| 56 |
</para> |
| 57 |
<para> |
| 58 |
If you need to change the oscillator table with a k-rate signal, you can use <link linkend="oscilikt"><citetitle>oscilikt</citetitle></link>. |
| 59 |
</para> |
| 60 |
<note> |
| 61 |
|
| 62 |
<para> |
| 63 |
This opcode does not perform any interpolation. |
| 64 |
This can lead to unexpected behaviour or unclean signals, |
| 65 |
e.g. for small table sizes and low frequencies. |
| 66 |
As standard oscillators the usage of <link linkend="oscili"><citetitle>oscili</citetitle></link> |
| 67 |
or <link linkend="poscil"><citetitle>poscil</citetitle></link> is recommended. |
| 68 |
</para> |
| 69 |
</note> |
| 70 |
|
| 71 |
</refsect1> |
| 72 |
|
| 73 |
<refsect1> |
| 74 |
<title>Examples</title> |
| 75 |
<para> |
| 76 |
Here is an example of the oscil opcode. It uses the file <ulink url="examples/oscil.csd"><citetitle>oscil.csd</citetitle></ulink>. |
| 77 |
|
| 78 |
<example> |
| 79 |
<title>Example of the oscil opcode.</title> |
| 80 |
<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> |
| 81 |
<xi:include href="examples-xml/oscil.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 82 |
</example> |
| 83 |
</para> |
| 84 |
|
| 85 |
</refsect1> |
| 86 |
|
| 87 |
<refsect1> |
| 88 |
<title>See also</title> |
| 89 |
<para><link linkend="SiggenBasic"><citetitle>Basic Oscillators</citetitle></link></para> |
| 90 |
</refsect1> |
| 91 |
</refentry> |