~ubuntu-branches/ubuntu/trusty/csound-manual/trusty-proposed

« back to all changes in this revision

Viewing changes to opcodes/pluck.xml

  • Committer: Bazaar Package Importer
  • Author(s): Felipe Sateler
  • Date: 2011-08-01 22:21:58 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110801222158-90kslkp5ujci2f5d
Tags: 1:5.13~dfsg-1
* New upstream release
 - Add Menno Knevel to the copyright file
 - Refresh patch 2000-stripped-opcodes.diff
 - Update copyright hints file
* Update Vcs-* headers
* Bump Standards-Version

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
<refentry id="pluck">
3
 
<indexterm id="IndexPluck"><primary>pluck</primary></indexterm>
4
 
  <refentryinfo><title>Signal Generators:Waveguide Physical Modeling</title></refentryinfo>
5
 
  <refmeta>
6
 
    <refentrytitle>pluck</refentrytitle>
7
 
  </refmeta>
8
 
 
9
 
 
10
 
 
11
 
  <refnamediv>
12
 
    <refname>pluck</refname>
13
 
    <refpurpose>
14
 
      Produces a naturally decaying plucked string or drum sound.
15
 
          </refpurpose>
16
 
  </refnamediv>
17
 
 
18
 
  <refsect1>
19
 
    <title>Description</title>
20
 
    <para>
21
 
      Audio output is a naturally decaying plucked string or drum sound based on the Karplus-Strong algorithms.
22
 
    </para>
23
 
  </refsect1>
24
 
 
25
 
  <refsect1>
26
 
    <title>Syntax</title>
27
 
    <synopsis>ares <command>pluck</command> kamp, kcps, icps, ifn, imeth [, iparm1] [, iparm2]</synopsis>
28
 
  </refsect1>
29
 
 
30
 
  <refsect1>
31
 
    <title>Initialization</title>
32
 
    <para>
33
 
      <emphasis>icps</emphasis> -- intended pitch value in Hz, used to set up a buffer of 1 cycle of audio samples which will be smoothed over time by a chosen decay method. <emphasis>icps</emphasis> normally anticipates the value of <emphasis>kcps</emphasis>, but may be set artificially high or low to influence the size of the sample buffer.
34
 
    </para>
35
 
 
36
 
    <para>
37
 
      <emphasis>ifn</emphasis> -- table number of a stored function used to initialize the cyclic decay buffer. If <emphasis>ifn</emphasis> = 0, a random sequence will be used instead.
38
 
    </para>
39
 
 
40
 
    <para>
41
 
      <emphasis>imeth</emphasis> -- method of natural decay. There are six, some of which use parameters values that follow.
42
 
      <orderedlist>
43
 
        <listitem>
44
 
          <para>
45
 
             simple averaging. A simple smoothing process, uninfluenced by parameter values.
46
 
          </para>
47
 
        </listitem>
48
 
 
49
 
        <listitem>
50
 
          <para>
51
 
            stretched averaging. As above, with smoothing time stretched by a factor of iparm1 (=1).
52
 
          </para>
53
 
        </listitem>
54
 
 
55
 
        <listitem>
56
 
          <para>
57
 
             simple drum. The range from pitch to noise is controlled by a 'roughness factor' in iparm1 (0 to 1). Zero gives the plucked string effect, while 1 reverses the polarity of every sample (octave down, odd harmonics). The setting .5 gives an optimum snare drum.
58
 
          </para>
59
 
        </listitem>
60
 
 
61
 
        <listitem>
62
 
          <para>
63
 
            stretched drum. Combines both roughness and stretch factors. iparm1 is roughness (0 to 1), and iparm2 the stretch factor (=1).
64
 
          </para>
65
 
        </listitem>
66
 
 
67
 
        <listitem>
68
 
          <para>
69
 
            weighted averaging. As method 1, with iparm1 weighting the current sample (the status quo) and iparm2 weighting the previous adjacent one. iparm1 + iparm2must be &lt;= 1.
70
 
          </para>
71
 
        </listitem>
72
 
 
73
 
        <listitem>
74
 
          <para>
75
 
            1st order recursive filter, with coefs .5. Unaffected by parameter values.
76
 
          </para>
77
 
        </listitem>
78
 
      </orderedlist>
79
 
    </para>
80
 
 
81
 
    <para>
82
 
      <emphasis>iparm1, iparm2</emphasis> (optional) -- parameter values for use by the smoothing algorithms (above). The default values are both 0.
83
 
    </para>
84
 
  </refsect1>
85
 
 
86
 
  <refsect1>
