Sophie

Sophie

distrib > Mageia > 5 > x86_64 > media > core-release > by-pkgid > b707d9a4ee443103660a75ccb6e51334 > files > 2587

csound-doc-5.19.01-10.mga5.noarch.rpm

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>sin</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.76.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="shaker.html" title="shaker" />
    <link rel="next" href="sinh.html" title="sinh" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">sin</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="shaker.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="sinh.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="sin">
      <a id="sin"></a>
      <div class="titlepage"></div>
      <a id="IndexSin" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">sin</span>
        </h2>
        <p>sin — 
      Performs a sine function.
          </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp42999224"></a>
        <h2>Description</h2>
        <p>
      Returns the sine of <span class="emphasis"><em>x</em></span> (<span class="emphasis"><em>x</em></span> in radians).
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp43009576"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>sin</strong></span>(x) (no rate restriction)</pre>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp43010568"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the sin opcode. It uses the file <a class="ulink" href="examples/sin.csd" target="_top"><em class="citetitle">sin.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp43011544"></a>
          <p class="title">
            <strong>Example 774. Example of the sin opcode.</strong>
          </p>
          <div class="example-contents">
            <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>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-odac     <span class="comment">;;;realtime audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if realtime audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o sin.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 32
<span class="ohdr">nchnls</span> <span class="op">=</span> 2
<span class="ohdr">0dbfs</span>  <span class="op">=</span> 1

<span class="oblock">instr</span> 1

isin1     <span class="op">=</span>          <span class="opc">sin</span>(0) 					<span class="comment">;sine of 0 is 0</span>
isin2     <span class="op">=</span>          <span class="opc">sin</span>($M_PI_2) 				<span class="comment">;sine of pi/2 (1.5707...) is 1</span>
isin3     <span class="op">=</span>          <span class="opc">sin</span>($M_PI) 				<span class="comment">;sine of pi (3.1415...) is 0</span>
isin4     <span class="op">=</span>          <span class="opc">sin</span>($M_PI_2 <span class="op">*</span> 3) 				<span class="comment">;sine of 3/2pi (4.7123...) is -1</span>
isin5     <span class="op">=</span>          <span class="opc">sin</span>($M_PI <span class="op">*</span> 2) 				<span class="comment">;sine of 2pi (6.2831...) is 0</span>
isin6     <span class="op">=</span>          <span class="opc">sin</span>($M_PI <span class="op">*</span> 4) 				<span class="comment">;sine of 4pi is also 0</span>
          <span class="opc">print</span>      isin1, isin2, isin3, isin4, isin5, isin6
<span class="oblock">endin</span>

<span class="oblock">instr</span> 2 <span class="comment">;sin used in panning, after an example from Hans Mikelson</span>

aout      <span class="opc">vco2</span>       0.8, 220 					<span class="comment">; sawtooth</span>
kpan      <span class="opc">linseg</span>     p4, p3, p5 <span class="comment">;0 = left, 1 = right</span>
kpan      <span class="op">=</span>          kpan<span class="op">*</span>$M_PI_2 				<span class="comment">;range 0-1 becomes 0-pi/2</span>
kpanl     <span class="op">=</span>          <span class="opc">cos</span>(kpan)
kpanr     <span class="op">=</span>          <span class="opc">sin</span>(kpan)
          <span class="opc">outs</span>       aout<span class="op">*</span>kpanl, aout<span class="op">*</span>kpanr
<span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">i</span> 1 0 0
<span class="stamnt">i</span> 2 0 5 0 1 <span class="comment">;move left to right</span>
<span class="stamnt">i</span> 2 5 5 1 0 <span class="comment">;move right to left</span>
<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />

      Its output should include a line like this:
      </p>
        <pre class="screen">instr 1:  isin1 = 0.000  isin2 = 1.000  isin3 = 0.000  isin4 = -1.000  isin5 = -0.000  isin6 = 0.000</pre>
        <p>
    </p>
      </div>
      <div class="refsect1" title="See Also">
        <a id="idp43014248"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="cos.html" title="cos"><em class="citetitle">cos</em></a>, 
      <a class="link" href="cosh.html" title="cosh"><em class="citetitle">cosh</em></a>, 
      <a class="link" href="cosinv.html" title="cosinv"><em class="citetitle">cosinv</em></a>, 
      <a class="link" href="sinh.html" title="sinh"><em class="citetitle">sinh</em></a>, 
      <a class="link" href="sininv.html" title="sininv"><em class="citetitle">sininv</em></a>, 
      <a class="link" href="tan.html" title="tan"><em class="citetitle">tan</em></a>, 
      <a class="link" href="tanh.html" title="tanh"><em class="citetitle">tanh</em></a>, 
      <a class="link" href="taninv.html" title="taninv"><em class="citetitle">taninv</em></a>
    </p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="shaker.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="sinh.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">shaker </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> sinh</td>
        </tr>
      </table>
    </div>
  </body>
</html>