Csound Csound-dev Csound-tekno Search About

Re: phasor

Date1999-08-22 14:10
FromRoss Bencina
SubjectRe: phasor
Sherlock asks:
>Could someone take a look at this and tell me where I went wrong?

Ok, I'll have a go...


> sr              =               44100
> kr              =               4410
> ksmps   =               10
> nchnls  =               1
...

>k1      phasor p5

^^^^^^^^^this generates a moving phase from 0 to 1, for the notes given you
have it running at 440 or 660 Hz

>kpch    table   k1 * 12, 2

^^^^^^^^^this generates an lookup on table 2 using the default raw lookup
mode, which will mean you're only scanning the first 12 of 4096 values. you
could try

kpch    table   k1 * 12, 2, 1

but for values of k1 greater than (1./12.) or less than 0 the table lookup
is clamped so you would end up with a lot of 0

>a1      oscil   p4, cpspch(kpch), 2

^^^^^^^^^^I'm not sure kpch is really an octave pitch class when modulated
at audio rate (440Hz), but I'll accept that that's what you're trying to do.


>        out a1
>
> endin


>;Function 1 uses the GEN8 subroutine to compute a wave
>f1  0 4096 10   1
>f2  0 4096 10   1  .5 .333 .25 .2 .166 .142 .125 .111 .1 .09 .083 .076
>.071 .066 .062

^^^^^^^^^^^functions 1 and 2 above use GEN10 which isn't in line with your
use of cpspch(), but otherwise would be OK unless you're trying to lookup a
sequence of pitches from f2 (as Richard supposes in which case you shouldn't
be using gen10, and gen 8 is going to glide all over the place - but perhaps
that's what you're after.


>;inst  start   duration  p4         p5          p6    p7      p8   p9
>
>i1       0       1.75    10000       440
>i1       2       1.75    20000       660
>e



Ross.