Csound Csound-dev Csound-tekno Search About

Re: problems with envelope

Date1998-07-27 06:17
FromMark T Vigorito
SubjectRe: problems with envelope
Hi all;
	I've been fooling with the interesting orc posted by Arne Hanna
recently-- I have a fix for the popping envelope problem.
	First I added a .04 second rise to the two "kenv linen ..." 
statements within the timout-reinit loops. That cleaned up most of the
popping. Then I added an overall declicking envelope which cleared up
almost all of the remaining pops. Increasing kr to 2205 also gives a
noticable improvement in sound quality. The modified .orc is is listed
below. 
	
	It would be nice to extend the overall note duration so that the
last timout cycle could be completed. I tried doing this using linenr and
linsegr, but neither would increase the note duration beyond p3. Ideas,
anyone?

Cheers,
M. Vigorito
mtv@u.arizona.edu	 


Arne Hanna writes:

Hi folks.  The orc/sco combo below uses phasor and timout to produce
streams of notes at rates independent of p3.  This method was suggested
to me some time ago by Jean Piche in response to my lamentations regarding
difficulties in generating repeating rhythmic patterns using standard
csound techniques.  [...]

;This orchestra is an attempt at realising pitch and onset-time
;using Markov processes.  The current problem has to do
;with clicking of envelopes    A.D. Hanna
;modified envelopes to reduce popping M Vigorito
sr = 44100
kr = 882
ksmps = 50
nchnls = 2

ga1 init 0

instr 1
itablesize = 32 ;pitch tables 2 and 3 are indexed from 0 to 31
iratchoose = p9 ;determines which of two tempos are used

kdclick linseg 0,.04,1,p3-.08,1,.04,0

;A neat way to represent Markov chains.
;Choose between two subsets of the set "furniture"
if (iratchoose == 0) igoto furniture.to.sit.on
if (iratchoose == 1) igoto furniture.to.put.stuff.in

;----------------------------------------------------------------------
furniture.to.sit.on:
        ;being here depends on outcome of p9

kindex phasor p5*p6 
        plantatulip:
        kenv linen 1,.04,1/p5,1/p5*.5

        inotechoose = p8
        ;Choose between two pitch tables
        ;the second of which is a transposition
        ;of the first in the order of 1 semitone.
        if (inotechoose == 1) igoto chair
        if (inotechoose == 0) igoto sofa
        
        ;--------------------------------------------------
        chair:  ;being here depends on the outcome of p9 and p8
                ipitch table i(kindex)*itablesize,2
                igoto resume
        
        ;--------------------------------------------------
        sofa:   ;being here depends on the outcome of p9 and p8
                ipitch table i(kindex)*itablesize,3
                igoto resume

        resume:
        timout 0,1/p5,pluckatulip
        reinit plantatulip

;----------------------------------------------------------------------
furniture.to.put.stuff.in:
        ;being here depends on outcome of p9
        kindex phasor (p5*p6)*1.125 ;varies phase of lfo vs beat 
        ;thus creating melodic patterns
        plantadaisy:
        kenv linen 1,.04,1/p5,1/p5*.5

        inotechoose = p8
        if (inotechoose == 1) igoto bookcase
        if (inotechoose == 0) igoto wardrobe

        ;-----------------------------------------------
        bookcase:       ;being here depends on the outcome of p9 and p8
                        ipitch table i(kindex)*itablesize,2
                        igoto continue

        ;--------------------------------------------------
        wardrobe:       ;being here depends on the outcome of p9 and p8
                        ipitch table i(kindex)*itablesize,3
                        igoto continue

        continue:
        timout 0,1/p5,pluckatulip
        reinit plantadaisy

pluckatulip:

a2    oscili ampdb(p4)*kenv*kdclick,cpspch(ipitch+p7),1 ;p7 = octave
transposition  
ga1=a2+ga1
outs a2,a2

endin

instr 50                   

kfreq expseg 0.01,p3*.2,.4,p3*.2,1,p3*.2,1.5,p3*.2,.1,p3*.2,.05
k1 oscili .5,kfreq*p4,1 ;kfreq*p4=cps of pan
k2 = .5+k1
k3 = 1-k2
a1 reverb2 ga1,2.1,.5
outs k2*a1,a1*k3*(-1)
ga1=0
endin

;score

