René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback
 

Random pitch [CSound effect]

Random pitch changes the frequency of the output signal randomly.
sr     = 44100
kr     = 4410
nchnls = 2

instr 1
  ilen  =  p3
  iamp  =  p4
  ifrq  =  cpspch(p5)

  i_rand_amp = p6 * ifrq
  i_rand_frq = p7

  kenv  linseg  0, ilen/4, 1, ilen/2, 1, ilen/4, 0
  krand randh   i_rand_amp , i_rand_frq
  kpan  line    0, ilen, 1
  asig  oscil   iamp*kenv, ifrq +krand , 1

  out asig*kpan, asig*(1-kpan)
endin
f1 0 2048 10   1   1   1   1

i1      0  4   9000  7.02 0.01  20
i1      3  4   9000  7.04 0.03  15
i1      6  4   9000  7.06 0.09  10