| 1 | |
| 2 | <refentry id="fprintks"> |
| 3 | <indexterm id="IndexFprintks"><primary>fprintks</primary></indexterm> |
| 4 | <refentryinfo><title>Signal I/O:File I/O</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>fprintks</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>fprintks</refname> |
| 13 | <refpurpose> |
| 14 | Similar to printks but prints to a file. |
| 15 | </refpurpose> |
| 16 | </refnamediv> |
| 17 | |
| 18 | <refsect1> |
| 19 | <title>Description</title> |
| 20 | <para> |
| 21 | Similar to <link linkend="printks"><citetitle>printks</citetitle></link> but prints to a file. |
| 22 | </para> |
| 23 | </refsect1> |
| 24 | |
| 25 | <refsect1> |
| 26 | <title>Syntax</title> |
| 27 | <synopsis><command>fprintks</command> "filename", "string", [, kval1] [, kval2] [...]</synopsis> |
| 28 | </refsect1> |
| 29 | |
| 30 | <refsect1> |
| 31 | <title>Initialization</title> |
| 32 | <para> |
| 33 | <emphasis>"filename"</emphasis> -- name of the output file. |
| 34 | </para> |
| 35 | |
| 36 | <para> |
| 37 | <emphasis>"string"</emphasis> -- the text string to be printed. Can be up to 8192 characters and must be in double quotes. |
| 38 | </para> |
| 39 | </refsect1> |
| 40 | |
| 41 | <refsect1> |
| 42 | <title>Performance</title> |
| 43 | <para> |
| 44 | <emphasis>kval1, kval2, ...</emphasis> (optional) -- The k-rate values to be printed. These are specified in <emphasis><quote>string</quote></emphasis> with the standard C value specifier (%f, %d, etc.) in the order given. |
| 45 | </para> |
| 46 | |
| 47 | <para> |
| 48 | <emphasis>fprintks</emphasis> is similar to the |
| 49 | <emphasis>printks</emphasis> opcode except it outputs to a file |
| 50 | and does not have a <emphasis>itime</emphasis> parameter. For more information about output formatting, please look at <link linkend="printks"><citetitle>printks's documentation</citetitle></link>. |
| 51 | </para> |
| 52 | </refsect1> |
| 53 | |
| 54 | <refsect1> |
| 55 | <title>Examples</title> |
| 56 | <para> |
| 57 | Here is an example of the fprintks opcode. It uses the file <ulink url="examples/fprintks.csd"><citetitle>fprintks.csd</citetitle></ulink>. |
| 58 | |
| 59 | <example> |
| 60 | <title>Example of the fprintks opcode.</title> |
| 61 | |
| 62 | |
| 63 | |
| 64 | <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> |
| 65 | <xi:include href="examples-xml/fprintks.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 66 | </example> |
| 67 | |
| 68 | This example will generate a file called <quote>my.sco</quote>. It should contain lines like this: |
| 69 | |
| 70 | <screen> |
| 71 | i1 0.00 1.35 668.01 |
| 72 | i1 0.13 2.21 246.53 |
| 73 | i1 0.22 1.88 437.51 |
| 74 | i1 1.18 9.65 126.09 |
| 75 | </screen> |
| 76 | </para> |
| 77 | <para> |
| 78 | Here is an example of the fprintks opcode, which converts a standard MIDI file to a csound score. It uses the file <ulink url="examples/fprintks-2.csd"><citetitle>fprintks-2.csd</citetitle></ulink>. |
| 79 | |
| 80 | <example> |
| 81 | <title>Example of the fprintks opcode to convert a MIDI file to a csound score.</title> |
| 82 | |
| 83 | <xi:include href="examples-xml/fprintks-2.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 84 | </example> |
| 85 | |
| 86 | This example will generate a file called <quote>MIDI2cs.sco</quote> containing i-events according to the MIDI file |
| 87 | |
| 88 | </para> |
| 89 | <para> |
| 90 | Here is an advanced example of the fprintks opcode, which generates scores for Csound. It uses the file <ulink url="examples/scogen.csd"><citetitle>scogen-2.csd</citetitle></ulink>. |
| 91 | |
| 92 | <example> |
| 93 | <title>Example of the fprintks opcode to create a Csound score file generator using Csound.</title> |
| 94 | |
| 95 | <xi:include href="examples-xml/scogen.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 96 | </example> |
| 97 | |
| 98 | This example will generate a file called <quote>schottstaedt.sco</quote> which can be used as a score together with <ulink url="examples/schottstaedt.orc"><citetitle>schottstaedt.orc</citetitle></ulink> |
| 99 | |
| 100 | </para> |
| 101 | </refsect1> |
| 102 | |
| 103 | <refsect1> |
| 104 | <title>See also</title> |
| 105 | <para><link linkend="SigioFileIO"><citetitle>File Input and Output</citetitle></link></para> |
| 106 | </refsect1> |
| 107 | |
| 108 | <refsect1> |
| 109 | <title>Credits</title> |
| 110 | <para> |
| 111 | <simplelist> |
| 112 | <member>Author: &namematt;</member> |
| 113 | <member>January 2003</member> |
| 114 | </simplelist> |
| 115 | </para> |
| 116 | </refsect1> |
| 117 | </refentry> |