3
<indexterm id="IndexPluck"><primary>pluck</primary></indexterm>
4
<refentryinfo><title>Signal Generators:Waveguide Physical Modeling</title></refentryinfo>
6
<refentrytitle>pluck</refentrytitle>
12
<refname>pluck</refname>
14
Produces a naturally decaying plucked string or drum sound.
19
<title>Description</title>
21
Audio output is a naturally decaying plucked string or drum sound based on the Karplus-Strong algorithms.
27
<synopsis>ares <command>pluck</command> kamp, kcps, icps, ifn, imeth [, iparm1] [, iparm2]</synopsis>
31
<title>Initialization</title>
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.
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.
41
<emphasis>imeth</emphasis> -- method of natural decay. There are six, some of which use parameters values that follow.
45
simple averaging. A simple smoothing process, uninfluenced by parameter values.
51
stretched averaging. As above, with smoothing time stretched by a factor of iparm1 (=1).
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.
63
stretched drum. Combines both roughness and stretch factors. iparm1 is roughness (0 to 1), and iparm2 the stretch factor (=1).
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 <= 1.
75
1st order recursive filter, with coefs .5. Unaffected by parameter values.
82
<emphasis>iparm1, iparm2</emphasis> (optional) -- parameter values for use by the smoothing algorithms (above). The default values are both 0.
87
<title>Performance</title>
89
<emphasis>kamp</emphasis> -- the output amplitude.
93
<emphasis>kcps</emphasis> -- the resampling frequency in cycles-per-second.
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.
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.
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.
110
<title>Examples</title>
112
Here is an example of the pluck opcode. It uses the file <ulink url="examples/pluck.csd"><citetitle>pluck.csd</citetitle></ulink>.
115
<title>Example of the pluck opcode.</title>
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"/>
126
<title>Credits</title>
127
<para>Example written by &namekevin;.</para>
3
<indexterm id="IndexPluck"><primary>pluck</primary></indexterm>
4
<refentryinfo><title>Signal Generators:Waveguide Physical Modeling</title></refentryinfo>
6
<refentrytitle>pluck</refentrytitle>
10
<refname>pluck</refname>
12
Produces a naturally decaying plucked string or drum sound.
17
<title>Description</title>
19
Audio output is a naturally decaying plucked string or drum sound based on the Karplus-Strong algorithms.
25
<synopsis>ares <command>pluck</command> kamp, kcps, icps, ifn, imeth [, iparm1] [, iparm2]</synopsis>
29
<title>Initialization</title>
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.
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.
39
<emphasis>imeth</emphasis> -- method of natural decay. There are six, some of which use parameters values that follow.
43
simple averaging. A simple smoothing process, uninfluenced by parameter values.
49
stretched averaging. As above, with smoothing time stretched by a factor of <emphasis>iparm1</emphasis> (>=1).
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.
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).
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 <= 1.
73
1st order recursive filter, with coefs .5. Unaffected by parameter values.
80
<emphasis>iparm1, iparm2</emphasis> (optional) -- parameter values for use by the smoothing algorithms (above). The default values are both 0.
85
<title>Performance</title>
87
<emphasis>kamp</emphasis> -- the output amplitude.
91
<emphasis>kcps</emphasis> -- the resampling frequency in cycles-per-second.
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.
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.
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.
108
<title>Examples</title>
110
Here is an example of the pluck opcode. It uses the file <ulink url="examples/pluck.csd"><citetitle>pluck.csd</citetitle></ulink>.
113
<title>Example of the pluck opcode.</title>
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"/>
124
<title>Credits</title>
125
<para>Example written by &namekevin;.</para>