cSounds.com - tutorials - An Instrument Design TOOTorial
Toot 8: Soundin

Now instead of continuing to enhance the same instrument, we will design a totally different one. In it we'll read a soundfile into 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 described as:

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:

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

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


[index] [prev] [next]


[+] Home

Csound Manual

[+] alpass
[+] comb
[+] reverb
[+] soundin


[+] Toot08.mp3 81k


          instr 8

idur      =         p3

iamp      =         p4

iskiptime =         p5

iattack   =         p6

irelease  =         p7

irvbtime  =         p8

irvbgain  =         p9

kamp      linen     iamp, iattack, idur, irelease

asig      soundin   "hellorcb.aif", iskiptime

arampsig  =         kamp * asig

aeffect   reverb    asig, irvbtime

arvbretrn =         aeffect * irvbgain

          out       arampsig + arvbretrn



;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

Figure 8: Soundin

[+] Any questions, comments or suggestions? please let us know: