1
$\begingroup$

A little foreword: I'm an absolute beginner of Mathematica (but I'm a programmer in other languages/software).

Now the question: I have a Mathematica Notebook written by a friend of mine which takes two input (an integer and an array of integers) and returns 2 strings (I don't think the details are relevant to my question) and he asked me to convert it in a Max/MSP plugin.
Before to port the Notebook in C (Max/MSP plugins are written in this language) I did some research about interoperability between Mathematica and other software, I found some reference for Java here: How to integrate Mathematica with other software but for Max/MSP but for C I didn't find anything.
Somebody has some good tip on this? Thank you in advance.

$\endgroup$
  • $\begingroup$ There are two different C interfaces: MathLink (lately called WSTP) and LibraryLink. For such an application you would want MathLink. It will allow creating a standalone shared library (plugin) that can start up a Mathematica kernel send it some input for processing and receive the output (which it then can pass to Max/MSP). I don't know much about Max/MSP, but isn't it for real-time audio stuff? Keep in mind that Mathematica is not particularly fast and you won't have guarantees on latency. Also make sure that it isn't simpler to just rewrite what your friend wrote in C ... $\endgroup$ – Szabolcs Dec 11 '15 at 17:31
  • $\begingroup$ If you are an absolute beginner in Mathematica, I'd advise not to jump into advanced stuff like this at the beginning. It is not going to be a one-afternoon project for a beginner. MathLink is not as well documented as the rest of Mathematica. $\endgroup$ – Szabolcs Dec 11 '15 at 17:33
  • $\begingroup$ If you do decide to go ahead, then in addition to the documentation that ships with the latest Mathematica (and is also available online, search their site for WSTP, the new name for MathLink), do read this: edenwaith.com/development/tutorials/mathlink/ML_Tut.pdf Typically, with MathLink you create a separate executable that can be invoked from Mathematica, and will provide services (functions) to Mathematica. This is called an "installable MathLink program". This is not what you want. Instead you need "calling Mathematica from external programs". You won't need to use ... $\endgroup$ – Szabolcs Dec 11 '15 at 17:37
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – Michael E2 Dec 11 '15 at 17:37
  • $\begingroup$ ... MathLink templates (.tm files) for this, those are for installable MathLink programs. But getting familiar with those first might help, as they're simpler. Then you can also look at what code the mprep program generates from the template as it will be instructive on how to do similar things manually. $\endgroup$ – Szabolcs Dec 11 '15 at 17:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.