< Back to IRCAM Forum

Automatic change of color to bpf

Hi to the OM community!
I would like to automatize the change of color to a list of bpfs (connected to a bpf-lib).
Regarding this I have a 2 questions:

  1. In OM-book 1, article "Fractals and Writing, ‘Six Fractal Contemplations’ " by Mikhail Malt (p. 157/158) there is an abstraction “set-bpf-color” written in LISP-code as an S-expression:
    (lambda(self color)(setf (bpfcolor self) color) self). How can I apply this expression to the graphical programming?
  2. I am not familiar with the format in which OM (and/or LISP) handles/designates the colors. (I was trying to find some information on this issue, but most of the articles I have found are strictly connected to the LISP-based graphical programs. Hence, I am not sure does the same principal also apply to the OM.) In other words, how can I designate specific colors with numbers? Please, can you give me a short explanation, or a hint where I can find this information!



Hello Ališer

The SET-COLOR function will help you do that.
Note that this function has a third optional input (“new?”) : if new? is NIL (default) you modify the color of teh input BPF (en return it). Otherwise, your return a new BPF which is a copy of the input, with the specified color.

Use OM-MAKE-COLOR (both in Lisp or in OM) and define your color with three values [0.0-1.0] for Red, Green and Blue.

Perhaps worth to mention 'lispfunction, which provides a general solution. It is described here: http://support.ircam.fr/docs/om/om6-manual/co/LispFunctions.html
Using this, your solution could look something like this:Skjermbilde%20fra%202019-11-08%2011-38-24


Dear Jean, dear Anders,

Thank you very much for your helpful explanations and exampels!

All the best!