| 1 |
<section id="loris"> |
| 2 |
<title>Loris Opcodes</title> |
| 3 |
<note> |
| 4 |
<para>These opcodes are an optional component of Csound5. You can check if they are installed by using the command 'csound -z' which lists all available opcodes.</para> |
| 5 |
</note> |
| 6 |
<para>The Loris family of opcodes wraps: |
| 7 |
<link linkend="lorisread"><citetitle>lorisread</citetitle></link> |
| 8 |
which imports a set of bandwidth-enhanced partials from a SDIF-format data file, applying control-rate frequency, amplitude, and bandwidth scaling envelopes, and stores the modified partials in memory; |
| 9 |
<link |
| 10 |
linkend="lorismorph"><citetitle>lorismorph</citetitle></link>, |
| 11 |
which morphs two stored sets of bandwidth-enhanced partials and stores a new set of partials representing the morphed sound. The morph is performed by linearly interpolating the parameter envelopes (frequency, amplitude, and bandwidth, or noisiness) of the bandwidth-enhanced partials according to control-rate frequency, amplitude, and bandwidth morphing functions, and |
| 12 |
<link linkend="lorisplay"><citetitle>lorisplay</citetitle></link>, |
| 13 |
which renders a stored set of bandwidth-enhanced partials using the method of Bandwidth-Enhanced Additive Synthesis implemented in the Loris software, applying control-rate frequency, amplitude, and bandwidth scaling envelopes. |
| 14 |
</para> |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
<para>For more information about sound morphing and manipulation using |
| 21 |
Loris and the Reassigned Bandwidth-Enhanced Additive Model, visit the |
| 22 |
Loris web site at <ulink |
| 23 |
url="http://www.cerlsoundgroup.org/Loris">www.cerlsoundgroup.org/Loris</ulink>.</para> |
| 24 |
|
| 25 |
<bridgehead>Examples</bridgehead> |
| 26 |
|
| 27 |
<example> |
| 28 |
<title>Play the partials wihtout modification</title> |
| 29 |
<programlisting> |
| 30 |
<emphasis role="comment">; |
| 31 |
; Play the partials in clarinet.sdif |
| 32 |
; from 0 to 3 sec with 1 ms fadetime |
| 33 |
; and no frequency , amplitude, or |
| 34 |
; bandwidth modification. |
| 35 |
;</emphasis> |
| 36 |
<emphasis role="oblock">instr 1</emphasis> |
| 37 |
ktime <emphasis role="opc">linseg</emphasis> 0, p3, 3.0 <emphasis role="comment">; linear time function from 0 to 3 seconds</emphasis> |
| 38 |
<emphasis role="opc">lorisread</emphasis> ktime, "clarinet.sdif", 1, 1, 1, 1, .001 |
| 39 |
asig <emphasis role="opc">lorisplay</emphasis> 1, 1, 1, 1 |
| 40 |
<emphasis role="opc">out</emphasis> asig |
| 41 |
<emphasis role="oblock">endin</emphasis></programlisting> |
| 42 |
</example> |
| 43 |
|
| 44 |
<example> |
| 45 |
<title>Add tuning and vibrato</title> |
| 46 |
<programlisting> |
| 47 |
<emphasis role="comment">; Play the partials in clarinet.sdif |
| 48 |
; from 0 to 3 sec with 1 ms fadetime |
| 49 |
; adding tuning and vibrato, increasing the |
| 50 |
; "breathiness" (noisiness) and overall |
| 51 |
; amplitude, and adding a highpass filter. |
| 52 |
;</emphasis> |
| 53 |
<emphasis role="oblock">instr 2</emphasis> |
| 54 |
ktime <emphasis role="opc">linseg</emphasis> 0, p3, 3.0 <emphasis role="comment">; linear time function from 0 to 3 seconds</emphasis> |
| 55 |
|
| 56 |
<emphasis role="comment">; compute frequency scale for tuning</emphasis> |
| 57 |
<emphasis role="comment">; (original pitch was G#4)</emphasis> |
| 58 |
ifscale <emphasis role="op">=</emphasis> <emphasis role="opc">cpspch</emphasis>(p4)<emphasis role="op">/</emphasis><emphasis role="opc">cpspch</emphasis>(8.08) |
| 59 |
|
| 60 |
<emphasis role="comment">; make a vibrato envelope</emphasis> |
| 61 |
kvenv <emphasis role="opc">linseg</emphasis> 0, p3/6, 0, p3/6, .02, p3/3, .02, p3/6, 0, p3/6, 0 |
| 62 |
kvib <emphasis role="opc">oscil</emphasis> kvenv, 4, 1 <emphasis role="comment">; table 1, sinusoid</emphasis> |
| 63 |
|
| 64 |
kbwenv <emphasis role="opc">linseg</emphasis> 1, p3<emphasis role="op">/</emphasis>6, 1, p3<emphasis role="op">/</emphasis>6, 2, 2<emphasis role="op">*</emphasis>p3<emphasis role="op">/</emphasis>3, 2 |
| 65 |
<emphasis role="opc">lorisread</emphasis> ktime, "clarinet.sdif", 1, 1, 1, 1, .001 |
| 66 |
a1 <emphasis role="opc">lorisplay</emphasis> 1, ifscale<emphasis role="op">+</emphasis>kvib, 2, kbwenv |
| 67 |
a2 <emphasis role="opc">atone</emphasis> a1, 1000 <emphasis role="comment">; highpass filter, cutoff 1000 Hz</emphasis> |
| 68 |
<emphasis role="opc">out</emphasis> a2 |
| 69 |
<emphasis role="oblock">endin</emphasis></programlisting> |
| 70 |
</example> |
| 71 |
|
| 72 |
<para>The instrument in the first example synthesizes a clarinet tone from |
| 73 |
beginning to end using partials derived from reassigned |
| 74 |
bandwidth-enhanced analysis of a three-second clarinet tone, stored in |
| 75 |
a file, <filename>clarinet.sdif</filename>. The instrument in Example 2 adds tuning and |
| 76 |
vibrato to the clarinet tone synthesized by instr 1, boosts its |
| 77 |
amplitde and noisiness, and applies a highpass filter to the |
| 78 |
result. The following score can be used to test both of the |
| 79 |
instruments described above.</para> |
| 80 |
|
| 81 |
<programlisting> |
| 82 |
<emphasis role="comment">; make sinusoid in table 1</emphasis> |
| 83 |
<emphasis role="stamnt">f</emphasis> 1 0 4096 10 1 |
| 84 |
|
| 85 |
<emphasis role="comment">; play instr 1</emphasis> |
| 86 |
<emphasis role="comment">; strt dur</emphasis> |
| 87 |
<emphasis role="stamnt">i</emphasis> 1 0 3 |
| 88 |
<emphasis role="stamnt">i</emphasis> 1 + 1 |
| 89 |
<emphasis role="stamnt">i</emphasis> 1 + 6 |
| 90 |
<emphasis role="stamnt">s</emphasis> |
| 91 |
|
| 92 |
<emphasis role="comment">; play instr 2</emphasis> |
| 93 |
<emphasis role="comment">; strt dur ptch</emphasis> |
| 94 |
<emphasis role="stamnt">i</emphasis> 2 1 3 8.08 |
| 95 |
<emphasis role="stamnt">i</emphasis> 2 3.5 1 8.04 |
| 96 |
<emphasis role="stamnt">i</emphasis> 2 4 6 8.00 |
| 97 |
<emphasis role="stamnt">i</emphasis> 2 4 6 8.07 |
| 98 |
|
| 99 |
<emphasis role="stamnt">e</emphasis></programlisting> |
| 100 |
|
| 101 |
<example> |
| 102 |
<title>Morph partials</title> |
| 103 |
<programlisting> |
| 104 |
<emphasis role="comment">; Morph the partials in clarinet.sdif into the |
| 105 |
; partials in flute.sdif over the duration of |
| 106 |
; the sustained portion of the two tones (from |
| 107 |
; .2 to 2.0 seconds in the clarinet, and from |
| 108 |
; .5 to 2.1 seconds in the flute). The onset |
| 109 |
; and decay portions in the morphed sound are |
| 110 |
; specified by parameters p4 and p5, respectively. |
| 111 |
; The morphing time is the time between the |
| 112 |
; onset and the decay. The clarinet partials are |
| 113 |
; shfited in pitch to match the pitch of the flute |
| 114 |
; tone (D above middle C). |
| 115 |
;</emphasis> |
| 116 |
<emphasis role="oblock">instr</emphasis> 1 |
| 117 |
ionset <emphasis role="op">=</emphasis> p4 |
| 118 |
idecay <emphasis role="op">=</emphasis> p5 |
| 119 |
itmorph <emphasis role="op">=</emphasis> p3 <emphasis role="op">-</emphasis> (ionset <emphasis role="op">+</emphasis> idecay) |
| 120 |
ipshift <emphasis role="op">=</emphasis> <emphasis role="opc">cpspch</emphasis>(8.02)<emphasis role="op">/</emphasis><emphasis role="opc">cpspch</emphasis>(8.08) |
| 121 |
|
| 122 |
<emphasis role="comment">; clarinet time function, morph from .2 to 2.0 seconds</emphasis> |
| 123 |
ktcl <emphasis role="opc">linseg</emphasis> 0, ionset, .2, itmorph, 2.0, idecay, 2.1 |
| 124 |
<emphasis role="comment">; flute time function, morph from .5 to 2.1 seconds</emphasis> |
| 125 |
ktfl <emphasis role="opc">linseg</emphasis> 0, ionset, .5, itmorph, 2.1, idecay, 2.3 |
| 126 |
kmurph <emphasis role="opc">linseg</emphasis> 0, ionset, 0, itmorph, 1, idecay, 1 |
| 127 |
<emphasis role="opc">lorisread</emphasis> ktcl, "clarinet.sdif", 1, ipshift, 2, 1, .001 |
| 128 |
<emphasis role="opc">lorisread</emphasis> ktfl, "flute.sdif", 2, 1, 1, 1, .001 |
| 129 |
<emphasis role="opc">lorismorph</emphasis> 1, 2, 3, kmurph, kmurph, kmurph |
| 130 |
asig <emphasis role="opc">lorisplay</emphasis> 3, 1, 1, 1 |
| 131 |
<emphasis role="opc">out</emphasis> asig |
| 132 |
<emphasis role="oblock">endin</emphasis></programlisting> |
| 133 |
</example> |
| 134 |
|
| 135 |
<example> |
| 136 |
<title>More morphing</title> |
| 137 |
<programlisting> |
| 138 |
<emphasis role="comment">; Morph the partials in trombone.sdif into the |
| 139 |
; partials in meow.sdif. The start and end times |
| 140 |
; for the morph are specified by parameters p4 |
| 141 |
; and p5, respectively. The morph occurs over the |
| 142 |
; second of four pitches in each of the sounds, |
| 143 |
; from .75 to 1.2 seconds in the flutter-tongued |
| 144 |
; trombone tone, and from 1.7 to 2.2 seconds in |
| 145 |
; the cat's meow. Different morphing functions are |
| 146 |
; used for the frequency and amplitude envelopes, |
| 147 |
; so that the partial amplitudes make a faster |
| 148 |
; transition from trombone to cat than the frequencies. |
| 149 |
; (The bandwidth envelopes use the same morphing |
| 150 |
; function as the amplitudes.) |
| 151 |
;</emphasis> |
| 152 |
<emphasis role="oblock">instr</emphasis> 2 |
| 153 |
ionset <emphasis role="op">=</emphasis> p4 |
| 154 |
imorph <emphasis role="op">=</emphasis> p5 <emphasis role="op">-</emphasis> p4 |
| 155 |
irelease <emphasis role="op">=</emphasis> p3 <emphasis role="op">-</emphasis> p5 |
| 156 |
|
| 157 |
kttbn <emphasis role="opc">linseg</emphasis> 0, ionset, .75, imorph, 1.2, irelease, 2.4 |
| 158 |
ktmeow <emphasis role="opc">linseg</emphasis> 0, ionset, 1.7, imorph, 2.2, irelease, 3.4 |
| 159 |
|
| 160 |
kmfreq <emphasis role="opc">linseg</emphasis> 0, ionset, 0, .75*imorph, .25, .25*imorph, 1, irelease, 1 |
| 161 |
kmamp <emphasis role="opc">linseg</emphasis> 0, ionset, 0, .75*imorph, .9, .25*imorph, 1, irelease, 1 |
| 162 |
|
| 163 |
<emphasis role="opc">lorisread</emphasis> kttbn, "trombone.sdif", 1, 1, 1, 1, .001 |
| 164 |
<emphasis role="opc">lorisread</emphasis> ktmeow, "meow.sdif", 2, 1, 1, 1, .001 |
| 165 |
<emphasis role="opc">lorismorph</emphasis> 1, 2, 3, kmfreq, kmamp, kmamp |
| 166 |
asig <emphasis role="opc">lorisplay</emphasis> 3, 1, 1, 1 |
| 167 |
<emphasis role="opc">out</emphasis> asig |
| 168 |
<emphasis role="oblock">endin</emphasis></programlisting> |
| 169 |
</example> |
| 170 |
|
| 171 |
<para>The instrument in the first morphing example performs a sound morph |
| 172 |
between a clarinet tone and a flute tone using reassigned |
| 173 |
bandwidth-enhanced partials stored in <filename>clarinet.sdif</filename> and |
| 174 |
<filename>flute.sdif</filename>.</para> |
| 175 |
|
| 176 |
<para>The morph is performed over the sustain portions of the tones, |
| 177 |
2. seconds to 2.0 seconds in the case of the clarinet tone and .5 |
| 178 |
seconds to 2.1 seconds in the case of the flute tone. The time index |
| 179 |
functions, ktcl and ktfl, align the onset and decay portions of the |
| 180 |
tones with the specified onset and decay times for the morphed sound, |
| 181 |
specified by parameters p4 and p5, respectively. The onset in the |
| 182 |
morphed sounds is purely clarinet partial data, and the decay is |
| 183 |
purely flute data. The clarinet partials are shifted in pitch to match |
| 184 |
the pitch of the flute tone (D above middle C).</para> |
| 185 |
|
| 186 |
<para>The instrument in the second morphing example performs a sound morph |
| 187 |
between a flutter-tongued trombone tone and a cat's meow using |
| 188 |
reassigned bandwidth-enhanced partials stored in <filename>trombone.sdif</filename> and |
| 189 |
<filename>meow.sdif</filename>. The data in these SDIF files have been channelized and |
| 190 |
distilled to establish correspondences between partials.</para> |
| 191 |
|
| 192 |
<para>The two sets of partials are imported and stored in memory |
| 193 |
locations labeled 1 and 2, respectively. Both of the original sounds |
| 194 |
have four notes, and the morph is performed over the second note in |
| 195 |
each sound (from .75 to 1.2 seconds in the flutter-tongued trombone |
| 196 |
tone, and from 1.7 to 2.2 seconds in the cat's meow). The different |
| 197 |
time index functions, kttbn and ktmeow, align those segments of the |
| 198 |
source and target partial sets with the specified morph start, morph |
| 199 |
end, and overall duration parameters. Two different morphing functions |
| 200 |
are used, so that the partial ammplitudes and bandwidth coefficients |
| 201 |
morph quickly from the trombone values to the cat's-meow values, and |
| 202 |
the frequencies make a more gradual transition. The morphed partials |
| 203 |
are stored in a memory location labeled 3 and rendered by the |
| 204 |
subsequent lorisplay instruction. They could also have been used as a |
| 205 |
source for another morph in a three-way morphing instrument. The |
| 206 |
following score can be used to test both of the instruments described |
| 207 |
above.</para> |
| 208 |
|
| 209 |
<programlisting> |
| 210 |
<emphasis role="comment">; play instr 1</emphasis> |
| 211 |
<emphasis role="comment">; strt dur onset decay</emphasis> |
| 212 |
<emphasis role="stamnt">i</emphasis> 1 0 3 .25 .15 |
| 213 |
<emphasis role="stamnt">i</emphasis> 1 + 1 .10 .10 |
| 214 |
<emphasis role="stamnt">i</emphasis> 1 + 6 1. 1. |
| 215 |
<emphasis role="stamnt">s</emphasis> |
| 216 |
|
| 217 |
<emphasis role="comment">; play instr 2</emphasis> |
| 218 |
<emphasis role="comment">; strt dur morph_start morph_end</emphasis> |
| 219 |
<emphasis role="stamnt">i</emphasis> 2 0 4 .75 2.75 |
| 220 |
|
| 221 |
<emphasis role="stamnt">e</emphasis></programlisting> |
| 222 |
|
| 223 |
|
| 224 |
<bridgehead>Credits</bridgehead> |
| 225 |
|
| 226 |
<para>This implementation of the Loris unit generators was written by Kelly |
| 227 |
Fitz (<ulink |
| 228 |
url="mailto:[email protected]">[email protected]</ulink>).</para> |
| 229 |
<para>It is patterned after a prototype implementation of the <emphasis>lorisplay</emphasis> unit generator written by Corbin Champion, and based on the method of Bandwidth-Enhanced Additive Synthesis and on the sound morphing algorithms implemented in the Loris library for sound modeling and manipulation. The opcodes were further adapted as a plugin for Csound 5 by Michael Gogins.</para> |
| 230 |
|
| 231 |
</section> |