Page 1 of 1

MIDI/OSC?

Posted: Sun Nov 27, 2016 8:28 am
by kmorton
Is it possible to handle MIDI or OSC input with Moho's scripting? I'd really love to integrate control surfaces with Moho.

Thanks

Re: MIDI/OSC?

Posted: Sun Nov 27, 2016 12:23 pm
by hayasidist
That really depends, IMO, on what you want to achieve.

If you're asking about taking a .midi file and using that to control the animation then it's perfectly feasible to write a program that will read the midi file and interpret it according to rules (that you hard code or otherwise define) to draw or select and animate objects. (That's in effect how lipsync works - read a sound file and create commands that moho understands to change things -- lipsync usually works with pre-drawn mouth shapes, but you could have anything - dancing elephants if you wanted to - instead of lips moving.)

But (because you've said OSC) I'm guessing you mean "in real time" -- to have the animation respond in real time to the sounds? I don't think that will work because of the workflow - creating the final video output is not a real time affair... it can takes a long time to render one frame.

Re: MIDI/OSC?

Posted: Sun Nov 27, 2016 11:02 pm
by kmorton
Yeah, I'm not interested in real-time puppetting for final animation or anything like that. Just controlling multiple bone rotations, etc. using incoming messages to set poses for keyframing. Turn physical dials to adjust a head turn, eyebrows, etc. I have a Surface Dial but I'd like to control multiple things at once with something like a MIDI Fighter Twister.

Re: MIDI/OSC?

Posted: Mon Nov 28, 2016 11:49 am
by hayasidist
Interesting concept. there is an "OnInputDeviceEvent" function available for scripting, and there are routines to access the message that a device sends (http://mohoscripting.com/index.php?show ... eviceEvent)

but I simply don't know if it's possible (I've never tried) to get Moho to recognise an input device other than mouse, keyboard or tablet. The standard Moho tools such as LM_TransformPoints have example code for (e.g.) multitouch tablets, but it looks as though there's been some pre-processing on the deviceEvent.inputData -- IOW what is made available to the script does not look as though it's "raw" from the device.

So, on balance, I'd say that Moho as is can't interface to such as fighter twister as an input device - but it would be great if it could and I'd **LOVE** someone to tell me I'm wrong.

Re: MIDI/OSC?

Posted: Wed Nov 30, 2016 5:52 am
by kmorton
That function looks very promising! Hopefully I'll find some way to make use of it in the future.

In the meantime I did get a MIDI Fighter Twister working with Moho, sending keypresses and using a tool script to rotate bones. Very much a kludge but it works.

Re: MIDI/OSC?

Posted: Wed Nov 30, 2016 10:44 am
by hayasidist
Well done -- If you're prepared to share (privately or publicly) I'd love to see that script!