PageRenderTime 355ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/Resources/html/linseg.html

http://cecilia4.googlecode.com/
HTML | 239 lines | 221 code | 18 blank | 0 comment | 0 complexity | a1802dca59d49e5c74fa251edd2806e2 MD5 | raw file
Possible License(s): GPL-3.0
  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  6. <title>linseg</title>
  7. <link rel="stylesheet" href="csound.css" type="text/css" />
  8. <meta name="generator" content="DocBook XSL Stylesheets V1.75.1" />
  9. <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
  10. <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
  11. <link rel="prev" href="linrand.html" title="linrand" />
  12. <link rel="next" href="linsegr.html" title="linsegr" />
  13. </head>
  14. <body>
  15. <div class="navheader">
  16. <table width="100%" summary="Navigation header">
  17. <tr>
  18. <th colspan="3" align="center">linseg</th>
  19. </tr>
  20. <tr>
  21. <td width="20%" align="left"><a accesskey="p" href="linrand.html">Prev</a> </td>
  22. <th width="60%" align="center">Orchestra Opcodes and Operators</th>
  23. <td width="20%" align="right"> <a accesskey="n" href="linsegr.html">Next</a></td>
  24. </tr>
  25. </table>
  26. <hr />
  27. </div>
  28. <div class="refentry" title="linseg">
  29. <a id="linseg"></a>
  30. <div class="titlepage"></div>
  31. <a id="IndexLinseg" class="indexterm"></a>
  32. <div class="refnamediv">
  33. <h2>
  34. <span class="refentrytitle">linseg</span>
  35. </h2>
  36. <p>linseg —
  37. Trace a series of line segments between specified points.
  38. </p>
  39. </div>
  40. <div class="refsect1" title="Description">
  41. <a id="id3364015"></a>
  42. <h2>Description</h2>
  43. <p>
  44. Trace a series of line segments between specified points.
  45. </p>
  46. </div>
  47. <div class="refsect1" title="Syntax">
  48. <a id="id3364027"></a>
  49. <h2>Syntax</h2>
  50. <pre class="synopsis">ares <span class="command"><strong>linseg</strong></span> ia, idur1, ib [, idur2] [, ic] [...]</pre>
  51. <pre class="synopsis">kres <span class="command"><strong>linseg</strong></span> ia, idur1, ib [, idur2] [, ic] [...]</pre>
  52. </div>
  53. <div class="refsect1" title="Initialization">
  54. <a id="id3364938"></a>
  55. <h2>Initialization</h2>
  56. <p>
  57. <span class="emphasis"><em>ia</em></span> -- starting value.
  58. </p>
  59. <p>
  60. <span class="emphasis"><em>ib, ic</em></span>, etc. -- value after <span class="emphasis"><em>dur1</em></span> seconds, etc.
  61. </p>
  62. <p>
  63. <span class="emphasis"><em>idur1</em></span> -- duration in seconds of first segment. A zero or negative value will cause all initialization to be skipped.
  64. </p>
  65. <p>
  66. <span class="emphasis"><em>idur2, idur3</em></span>, etc. -- duration in seconds of subsequent segments. A zero or negative value will terminate the initialization process with the preceding point, permitting the last-defined line or curve to be continued indefinitely in performance. The default is zero.
  67. </p>
  68. </div>
  69. <div class="refsect1" title="Performance">
  70. <a id="id3364991"></a>
  71. <h2>Performance</h2>
  72. <p>
  73. These units generate control or audio signals whose values can pass through 2 or more specified points. The sum of <span class="emphasis"><em>dur</em></span> values may or may not equal the instrument's performance time: a shorter performance will truncate the specified pattern, while a longer one will cause the last-defined segment to continue on in the same direction.
  74. </p>
  75. <p>
  76. </p>
  77. <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
  78. <table border="0" summary="Note">
  79. <tr>
  80. <td rowspan="2" align="center" valign="top" width="25">
  81. <img alt="[Note]" src="images/note.png" />
  82. </td>
  83. <th align="left">Note</th>
  84. </tr>
  85. <tr>
  86. <td align="left" valign="top">
  87. <p>
  88. A common error with this opcode is to assume that the last value
  89. is held after the total duration. <span class="emphasis"><em>linseg</em></span> does not
  90. automatically end or stop at the end of the total duration. If your
  91. note length is longer than the sum of all <span class="emphasis"><em>idur</em></span>
  92. values, <span class="emphasis"><em>kres</em></span> (or <span class="emphasis"><em>ares</em></span>) will
  93. not come to rest at the last given value, but will instead continue to
  94. rise or fall with the current rate. You can add a final segment at the
  95. same previous value to create a held final value.
  96. </p>
  97. </td>
  98. </tr>
  99. </table>
  100. </div>
  101. <p>
  102. </p>
  103. </div>
  104. <div class="refsect1" title="Examples">
  105. <a id="id3365052"></a>
  106. <h2>Examples</h2>
  107. <p>
  108. Here is an example of the linseg opcode. It uses the file <a class="ulink" href="examples/linseg.csd" target="_top"><em class="citetitle">linseg.csd</em></a>.
  109. </p>
  110. <div class="example">
  111. <a id="id3365068"></a>
  112. <p class="title">
  113. <b>Example 274. Example of the linseg opcode.</b>
  114. </p>
  115. <div class="example-contents">
  116. <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
  117. <pre class="programlisting">
  118. <span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
  119. <span class="csdtag">&lt;CsOptions&gt;</span>
  120. <span class="comment">; Select audio/midi flags here according to platform</span>
  121. <span class="comment">; Audio out Audio in No messages</span>
  122. -odac -iadc -d <span class="comment">;;;RT audio I/O</span>
  123. <span class="comment">; For Non-realtime ouput leave only the line below:</span>
  124. <span class="comment">; -o linseg.wav -W ;;; for file output any platform</span>
  125. <span class="csdtag">&lt;/CsOptions&gt;</span>
  126. <span class="csdtag">&lt;CsInstruments&gt;</span>
  127. <span class="comment">; Initialize the global variables.</span>
  128. <span class="ohdr">sr</span> <span class="op">=</span> 44100
  129. <span class="ohdr">kr</span> <span class="op">=</span> 4410
  130. <span class="ohdr">ksmps</span> <span class="op">=</span> 10
  131. <span class="ohdr">nchnls</span> <span class="op">=</span> 1
  132. <span class="comment">; Instrument #1.</span>
  133. <span class="oblock">instr</span> 1
  134. <span class="comment">; p4 = frequency in pitch-class notation.</span>
  135. kcps <span class="op">=</span> <span class="opc">cpspch</span>(p4)
  136. <span class="comment">; Create an amplitude envelope.</span>
  137. kenv <span class="opc">linseg</span> 0, p3<span class="op">*</span>0.25, 1, p3<span class="op">*</span>0.75, 0
  138. kamp <span class="op">=</span> kenv <span class="op">*</span> 30000
  139. a1 <span class="opc">oscil</span> kamp, kcps, 1
  140. <span class="opc">out</span> a1
  141. <span class="oblock">endin</span>
  142. <span class="oblock">instr</span> 2
  143. <span class="comment">; p4 = frequency in pitch-class notation.</span>
  144. kcps <span class="op">=</span> <span class="opc">cpspch</span>(p4)
  145. <span class="comment">; Create an amplitude envelope.</span>
  146. kenv <span class="opc">linseg</span> 0, 0.25, 1, 0.75, 0 <span class="comment">; kenv will go into negative if p3 &gt; 1</span>
  147. kamp <span class="op">=</span> kenv <span class="op">*</span> 30000
  148. a1 <span class="opc">oscil</span> kamp, kcps, 1
  149. <span class="opc">out</span> a1
  150. <span class="oblock">endin</span>
  151. <span class="oblock">instr</span> 3
  152. <span class="comment">; p4 = frequency in pitch-class notation.</span>
  153. kcps <span class="op">=</span> <span class="opc">cpspch</span>(p4)
  154. <span class="comment">; Create an amplitude envelope.</span>
  155. kenv <span class="opc">linseg</span> 0, 0.25, 1, 0.75, 0, 1, 0 <span class="comment">; kenv will stay at 0 indefinetely at the end</span>
  156. kamp <span class="op">=</span> kenv <span class="op">*</span> 30000
  157. a1 <span class="opc">oscil</span> kamp, kcps, 1
  158. <span class="opc">out</span> a1
  159. <span class="oblock">endin</span>
  160. <span class="csdtag">&lt;/CsInstruments&gt;</span>
  161. <span class="csdtag">&lt;CsScore&gt;</span>
  162. <span class="comment">; Table #1, a sine wave.</span>
  163. <span class="stamnt">f</span> 1 0 16384 10 1
  164. <span class="comment">; Play Instrument #1 for a half-second, p4=8.00</span>
  165. <span class="stamnt">i</span> 1 0 0.5 8.00
  166. <span class="comment">; Play Instrument #1 for a half-second, p4=8.01</span>
  167. <span class="stamnt">i</span> 1 1 0.5 8.01
  168. <span class="comment">; Play Instrument #1 for a half-second, p4=8.02</span>
  169. <span class="stamnt">i</span> 1 2 0.5 8.02
  170. <span class="comment">; Play Instrument #1 for a half-second, p4=8.03</span>
  171. <span class="stamnt">i</span> 1 3 0.5 8.03
  172. <span class="stamnt">i</span> 2 4 1.5 8.00 <span class="comment">; Notice the problem with linseg</span>
  173. <span class="stamnt">i</span> 3 6 1.5 8.00 <span class="comment">; this is the solution (instr 3)</span>
  174. <span class="stamnt">e</span>
  175. <span class="csdtag">&lt;/CsScore&gt;</span>
  176. <span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
  177. </pre>
  178. </div>
  179. </div>
  180. <p><br class="example-break" />
  181. </p>
  182. </div>
  183. <div class="refsect1" title="See Also">
  184. <a id="id3365107"></a>
  185. <h2>See Also</h2>
  186. <p>
  187. <a class="link" href="expon.html" title="expon"><em class="citetitle">expon</em></a>,
  188. <a class="link" href="expseg.html" title="expseg"><em class="citetitle">expseg</em></a>,
  189. <a class="link" href="expsegr.html" title="expsegr"><em class="citetitle">expsegr</em></a>,
  190. <a class="link" href="line.html" title="line"><em class="citetitle">line</em></a>,
  191. <a class="link" href="linsegr.html" title="linsegr"><em class="citetitle">linsegr</em></a>
  192. <a class="link" href="transeg.html" title="transeg"><em class="citetitle">transeg</em></a>
  193. </p>
  194. </div>
  195. <div class="refsect1" title="Credits">
  196. <a id="id3365165"></a>
  197. <h2>Credits</h2>
  198. <p>Example written by Kevin Conder.</p>
  199. </div>
  200. </div>
  201. <div class="navfooter">
  202. <hr />
  203. <table width="100%" summary="Navigation footer">
  204. <tr>
  205. <td width="40%" align="left"><a accesskey="p" href="linrand.html">Prev</a> </td>
  206. <td width="20%" align="center">
  207. <a accesskey="u" href="OpcodesTop.html">Up</a>
  208. </td>
  209. <td width="40%" align="right"> <a accesskey="n" href="linsegr.html">Next</a></td>
  210. </tr>
  211. <tr>
  212. <td width="40%" align="left" valign="top">linrand </td>
  213. <td width="20%" align="center">
  214. <a accesskey="h" href="index.html">Home</a>
  215. </td>
  216. <td width="40%" align="right" valign="top"> linsegr</td>
  217. </tr>
  218. </table>
  219. </div>
  220. </body>
  221. </html>