87
 
    <title>Performance</title>
88
 
    <para>
89
 
      <emphasis>kamp</emphasis> -- the output amplitude.
90
 
    </para>
91
 
 
92
 
    <para>
93
 
      <emphasis>kcps</emphasis> -- the resampling frequency in cycles-per-second.
94
 
    </para>
95
 
 
96
 
    <para>
97
 
      An internal audio buffer, filled at i-time according to <emphasis>ifn</emphasis>, is continually resampled with periodicity <emphasis>kcps</emphasis> and the resulting output is multiplied by <emphasis>kamp</emphasis>. Parallel with the sampling, the buffer is smoothed to simulate the effect of natural decay.
98
 
    </para>
99
 
 
100
 
    <para>
101
 
      Plucked strings (1,2,5,6) are best realized by starting with a random noise source, which is rich in initial harmonics. Drum sounds (methods 3,4) work best with a flat source (wide pulse), which produces a deep noise attack and sharp decay.
102
 
    </para>
103
 
 
104
 
    <para>
105
 
      The original Karplus-Strong algorithm used a fixed number of samples per cycle, which caused serious quantization of the pitches available and their intonation. This implementation resamples a buffer at the exact pitch given by <emphasis>kcps</emphasis>, which can be varied for vibrato and glissando effects. For low values of the orch sampling rate (e.g. <emphasis>sr</emphasis> = 10000), high frequencies will store only very few samples (<emphasis>sr / icps</emphasis>). Since this may cause noticeable noise in the resampling process, the internal buffer has a minimum size of 64 samples. This can be further enlarged by setting <emphasis>icps</emphasis> to some artificially lower pitch.
106
 
    </para>
107
 
  </refsect1>
108
 
 
109
 
  <refsect1>
110
 
    <title>Examples</title>
111
 
    <para>
112
 
      Here is an example of the pluck opcode. It uses the file <ulink url="examples/pluck.csd"><citetitle>pluck.csd</citetitle></ulink>.
113
 
 
114
 
      <example>
115
 
        <title>Example of the pluck opcode.</title>
116
 
 
117
 
        
118
 
 
119
 
        <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>
120
 
          <xi:include href="examples-xml/pluck.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
121
 
      </example>
122
 
    </para>
123
 
  </refsect1>
124
 
 
125
 
  <refsect1>
126
 
    <title>Credits</title>
127
 
    <para>Example written by &namekevin;.</para>
128
 
  </refsect1>
129
 
</refentry>
 
1
 
 
2
<refentry id="pluck">
 
3
<indexterm id="IndexPluck"><primary>pluck</primary></indexterm>
 
4
  <refentryinfo><title>Signal Generators:Waveguide Physical Modeling</title></refentryinfo>
 
5
  <refmeta>
 
6
    <refentrytitle>pluck</refentrytitle>
 
7
  </refmeta>
 
8
 
 
9
  <refnamediv>
 
10
    <refname>pluck</refname>
 
11
    <refpurpose>
 
12
      Produces a naturally decaying plucked string or drum sound.
 
13
    </refpurpose>
 
14
  </refnamediv>
 
15
 
 
16
  <refsect1>
 
17
    <title>Description</title>
 
18
    <para>
 
19
      Audio output is a naturally decaying plucked string or drum sound based on the Karplus-Strong algorithms.
 
20
    </para>
 
21
  </refsect1>
 
22
 
 
23
  <refsect1>
 
24
    <title>Syntax</title>
 
25
    <synopsis>ares <command>pluck</command> kamp, kcps, icps, ifn, imeth [, iparm1] [, iparm2]</synopsis>
 
26
  </refsect1>
 
27
 
 
28
  <refsect1>
 
29
    <title>Initialization</title>
 
30
    <para>
 
31
      <emphasis>icps</emphasis> -- intended pitch value in Hz, used to set up a buffer of 1 cycle of audio samples which will be smoothed over time by a chosen decay method. <emphasis>icps</emphasis> normally anticipates the value of <emphasis>kcps</emphasis>, but may be set artificially high or low to influence the size of the sample buffer.
 
32
    </para>
 
33
 
 
34
    <para>
 
35
      <emphasis>ifn</emphasis> -- table number of a stored function used to initialize the cyclic decay buffer. If <emphasis>ifn</emphasis> = 0, a random sequence will be used instead.
 
36
    </para>
 
37
 
 
38
    <para>
 
39
      <emphasis>imeth</emphasis> -- method of natural decay. There are six, some of which use parameters values that follow.
 
40
      <orderedlist>
 
