Csound Csound-dev Csound-tekno Search About

LPC - how do you make it work well?

Date1999-02-20 20:23
FromSean Costello
SubjectLPC - how do you make it work well?
Hi all:

Just started experimenting with LPC.  So far, every sound I have tried
to produced has ended up sounding overly "liquid" - i.e. the filtering
seems to change drastically between frames, resulting in a burbling
sound that resembles a filter being modulated by white noise.  Is this
just the inevitable result of LPC?  Or are there some tricks (different
analysis parameters, different synthesis parameters) that produce
smoother results?

One other question: Does the Csound lpreson opcode interpolate between
coefficients for overlapping frames, or does it just spit out the frames
with no overlapping?

Thanks,

Sean Costello

P.S. If anyone out there knows of any LPC tutorials that explain how to

Date1999-02-23 21:17
FromErik Spjut
SubjectRe: LPC - how do you make it work well?
Try/Modify these (the original soundfile was a 1 s marimba note at middle
C, but you can use whatever you like):

sr = 44100
kr = 44100
ksmps = 1
nchnls = 1

      instr 1 ; vary pitch p4=pitch multiplier
iharm  =       int(44100/(262*p4)/2)-1  ;Chz max harm w/o alias
kenv   linseg  0,0.01,1,1,1             ;get started right
kmovit linseg  0,p3,1.0029   ;1.0029 is duration of original file
krmsr,krmso,kerr,kcps lpread kmovit, "Marimba.lp"
axit   buzz    1,kcps*p4,iharm,1,-1
araw   lpreson axit
afinal gain    araw, krmso*kenv,20
 out afinal
      endin


      instr 2 ; play backwards & vary pitch p4=pitch multiplier
iharm  =       int(44100/(262*p4)/2)-1  ;Chz max harm w/o alias
kenv   linseg  1,p3-0.01,1,0.01,0,1,0             ;get ended right
kmovit linseg  1.0029, p3, 100/44100,1,100/44100
  ;1.0029 is duration of original file, 100/44100 is to prevent reading past 0
krmsr,krmso,kerr,kcps lpread kmovit, "Marimba.lp"
axit   buzz    1,kcps*p4,iharm,1,-1
araw   lpreson axit
afinal gain    araw, krmso*kenv,20
 out afinal
      endin

      instr 3 ; hold pitch, shift formants p4=formant multiplier
iharm  =       int(44100/(262)/2)-1  ;Chz max harm w/o alias
kenv   linseg  0,0.01,1,1,1             ;get started right
kmovit linseg  0,p3,1.0029   ;1.0029 is duration of original file
krmsr,krmso,kerr,kcps lpread kmovit, "Marimba.lp"
axit   buzz    1,kcps,iharm,1,-1
araw   lpfreson axit,p4
afinal gain    araw, krmso*kenv,20
 out afinal
      endin

*******Score****************
f1 0 16384 10 1
i1 0 2 0.5
i1 2 2 0.75
i1 4 1 1
i1 5 1 1.5
i1 6 1 2

i2 8 1 1
i2 9 3 2
i2 12 1 1.3749831

i3 14  1 0.5
i3 15  1 1
i3 16 1 2

lpreson and lpfreson interpolate between frames but unless kr=sr you'll get
a buzz or noise at kr. I suspect that's your burble. I find the opcodes
very useful but the use of the parameters is a bit obscure.

At 12:23 PM -0800 2/20/99, Sean Costello wrote:
>Hi all:
>
>Just started experimenting with LPC.  So far, every sound I have tried
>to produced has ended up sounding overly "liquid" - i.e. the filtering
>seems to change drastically between frames, resulting in a burbling
>sound that resembles a filter being modulated by white noise.  Is this
>just the inevitable result of LPC?  Or are there some tricks (different
>analysis parameters, different synthesis parameters) that produce
>smoother results?
>
>One other question: Does the Csound lpreson opcode interpolate between
>coefficients for overlapping frames, or does it just spit out the frames
>with no overlapping?
>
>Thanks,
>
>Sean Costello
>
>P.S. If anyone out there knows of any LPC tutorials that explain how to
>use it musically, I would love to seek them out.


-------------------------------------------------------------------------------
Erik Spjut (spyoot, rhymes with cute) - Associate Professor of Engineering
and  Associate Director for Engineering Computing,  Center for Design Education
Harvey Mudd College, Claremont, CA 91711-5990  USA
Erik_Spjut@hmc.edu      Ph & Voice mail (909) 607-3890      Fax (909) 621-8967