1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
|
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="GENERATOR" CONTENT="Mozilla/4.03 [en] (X11; I; IRIX 6.3 IP32) [Netscape]">
<TITLE>GRANULE</TITLE>
</HEAD>
<BODY>
<CENTER><A NAME="granule"></A>
<HR><B><A HREF="../REFER.html">QUICK-REF</A></B> - <B><A HREF="../TITLE.html"><FONT SIZE=+1>C</FONT>soundManual</A></B>
- <B><A HREF="SIG_GENS.html#">Top of this section</A></B> - <A HREF="grain.html">Previous</A>
- <A HREF="../CONTENTS.html">Contents</A> - <A HREF="../INDEX.html">Index</A>
- <A HREF="sndwarp.html">Next</A>
<HR></CENTER>
<H2>
granule</H2>
<PRE>asig <B>granule</B> xamp, ivoice, iratio, imode, ithd, ifn, ipshift, \
igskip, igskip_os, ilength, kgap, igap_os, kgsize, \
igsize_os, iatt, idec [,iseed][,ipitch1][,ipitch2] \
[,ipitch3][,ipitch4][,ifnenv]</PRE>
<HR>
<H4>
<U>DESCRIPTION</U></H4>
The <B>granule</B> unit generator (Allan Lee) is more complex than grain
(above), but does add new possibilities. This is a shorten manual, without
the pictures,
<P><B>granule</B> is a Csound unit generator which employs a wavetable
as input to produce granularly synthesized audio output. Wavetable data
may be generated by any of the gen subroutines such as gen01 which reads
an audio data file into a wavetable. This enable a sampled sound to be
used as the source for the grains. Up to 128 voices are implemented internally.The
maximum number of voices can be increased by redefining the variable MAXVOICE
in the grain4.h file. <B>granule</B> has a build-in random number generator
to handle all the random offset parameters. Thresholding is also implemented
to scan the source function table at initialization stage. This facilitates
features such as skipping silence passage between sentences.
<P>The characteristics of the synthesis are controlled by 22 parameters.
<I>xamp</I> is the amplitude of the output and it can be either audio rate
or control rate variable. All parameters with prefix i must be valid at
Init time, parameters with prefix k can be either control or Init values.
<H4>
<U>PERFORMANCE</U></H4>
<I>xamp</I> - amplitude.
<P><I>ivoice</I> - number of voices.
<P><I>iratio</I> - ratio of the speed of the gskip pointer relative to
output audio sample rate. eg. 0.5 will be half speed.
<P><I>imode</I> - +1 grain pointer move forward (same direction of the
gskip pointer), -1 backward (oppose direction to the gskip pointer) or
0 for random.
<P><I>ithd</I> - threshold, if the sampled signal in the wavetable is smaller
then <I>ithd</I>, it will be skipped.
<P><I>ifn</I> - function table number of sound source.
<P><I>ipshift</I> - pitch shift control. If <I>ipshift</I> is 0, pitch
will be set randomly up and down an octave. If <I>ipshift</I> is 1, 2,
3 or 4, up to four different pitches can be set amount the number of voices
definded in <I>ivoice</I>. The optional parameters ipitch1, ipitch2, ipitch3
and ipitch4 are used to quantify the pitch shifts.
<P><I>igskip</I> - initial skip from the beginning of the function table
in sec.
<P><I>igskip_os</I> - gskip pointer random offset in sec, 0 will be no
offset.
<P><I>ilength</I> - length of the table to be used starting from <I>igskip</I>
in sec.
<P><I>kgap</I> - gap between grains in sec.
<P><I>igap_os</I> - gap random offset in % of the gap size, 0 gives no
offset.
<P><I>kgsize</I> - grain size in sec.
<P><I>igsize_os</I> - grain size random offset in % of grain size, 0 gives
no offset.
<P><I>iatt</I> - attack of the grain envelope in % of grain size.
<P><I>idec</I> - decade of the grain envelope in % of grain size.
<P><I>[iseed]</I> - optional, seed for the random number generator, default
is 0.5.
<P><I>[ipitch1], [ipitch2], [ipitch3], [ipitch4]</I>- optional, pitch shift
parameter, used when <I>ipshift</I> is set to 1, 2, 3 or 4. Time scaling
technique is used in pitch shift with linear interpolation between data
points. Default value is 1, the original pitch.
<H4>
<U>EXAMPLE:</U></H4>
<B>Orchestra file</B>:
<PRE>sr = 44100
kr = 4410
ksmps = 10
nchnls = 2
instr 1
;
k1 <B>linseg</B> 0,0.5,1,(p3-p2-1),1,0.5,0
a1 <B>granule</B> p4*k1,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,\
p16,p17,p18,p19,p20,p21,p22,p23,p24
a2 <B>granule</B> p4*k1,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,\
p16,p17,p18,p19, p20+0.17,p21,p22,p23,p24
<B>outs</B> a1,a2
endin</PRE>
<B>Score file</B>:
<PRE>; f statement read sound file sine.aiff in the SFDIR
; directory into f-table 1
f1 0 524288 1 "sine.aiff" 1 0
i1 0 10 2000 64 0.5 0 0 1 4 0 0.005 10 0.01 50 0.02 50 30 30 0.39 \
1 1.42 0.29 2
e</PRE>
The above example reads a sound file called sine.aiff into wavetable number
1 with 524,288 samples. It generates 10 seconds of stereo audio output
using the wavetable. In the orchestra file, all parameters required to
control the synthesis are passed from the score file. A linseg function
generator is used to generate an envelope with 0.5 second of linear attack
and decade. Stereo effect is generated by using different seeds for the
two <B>granule</B> function calls. In the example, 0.17 is added to p20
before passing into the second <B>granule</B> call to ensure that all of
the random offset events are different from the first one.
<P>In the score file, the parameters are interpreted as:
<PRE>p5 (ivoice) the number of voices is set to 64
p6 (iratio) is set to 0.5, it scan the wavetable at half of the speed
of the audio output rate
p7 (imode) is set to 0, the grain pointer only move forward
p8 (ithd) is set to 0, skipping the thresholding process
p9 (ifn) is set to 1, function table number 1 is used
p10 (ipshift) is set to 4, four different pitches are going to be
generated
p11 (igskip) is set to 0 and p12 (igskip_os) is set to 0.005, no
skipping into the wavetable and a 5 mSec random offset is used
p13 (ilength) is set to 10, 10 seconds of the wavetable is to be used
p14 (kgap) is set to 0.01 and p15 (igap_os) is set to 50, 10 mSec gap
with 50% random offset is to be used
p16 (kgsize) is set to 0.02 and p17 (igsize_os) is set to 50, 20 mSec
grain with 50% random offset is used
p18 (iatt) and p19 (idec) are set to 30, 30% of linear attack and
decade is applied to the grain
p20 (iseed) seed for the random number generator is set to 0.39
p21 - p 24 are pitches set to 1 which is the original pitch, 1.42
which is a 5th up, 0.29 which is a 7th down and finally 2 which is
an octave up.</PRE>
<B><U>AUTHOR:</U></B>
<P>Allan Lee
<BR>Belfast
<BR>1996
<CENTER><P>
<HR><B><A HREF="../REFER.html">QUICK-REF</A></B> - <B><A HREF="../TITLE.html"><FONT SIZE=+1>C</FONT>soundManual</A></B>
- <B><A HREF="SIG_GENS.html#">Top of this section</A></B> - <A HREF="grain.html">Previous</A>
- <A HREF="../CONTENTS.html">Contents</A> - <A HREF="../INDEX.html">Index</A>
- <A HREF="sndwarp.html">Next</A>
<HR></CENTER>
<P><CENTER>
<B><I><FONT COLOR="#006600">HTML Csound Manual - <FONT SIZE=-1>©
Jean Piché & Peter J. Nix, 1994-97</FONT></FONT></I></B>
</CENTER>
</HTML>
|