< Back to IRCAM Forum

ModaLisp with foreign-call and expression controllers

Greetings,
I’m using Modalys “3.8.1.rc5” with LISP frontend on MacOS 12.6.3(Intel).

Is there a way to run any code with foreign-call and expression controllers in ModaLisp?

I’ve tried example files in lisp directory (ex5b, ex7, ex8, ex9, ex22) but received ERROR: Could not make controller foreign-call or ERROR: Could not make controller expression.

Also, I noticed that Arithmetic - Modalys
has an example of the fm excitation from ex5 rewritten as a set of function calls.
I think the last line should be changed from

(setq fm-output (*~ (sin~ (+~ (*~ mrcf mi (sin~ mrcf)) cf)) ae))

to

(setq fm-output (*~ (sin~ (+~ (*~ (*~ mrcf mi) (sin~ mrcf)) cf)) ae))

Otherwise it doesn’t work as the *~ function expects two arguments not 3. I’ve attached a working example.

Many thanks,
ex5_fixed.lisp (2.1 KB)

Chris

Thank you, Chris, I’ll take a look and propose some options.

The expression controller is no longer maintainted, superseded by the Lua controller, but the latter is yet to be hooked to ModaLisp. Also foreign-call seems to be broken. Sorry about all that!

Meanwhile, in example 5b, the line

(defun sum-controller-const (ctlr k)
  (make-controller 'foreign-call 1 0
		   (foreign-callable (lambda (inputs output) 
                                       (vset output 0 (+ (vget inputs 0 0) k))))
		   (list ctlr)))
;;; foreign-call is completely overkill here!

can be easily replaced by:

(defun sum-controller-const (ctlr k)
  (make-controller 'arithmetic 1 "+" (list ctlr (const k))))

Robert

Hi Robert,

Thank you for your feedback. Example 5b works now.

Best regards,
Chris

Hi Chris,

The foreign-call controller will be back in ModaLisp in the upcoming 3.8.1 version. This is only by mistake that it was deactivated!

The expression controller is not going to be back, but since ModaLisp is non-real time environment, everything can be expressed as foreign-call. I will update the examples in that sense.
The expression controller is only critical in real-time (because it is compiled, “just-in-time” code). But in that case, in Max environment, the new mlys.lua controller (also just-in-time) does the trick.

I hope that sounds like reasonable plan!

Robert

Hi Robert,
Bringing foreign-call back would be absolutely great.
I completely understand the decision about expression controller, it all makes sense.
I’m really looking forward to the new release of ModaLisp.
Thank you for your update.

Kind regards
Chris