< Back to IRCAM Forum

Can not import OM method

I have OM installed on Windows10 if that matters. When I’m trying to import a method I get
“Sorry this file is not recognized as an OM method.” message.
The method itself is a copy/paste of your sample on https://openmusic-project.github.io/openmusic/dev/codeforom page to a file ‘sample.ome’

(defmethod! is-major? ((self tonal-note)) 
   :doc "tells if the associated tonality of the note is major" 
   :icon 193 
   (eq (second (tonality self)) 'Major))

What am I doing wrong?
Thank you

Dear ve4,

Usually you should first in a lisp file put this:
(in-package :om)

then your code. This is to use it in om.
Then you should evaluate the lisp file before calling your functions in a patch (ctrl+y)

I will join here the lisp example file

my_om_lisp_code.lisp (319 Bytes)

Best
K

Thank you for your reply.
Yes, what you suggested works inside a patch, but I’m trying ‘Import method’ feature in this UI:
IM

And on ‘Import method’ I get “Sorry this file is not recognized as an OM method.” . I also tried importing the class you kindly provided me for reference and got the error “Cannot take CDR of is-major?”

Ok I see,

This is completely different. It is the “graphical” way of creating methods and doesn’t involve lisp text code. It is done through here:

But seriously, i advise you to do it in lisp code. After you have done writing it, you can put your lisp file in the init folder of OM for a global use, or in your user folder of your workspace.

Best
K

I see, and will it appear in the menu Functions -> User here? I can use such function inside patches when I directly type in a function name, but not from the menu:
image

Unfortunately not.
I suggest in this case to build up your own library. You can find here a template:

Very practical. after that you can put it in the libraries folder and load it. You will have access to all methods, classes you write and they will show in the Libraries menu.

If you encounter some difficulties here, notify. We will help you with this.

By the way the first document you were reading is in fact how to write a library.

Best
K

1 Like

Ok. Thanks a lot for your reply