Toot 8

Now instead of continuing to enhance the same instrument, we will design a totally different one. In it we'll play a soundfile from disk in the orchestra, apply an amplitude envelope to it, and add some reverb. To do this we will employ Csound's soundin and reverb generators. The first is used like this:

a1 soundin ifilcod[, iskiptime[, iformat]]

soundin derives its signal from a pre-existing file. ifilcod is either the filename in double quotes, or an integer suffix (.n) to the name "soundin". Thus the file soundin.5 could be referenced either by the quoted name or by the integer 5. To read from 500ms into this file we might say (i.e. to skip the first 500ms):

a1 soundin "soundin.5", .5

The Csound reverb generator is actually composed of four parallel comb filters plus two alpass filters in series. Although we could design a variant of our own using these same primitives, the preset reverb is convenient, and simulates a natural room response via internal parameter values. Only two arguments are required the input (asig) and the reverb time (krvt)

ar reverb asig, krvt

Here's a schematic representation of the instrument.

[TOOT 8 Schematic]

TOOT 8 Schematic

The soundfile instrument with artificial envelope and a reverb (included directly) is as follows:

<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>

          instr 8

idur      =         p3
iamp      =         p4
iskiptime =         p5
iattack   =         p6
irelease  =         p7
irvbtime  =         p8
irvbgain  =         p9

kamp      linen     iamp, iattack, idur, irelease
asig      soundin   "fox.wav", iskiptime
arampsig  =         kamp * asig
aeffect   reverb    asig, irvbtime
arvbretrn =         aeffect * irvbgain

          out       arampsig + arvbretrn

          endin

</CsInstruments>
<CsScore>

;ins strt dur  amp  skip atk  rel       rvbt rvbgain
i8   0    2.28 .3   0    .03  .1        1.5  .3
i8   4    1.6  .3   1.6  .1   .1        1.1  .4
i8   5.5  2.28 .3   0    .5   .1        2.1  .2
i8   6.5  2.28 .4   0    .01  .1        1.1  .1
i8   8    2.28 .5   0.1  .01  .1        0.1  .1

e
</CsScore>
</CsoundSynthesizer>