Csound Csound-dev Csound-tekno Search About

Re: Chebyshev polynomials (was: Re: Distorsion)

Date1999-04-20 00:39
FromHans Mikelson
SubjectRe: Chebyshev polynomials (was: Re: Distorsion)
>Now look at the table. It has a huge DC-offset and its zero crossing
>is not in the middle.

Try using only odd harmonics with values less than one and make sure the
input signal is less than 1 in amplitude.

This does not sound the greatest to my ears but here is an example:

; ORCHESTRA
sr     =    44100
kr     =    4410
ksmps  =    10
nchnls =    2
gaout  init 0

       instr    2

idur   =        p3
iamp   =        p4
ifqc   =        cpspch(p5)

aamp   linseg   0, .01, 1, idur-.03, 1, .01, 0, .01, 0
asig   pluck    iamp, ifqc, ifqc, 0, 1
aflt   butterlp asig, 8000
gaout  =        gaout + aflt*aamp

       endin

       instr    3

idur   =        p3
iamp   =        p4
ifqc   =        cpspch(p5)

aamp   linseg   0, .01, 1, idur-.02, 1, .005, 0, .005, 0
asig   oscil    iamp, ifqc, 1
gaout  =        gaout + asig*aamp

       endin

; Guitar Amp
       instr    11

idur   =        p3
ipre   =        p4
ipost  =        p5
ish1   =        p6
adel   init     0
achrs1 init     0
achrs2 init     0

asig   =        gaout/50000*ipre
adst   table3   asig, ish1, 1, .5
ascl   =        adst*50000

arat1  expseg   .2, idur, 8
alfo1  oscil    4, arat1, 1
achrs1 vdelay3  ascl+achrs1*.95, 10+alfo1, 50
alfo2  oscil    4, arat1, 1, .25
achrs2 vdelay3  ascl+achrs2*.95, 10+alfo2, 50

krms   rms      ascl, 100

apeq1  pareq    ascl,  100-krms/100, 1.2, .7, 0
apeq2  pareq    apeq1, 400-krms/20, .5, .7, 0
apeq   pareq    apeq2, 1500-krms/7, 1.5, .7, 0
aflt   butterlp apeq, 6000

avrbl1 nestedap  aflt*.5+adel*.2, 2, 1, .053, .1, .033, .12
avrbr1 nestedap  aflt*.5-adel*.2, 2, 1, .051, .1, .031, .12
avrbl2 nestedap  avrbl1-adel*.2, 3, 1, .253, .04, .133, .03, .071, .02
avrbr2 nestedap  avrbr1+adel*.2, 3, 1, .251, .04, .141, .03, .063, .02

avrbl  =         avrbl1+avrbl2
avrbr  =         avrbr1+avrbr2

adflt  butterlp  avrbl+avrbr, 500
adel   delay     adflt, .101

gaout  =        0
aoutl  butterhp aflt*ipost+avrbl*.8+achrs1*.5, 20
aoutr  butterhp aflt*ipost+avrbr*.8+achrs2*.5, 20
       outs     aoutl, aoutr

       endin

; SCORE
f1 0 8192 10 1

;   Sta  Dur  Amp   Pitch  Pre  Post  Shape1  Shape2
;i1  0    .5   10000 7.00   10   1     0       0
;i1  +    .    .     .      .    .     .1      .
;i1  .    .    .     .      .    .     .2      .
;i1  .    .    .     .      .    .     .1     -.1
;i1  .    .    .     .      .    .     .2     -.2

;   Sta  Dur   Amp   Pitch
i2  0    4.5   5000  6.02
i2  0    4.5   5000  7.06

;i2  1.25  .25   2000  7.07
;i2  +    .     3000  7.00
;i2  .    .     4000  8.00
;i2  .    .     5000  8.05
;i2  .    .     6000  9.00

;i2  2.75 .25   6000  7.07
;i2  +    .     7000  7.00
;i2  .    .     8000  8.00
;i2  .    .     9000  8.05
;i2  .    .    10000  9.00


;   Sta  Dur   Amp   Pitch
;i2  4.5  4.5   5000  5.10
;i2  4.5  4.5   5000  7.05

;i2  5.75 .25   2000  7.07
;i2  +    .     3000  7.00
;i2  .    .     4000  8.00
;i2  .    .     5000  8.05
;i2  .    .     6000  9.00

;i2  7.25 .25   6000  7.07
;i2  +    .     7000  7.00
;i2  .    .     8000  8.00
;i2  .    .     9000  8.05
;i2  .    .    10000  9.00

;           GEN Int Scaling  DC Fund 2nd 3rd  4th  5th
f11 0 65537 13  1   1        0  .5   0   .5  0    .5   0   0
;    Sta  Dur  Pre  Post  Table
i11  0    5.5   2    .3    11