Csound Csound-dev Csound-tekno Search About

RE: Delay stuff again

Date1999-04-28 04:41
FromDavid Boothe
SubjectRE: Delay stuff again
Pat-

Looks like this instr way have been part of a larger orchestra. zak opcodes
(such as zar & zaw) are used for routing & patching signals - rather like
patchcords or busses on a mix console. No real need for them in a simple
instrument, but they would be helpful to do recirculatating delays and other
more complex stuff. 

Try the following orch/sco. It has 2 delay lines - a simple one (instr 101)
and one with an additional tap (instr 102). You can add more deltap outputs
if you want. Watch out for line wrapping in this example.

BTW, if you haven't already, you might go through a tutorial or two. Richard
Boulanger's is availbale in the pdf supplement (among other places) and the
orch/sco sets can be downloaded and run. Go to:
http://web2.airmail.net/dboothe/download.htm and get the Supplement. Link to
the zipped orc/scos there also.

Hope this helps.

-David.
;==============================================================
;dlaydemo.orc - demonstrates delay with a swept oscil
sr     =   44100
kr     =    4410
ksmps  =      10
nchnls =       2

;gaSend is the input to the delay line instr
gaSend init 0      ;we want initialized clean
              

instr 01 ;a simple oscil instrument -----------------------------

 idur    =  p3      ;duration of note
 iamp    =  p4      ;amplitude of oscil
 istrt   =  p5      ;start freq of oscil sweep
 iend    =  p6      ;end freq of oscil sweep
 igate   =  .05     ;gate times for linen
 ifn     =  1       ;function table for sine

 aSweep line    istrt, idur, iend        ;generate sweep control sig
 aSig   oscil   iamp, aSweep, ifn        ;generate swept sine tone
 aDir   linen   aSig, igate, idur, igate ; de-click 
 
 gaSend   =     aDir 
        outs1   aDir  ;direct sound out the left channel
endin


instr 101 ; simple delay line ---------------------------------

 idlatim  =  p4  ;p4 determines the delay time

 aDelay delay   gaSend, idlatim  ;delay it
        outs2   aDelay           ;delayed sound out the right channel
endin

instr 102 ; delay line with one tap ------------------------------------

 igain    =  p4  ;gain of final delay out relative to tap
 itap1    =  p5  ;p5 is delay time of tap
 idlatim  =  p6  ;p6 determines the final delay time 

 aDelay delayr   idlatim  ;final delay
 aTap   deltap   itap1    ;delay tap
        delayw   gaSend   ;delay line input

 aMix   =       aTap+(aDelay*igain)
        outs2   aMix ;delayed sound out the right channel
endin

;====================================================================
;dlaydemo.sco - let's hear it

f1 0 16384 10 1 ;simple sine

;p1   p2  p3   p4     p5   p6
i101  0   26   5                ;initialize the delay line
i1    0   20   10000  100 1000  ;play a note

i102  30  26   .75   2.5  5      ;initialize tapped delay line
i1    30  20   7000  1000 100    ;play a note