< Back to IRCAM Forum

LISP code for a specifica problem - Help

Hi All,

I am trying to resolve a specific poblem, but I can not find out the right Lisp code to do it, so any help will be appreciated, thanks in advance.

My problem is the following: given a whatever series of pitches, I want to randomly transpose some of them to superior octave, and then repeat the cycle until all pitches are in the superior octave.

i have set the code for random transposition:

(lambda (series)

(loop for i in (flat series) collect
(om::omif
(and
(< i (om::om+ 1200 (om::list-max series)))
(> i (om::list-min series)))
(om::om+ i (om:nth-random '(0 1200)))
i))
)

and tried to use it inside an iterative process:

(lambda (series)
(flat
(loop for i = series
while (equal (om::list-min i) (om::list-min series))
do (loop for k in (flat i) collect
(om::omif
(and
(< k (om::om+ 1200 (om::list-max series)))
(> k (om::list-min series)))
(om::om+ k (om:nth-random '(0 1200)))
k))
collect i))
)

but OpenMusic go into an infinite loop. Or, in another attempt woith different code, it transposes also more than one octave high the already transposed pitches.

I have looked for useful examples in some LISP book, but I can not arrive to a solution.

Many thanks in advance, ciao

Fabio

Dear Fabio,

your description of a superior octave is rather imprecise. But anyhow, i did an example here with a superior register based on an octave. I am sure you can adapt it. It is not in lisp code, but in VPL. In lisp code it is even easier.

Here you go:


The patch:
rand-reg-trans.omp (32.2 KB)

tell me if you need a lisp version :slight_smile: or some modifications…

Best
K

1 Like

Dear Karim,

Thank you very much for fast reply. Yes, sorry, superior octave indeed is higher octave. “Superior” is good in Italian…
The patch is good for my aims, now I am going to try to convert it into LISP, I hope I will need not further help… Otherwise we will meet again :slight_smile:
Meanwhile thank you very much again, ciao

Fabio

Sorry, it’s always me.

I have tested more deeply the patch, there is only a little difference respect to what I am looking for: the already transposed pitches in successive loop cycles sometimes can return to original register, but I would not want that.

To try to more specific, I am searching something of similar: suppose we have the sequence c3, d3, e3, f3, g3; in first loop cycle I could have c3, d4, e3, f3, g4, for example, that is notes d and g have been randomly selected and transposed, and will remain always into the higher register. In second cycle, for example, I could have c4, d4, e3, f4, g4, that is the new transposed pitches now are c and f, so that in final loop cycle I will have only the last note to be transposed, that is e.

I hope I am clear, my English is not always very good…

Thanks in advance for help, ciao

Fabio

P.S.
Just for sake of exactness, that is a composition technique by Donatoni, he used it at least in “Lumen”, I discovered it during my analysis of the work (Guarda Figura, processo e articolazione parametrica in Lumen di Franco Donatoni - only in Italian, sorry)

Dear Fabio,

In the patch i sent you i doesn’t do what you are saying (pitches draws back to original register). I tried a lot of evaluations and here is one of them:

Maybe in your code you did something wrong???
Can you send please an example???

Best
K

HI,

My fault, you are right.

Only a last consideration, however, if I may: I have tested the patch starting from this simple sequence:
immagine
and in some evaluation the following occurs:


As you can see, the complete transposition is reached into five steps. But, because of random transposing mechanism, it happens that second and third step, if I read good, are the same, that is no pitches are transposed from one step to the other.
Is it possible to avoid it? I hope I am not inopportune in asking a supplement of help. Just to respect Donatoni’s process.

Besides your algorithm has given me another idea about to simulate another Donatoni’s composition process in “Lumen”, I must think a little about it… I am making a little update of my library, so I would be glad to enclose, with your help, also these composition techniques. This is the reason of my questions…

Really many thanks, ciao

Fabio

No problem Fabio. Glad to help.

Here is the way to remove duplicate series. Of course we remove these from the resulting list it is simpler:


And here is the patch:
rand-reg-trans2.omp (33.4 KB)
Best
K

Dear Fabio,

Here is a possible lisp code:
fabio-ran.lisp (985 Bytes)

Best
K

Dear Karim,

Thank you very much, it seems to me that everything runs perfectly.

Many Thanks, ciao

Fabio