< Back to IRCAM Forum

Writing a library for OM-sharp and OMCS library

Hi everyone!
I am trying to adapt a OM library to OM-sharp. Since I am new to the latter, I have a few questions about how to proceed:

Best Regards,

Paulo.

Hi Paulo,

In principle you shouldn’t need to change your code to adapt your OM library for OM#.
You can just use the same source code (and the same repository), and add a OM-AIS.omlib file in it.

At the difference with the “.lisp” file that loads the OM library, the “.omlib” file doesn’t contain Lisp code that is evaluated, so you can not add such thing as (defpackage ...), or (print "...") in it. If you need to do so, you can indeed add another file in the sources (package.lisp) where the package is defined.
Then again, you shouldn’t have to make any change in the rest of the sources.

Can you precise how you are doing that ?

Could you attach an actual patch maybe ?

Hi Jean,
Thank you for your response and suggestions.
I have just made this file with another version of the library. I had to make just a little change in OM’s code and change the location of a folder (AIS). I don’t know if is this correct, but apparently its working.

Best Regards,

Paulo

Hi Jean,

 Sorry, I forgot to include the attachment. 

AIS-calculations.opat (95.4 KB)

I was trying to insert a comment inside the patch, but now the error message is gone.
Captura de Tela 2021-01-13 às 11.35.40

Hi Paulo,

I tested your library with OM 6.17 and OM# and it seems to work on both softs, Congrats…
Let’s wait and see what Jean has to say…

Best,

Jerome

Hi Jerome.
Thank you for testing the library.

Best,

Paulo.

I haven’t had a chance to thoroughly test but at a quick glance this seems to be it. Your .omlib file just loads the file as it is supposed to.

Two minor things:

  • you can remove the (print ...) from the .omlib file, since it won’t be evaluated anyway
  • you could also remove the (defpackage :OM-AIS ...) from OM-AIS.lisp and just load the file package.lisp instead, in order to avoid duplication of the package definition in your sources.

The problem is (was) that you redefine in your code the function string-to-list that already exists in OM#. As long as it is redefined in your own package, this is fine, but I think in the previous version of your library you interned all your code in the OM package, and therefore redefined this internal function with a different number of arguments.

Hi Jean,
thanks again. I’ve followed your suggestions and it’s working perfectly. I appreciate your explanation about the string-to-list function and I’m beginning to understand the packages definitions now.
This is the new file:

Now there is only the problem with OMCS library in OM-sharp (the patch is also in AIS library tutorial).

Best,

Paulo.

Dear Jean,

this is the correct link:

Please disregard the previous one.

Best,

Paulo

Can you be more specific ? What do you see ?

On my side: I see a stack overflow on omcs::search-engine (which means that the engine can not find a solution). It would be interesting to see if the exact same input values on all inputs of pmc-engine yield the same behavior in OM6.x
I don’t see why the solver would behave differently, but maybe it does :slight_smile:

Hi Jean,
these are the results in OM6.17:

All the other rules are working too (for selecting prime form AIS and invariants).

A minor update of the problem: on OM#, when I change the sols-mode of the pmc-engine input to :once it works. When I try to evaluate 100 solutions it works too. The problem seem to be with the :all sols-mode of the pmc-engine or when a great number os solutions is required (I’ve tried 3856 solutions and the same problem of stack overflow appears).

Hi Paulo. I can see what is different: We need PMC engine to be compiled in order to run that patch, and currently OM# only loads and evaluates the (un-compiled) Lisp sources of the OMCS library.
=> I just uploaded this update of OMCS 1.2, which includes up-to-date compiled files for OM#/macOS (and should still work on OM6 as well):
https://github.com/openmusic-project/OMCS/releases/download/v1.2/OMCS.1.2-omsharp-macos.zip

Hi Jean,
thank you very much!

Best,

Paulo.

hello,

is there any documentation for the use of omcs library? or some tutorial?
thanks in advance,
perti