41
        <listitem>
 
42
          <para>
 
43
             simple averaging. A simple smoothing process, uninfluenced by parameter values.
 
44
          </para>
 
45
        </listitem>
 
46
 
 
47
        <listitem>
 
48
          <para>
 
49
            stretched averaging. As above, with smoothing time stretched by a factor of <emphasis>iparm1</emphasis> (>=1).
 
50
          </para>
 
51
        </listitem>
 
52
 
 
53
        <listitem>
 
54
          <para>
 
55
             simple drum. The range from pitch to noise is controlled by a 'roughness factor' in <emphasis>iparm1</emphasis> (0 to 1). Zero gives the plucked string effect, while 1 reverses the polarity of every sample (octave down, odd harmonics). The setting .5 gives an optimum snare drum.
 
56
          </para>
 
57
        </listitem>
 
58
 
 
59
        <listitem>
 
60
          <para>
 
61
            stretched drum. Combines both roughness and stretch factors. <emphasis>iparm1</emphasis> is roughness (0 to 1), and <emphasis>iparm2</emphasis> the stretch factor (>=1).
 
62
          </para>
 
63
        </listitem>
 
64
 
 
65
        <listitem>
 
66
          <para>
 
67
            weighted averaging. As method 1, with <emphasis>iparm1</emphasis> weighting the current sample (the status quo) and <emphasis>iparm2</emphasis> weighting the previous adjacent one. <emphasis>iparm1 + iparm2</emphasis> must be &lt;= 1.
 
68
          </para>
 
69
        </listitem>
 
70
 
 
71
        <listitem>
 
72
          <para>
 
73
            1st order recursive filter, with coefs .5. Unaffected by parameter values.
 
74
          </para>
 
75
        </listitem>
 
76
      </orderedlist>
 
77
    </para>
 
78
 
 
79
    <para>
 
80
      <emphasis>iparm1, iparm2</emphasis> (optional) -- parameter values for use by the smoothing algorithms (above). The default values are both 0.
 
81
    </para>
 
82
  </refsect1>
 
83
 
 
84
  <refsect1>
 
85
    <title>Performance</title>
 
86
    <para>
 
87
      <emphasis>kamp</emphasis> -- the output amplitude.
 
88
    </para>
 
89
 
 
90
    <para>
 
91
      <emphasis>kcps</emphasis> -- the resampling frequency in cycles-per-second.
 
92
    </para>
 
93
 
 
94
    <para>
 
95
      An internal audio buffer, filled at i-time according to <emphasis>ifn</emphasis>, is continually resampled with periodicity <emphasis>kcps</emphasis> and the resulting output is multiplied by <emphasis>kamp</emphasis>. Parallel with the sampling, the buffer is smoothed to simulate the effect of natural decay.
 
96
    </para>
 
97
 
 
98
    <para>
 
99
      Plucked strings (1, 2, 5, 6) are best realized by starting with a random noise source, which is rich in initial harmonics. Drum sounds (methods 3, 4) work best with a flat source (wide pulse), which produces a deep noise attack and sharp decay.
 
100
    </para>
 
101
 
 
102
    <para>
 
103
      The original Karplus-Strong algorithm used a fixed number of samples per cycle, which caused serious quantization of the pitches available and their intonation. This implementation resamples a buffer at the exact pitch given by <emphasis>kcps</emphasis>, which can be varied for vibrato and glissando effects. For low values of the orch sampling rate (e.g. <emphasis>sr</emphasis> = 10000), high frequencies will store only very few samples (<emphasis>sr / icps</emphasis>). Since this may cause noticeable noise in the resampling process, the internal buffer has a minimum size of 64 samples. This can be further enlarged by setting <emphasis>icps</emphasis> to some artificially lower pitch.
 
104
    </para>
 
105
  </refsect1>
 
106
 
 
107
  <refsect1>
 
108
    <title>Examples</title>
 
109
    <para>
 
110
      Here is an example of the pluck opcode. It uses the file <ulink url="examples/pluck.csd"><citetitle>pluck.csd</citetitle></ulink>.
 
111
 
 
112
      <example>
 
113
        <title>Example of the pluck opcode.</title>
 
114
 
 
115
        
 
116
 
 
117
        <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>
 
118
          <xi:include href="examples-xml/pluck.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
 
119
      </example>
 
120
    </para>
 
121
  </refsect1>
 
122
 
 
123
  <refsect1>
 
124
    <title>Credits</title>
 
125
    <para>Example written by &namekevin;.</para>
 
126
  </refsect1>
 
127
</refentry>