| 1 | |
| 2 | <refentry id="seed"> |
| 3 | <indexterm id="IndexSeed"><primary>seed</primary></indexterm> |
| 4 | <refentryinfo><title>Signal Generators:Random (Noise) Generators</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>seed</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>seed</refname> |
| 13 | |
| 14 | <refpurpose> |
| 15 | Sets the global seed value. |
| 16 | </refpurpose> |
| 17 | </refnamediv> |
| 18 | |
| 19 | <refsect1> |
| 20 | <title>Description</title> |
| 21 | <para> |
| 22 | Sets the global seed value for all <emphasis>x-class noise generators</emphasis>, as well as other opcodes that use a random call, such as <link linkend="grain"><citetitle>grain</citetitle></link>. |
| 23 | </para> |
| 24 | <note> |
| 25 | <title>Please Note</title> |
| 26 | <para><link linkend="rand"><citetitle>rand</citetitle></link>, <link linkend="randh"><citetitle>randh</citetitle></link>, <link linkend="randi"><citetitle>randi</citetitle></link>, <link linkend="rnd"><citetitle>rnd(x)</citetitle></link> and <link linkend="birnd"><citetitle>birnd(x)</citetitle></link> are not affected by seed.</para> |
| 27 | </note> |
| 28 | </refsect1> |
| 29 | |
| 30 | <refsect1> |
| 31 | <title>Syntax</title> |
| 32 | <synopsis><command>seed</command> ival</synopsis> |
| 33 | </refsect1> |
| 34 | |
| 35 | <refsect1> |
| 36 | <title>Performance</title> |
| 37 | <para> |
| 38 | Use of <emphasis>seed</emphasis> will provide predictable results from an orchestra using with random generators, when required from multiple performances. |
| 39 | </para> |
| 40 | |
| 41 | <para> |
| 42 | When specifying a seed value, <emphasis>ival</emphasis> should be an integer between 0 and 2<superscript>32</superscript>. If <emphasis>ival</emphasis> = 0, the value of <emphasis>ival</emphasis> will be derived from the system clock. |
| 43 | </para> |
| 44 | </refsect1> |
| 45 | |
| 46 | |
| 47 | <refsect1> |
| 48 | <title>Examples</title> |
| 49 | <para> |
| 50 | Here is an example of the seed opcode. It uses the file <ulink url="examples/seed.csd"><citetitle>seed.csd</citetitle></ulink>. |
| 51 | <example> |
| 52 | <title>Example of the seed opcode.</title> |
| 53 | <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> |
| 54 | <xi:include href="examples-xml/seed.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 55 | </example> |
| 56 | Its output should include lines like: |
| 57 | <screen> |
| 58 | i 1 time 0.00067: 100.00000 |
| 59 | i 1 time 0.50000: 175.78677 |
| 60 | i 1 time 1.00000: 170.89579 |
| 61 | |
| 62 | WARNING: Seeding from current time 834128659 |
| 63 | |
| 64 | i 2 time 2.00067: 100.00000 |
| 65 | i 2 time 2.50000: 197.58517 |
| 66 | i 2 time 3.00000: 188.69525 |
| 67 | </screen> |
| 68 | </para> |
| 69 | </refsect1> |
| 70 | |
| 71 | <refsect1> |
| 72 | <title>See also</title> |
| 73 | <para><link linkend="SiggenNoise"><citetitle>Random (Noise) Generators</citetitle></link> |
| 74 | </para> |
| 75 | <para><link linkend="OrchHeader"><citetitle>Orchestra Header Statements</citetitle></link></para> |
| 76 | </refsect1> |
| 77 | |
| 78 | </refentry> |