torchlpc icon indicating copy to clipboard operation
torchlpc copied to clipboard

Final delay values 'zf'

Open ybourdin opened this issue 7 months ago • 1 comments

Hello, Thank you for your work. It would be great to be able to get the final delay values 'zf' like with scipy.signal.lfilter, so that on the next calls to sample_wise_lpc with consecutive buffers, one can pass zi = zf. zf can be obtained like this, but it's not so obvious:

y1 = sample_wise_lpc(x[:, :L], a, zi=None)
order = a.size(-1)
zf = y1[: -order:].flip(1)
y2 = sample_wise_lpc(x[:, L:), a, zi=zf)

ybourdin avatar Apr 16 '25 14:04 ybourdin

Hi @ybourdin , glad to know you're interested in our work! Good suggestion! I suggest having a separate function like sample_wise_lpc_zf that implements what you describe and returns a tuple (y, zf) so we don't introduce backwards incompatible changes. Please feel free to submit a PR, and we'll review it.

yoyolicoris avatar Apr 16 '25 18:04 yoyolicoris

Hi @ybourdin , the feature has been added to the main branch f50b419ea58dd1dc26fab3e9602cc3bef1a0dbbb

yoyolicoris avatar May 29 '25 14:05 yoyolicoris