< Back to IRCAM Forum

Lisp first function doesn't gather (and outputs) correct value

Hello everyone, I have tried for the past 2 days to create a patch that allows me to generate a two note chord and obtain its inversion (top to bottom). I’ve realized that the problem lies in the “first” lisp function that doesn’t gather the correct value from the chord box. Up until that point, the list remains intact in its contained values. Funny thing though, is the fact that sometimes the inversion is indeed correct. I really can’t tell, there’s something that happens between the “chord” and the “first” objects. I’ll attach patch file. Thank you for your time.

rivolto.omp (8.0 KB)

Dear andreaslm

This is a common mistake. The problem here is that your om-random is evaluated twice, therefore, the inversion will be on a second evaluation of your random notes. To avoid that, you should put your CHORD object in eval-once mode:

The patch:

rivolto1.omp (8.3 KB)

see: OpenMusic Tutorials | OpenMusic

Best
K