What are Max externals? What can you tell me about the subject?

estevancarlos's icon

My only impression of Max externals at this point is that they can provide additional objects. I also was under the impression that they have to be built in Java. That's all I know or thought I knew. What are Max externals?

Charles Baker's icon

They are most often coded in C, sometimes in C++. The code of the externals interact with the Max/Msp/Jitter C/C++ based "programmer's Interface" (and occasionally, third-party C based libs). The java and javascript coding of externals in Max/Msp/Jitter is more recent, and provides simple "wrappers" in java or javascript to the MAx/Msp/Jitter C based "API". No standard externals provided with Max/Msp/Jitter are written in Java or Javascript, although they provide examples of doing so: because Java and javascript are "wrapper" code around the original C/C++ code, the use of C/C++ produces *far* more efficient code. The entire idea of Max was to have small units of arbitrary C code, all "combine-able" and "patch-able" together because they subscribe to the same set of interfaces/code standards and types (e.g.: see "ATOM" in the api).
Hope this helps ...

charlieb

estevancarlos's icon

Wow, that's much more than I realized. I had no idea you could write an external in Javascript. I'm assuming that writing a JS external is different from creating a JS object, is that correct? Or is that the same thing?

Charles Baker's icon

The mspmax javascript external code does not use the javascript "prototype" functions: (most often seen in programming as the definition of "object-oriented javascript"): but it does let you create javascript "objects" (files of functions) calling a simple MAxMSp coding API. which: can call the Max framework, call to any existing externals max knows of, ,send max symbols and data to the instantiated objects, and connect existing externals together allowing dynamic patch generation... there is a single js max object that reads and interprets these js files: the interpreter inside has code that wraps the Max/Msp/Jitter calls in js functions: big fun...
But remember: if you want to do audio work in javascript, you are limited to using calls to C based externals called and connected from js: the js interpreter is not nearly fast enough to produce dsp output directly: (a ridiculous idea, really)... the audio processing is in a different execution thread than the javascript, running far faster, and the "crossover " from javascript to the called C code of the dsp externals is not nearly fast enough to generate and pass samples in realtime...
same is basically true of Java in max... no audio programming, but programming of existing C based audio externals.

just AFAIK....
CharlieBphD