% Talkie library % Copyright 2011 Peter Knight % This code is released under GPLv2 license. % % Calculate LPC reflection coefficients function [k,g] = levinsonDurbin(r,poles) k(1)=1; a=zeros(1,poles+1); at=zeros(1,poles+1); e=r(1); for s=1:poles k(s+1)=-r(s+1); for t=1:s-1 at(t+1) = a(t+1); k(s+1) = k(s+1) - a(t+1) * r(s-t+1); end if abs(e)