f1 0 8192 10 1
f2 0 64 -2 7.10 7.02 7.07 8.05 9.02 7.05 8.10 8.02 7.07 8.07 8.05 8.02 8.10
9.02 7.07 9.07 8.00 7.02 8.02 8.10 7.07 7.05 8.00 8.02 9.02 9.02 8.10 7.07
8.05 9.02 8.02 9.07 
f3 0 64 -2 7.11 7.03 7.08 8.06 9.03 7.06 8.11 8.03 7.08 8.08 8.06 8.03 8.11
9.03 7.08 9.08 8.01 7.03 8.03 8.11 7.08 7.06 8.01 8.03 9.03 9.03 8.11 7.06
8.06 9.03 8.03 9.08 




i50 0   28     10


; ------- begin of field 1 --- seconds: 0.00 - 28.00 --------
;ins    time    dur     p4      p5      p6      p7      p8      p9

i1      0       0.25    65      3.29    0.46    -1      0       1       
i1      0.25    0.375   65      3.36    0.78    1       1       0       
i1      0.625   1       65      6.95    0.39    1       1       1       
i1      1.625   1.25    65      3.32    0.53    -1      1       0       
i1      2.75    0.25    65      4.2     0.86    1       0       1       
i1      3.75    1.25    65      7.36    0.15    1       0       0       
i1      4.125   1       65      6.2     0.99    -1      0       0       
i1      4.375   0.375   65      1.12    0.69    1       0       0       
i1      4.75    0.25    65      4.28    0.42    -1      0       1       
i1      5.75    0.375   65      1.69    0.18    1       0       1       
i1      6.875   1       65      8.19    0.91    1       1       0       
i1      7.875   1.25    65      3.28    0.34    -1      0       1       
i1      8.25    0.25    65      3.3     0.11    1       0       0       
i1      8.5     1.25    65      1.97    1       1       1       0       
i1      8.875   1       65      2.82    0.11    -1      0       0       
i1      9.875   0.375   65      3.4     0.21    1       1       0       
i1      11      0.25    65      3.01    0.97    1       1       1       
i1      12      0.375   65      5.54    0.18    -1      1       0       
i1      12.375  1       65      1.44    0.98    1       1       1       
i1      12.625  1.25    65      4.33    0.86    1       1       1       
i1      13      0.25    65      6.15    0.77    -1      1       1       
i1      14      1.25    65      6.48    0.24    1       1       0       
i1      15.125  1       65      3.91    0.62    -1      1       1       
i1      16.125  0.375   65      1.12    0.33    1       0       1       
i1      16.5    0.25    65      7.43    0.73    1       1       1       
i1      16.75   0.375   65      2.59    0.9     -1      0       0       
i1      17.125  1       65      5.57    0.13    1       0       1       
i1      18.125  1.25    65      4.08    0.77    1       0       0       
i1      19.25   0.25    65      8.57    0.37    -1      0       1       
i1      20.25   1.25    65      2.42    0.3     1       1       0       
i1      20.625  1       65      4.24    0.52    1       0       1       
i1      20.875  0.375   65      5.75    0.67    -1      1       1       
i1      21.25   0.25    65      1.24    0.64    1       0       0       
i1      22.25   0.375   65      8.26    0.75    1       1       0       
i1      23.375  1       65      7.23    0.24    -1      0       0       
i1      24.375  1.25    65      3.9     0.62    1       1       1       
i1      24.75   0.25    65      6.14    0.58    -1      1       0       
i1      25      1.25    65      7.11    0.96    1       0       0       
i1      25.375  1       65      6.33    0.14    1       1       0       
i1      26.375  0.375   65      8.53    0.92    -1      0       0       
i1      27.5    0.25    65      7.9     0.4     1       0       1       

; ------- end of field 1 --- number of events: 41 -------






Date1998-07-27 20:56
FromAnders Andersson
SubjectRe: problems with envelope
>It would be nice to extend the overall note duration so that the
>last timout cycle could be completed. I tried doing this using linenr and
>linsegr, but neither would increase the note duration beyond p3. Ideas,
>anyone?

Well.. actually you can do something like this:

instr 1
   kvol   linseg   0, 0.05, p4, p3-0.05, p4, 2, 0
   p3   =   p3+2
   [...]
endin

This will set the note to last 2 seconds more than stated in the score.
I didn't had time to check if this suits your needs, but still, it's a nice
way to extend a note's duration.

.--- -- -  -
| Anders "Pipe/Nature" Andersson, pipe@algonet.se
: