< Back to IRCAM Forum

Translating a loop into lisp code

Hi,
I’d need to translate this loop (see the attached image) into lisp code. The concept is to distort each bpf of a bpf-lib with another bpf-lib on the base of a percentage value of distortion (assuming, of course, that the interpolation step is 100; so that if I pick with “nth” the interpolated bpf #0, the distortion is at its minimum, while if I pick the bpf #99 the distortion is at its maximum). As a patch, the loop works very slowly, so I’d hope to have a code version of it that “optimizes” its functioning… Any suggestion about how to do it? Thanks for your kind attention.
Best,
Francesco Vitale

bpf-lib-morph-%.tiff (103 KB)

Here’s also the patch.
Best,
Francesco

percent.omp (10.5 KB)

I see that the image wasn’t correctly attached. So here it is again. I also take this opportunity to repeat my question: how can this loop be translated into lisp code?
Best,
Francesco Vitale

bpf-lib-morph.png

(loop for a in input0
for b in input1
for c in input2
collect (nth c (bpf-interpol a b …[other args]…)))

or using MAPCAR:

(mapcar #’(lambda (a b c) (nth c (bpf-interpol a b …[other args]…))) input0 input1 input2)