Author Topic: Scripting in OpenMPT  (Read 5409 times)

Offline LPChip

  • Administrator
  • *****
  • Posts: 4,935
    • http://lpchip.nl
  • Operating System: Windows 7 (x64bit)
Re: Scripting in OpenMPT
« Reply #15 on: April 06, 2011, 20:43:51 »
I think it would be a great idea if the script can actually load/save one or more songs.

Not sure if you have to program mathematical functions, but a random with min and max would be nice.
Perhaps even commands to mute/unmute channels, so scripts can be used to easier perform on stage?

I have given plugins some thought but I doubt that plugins really need scripting. Perhaps the ability to add a plugin, load and save its preset, so you can write a script to move stuff from one song to another.

Also, there should be something like: next free instrument number, next free sample number, next free pattern number I think if you want to mass/copy/move from one song to another.
"Heh, maybe I should've joined the compo only because it would've meant I wouldn't have had to worry about a damn EQ or compressor for a change. " - Atlantis
"yes.. I think in this case it was wishful thinking: MPT is makng my life hard so it must be wrong" - Rewbs

Offline Harbinger

  • Extreme artist
  • *****
  • Posts: 1,133
  • Gender: Male
  • Operating System: Windows XP
Re: Scripting in OpenMPT
« Reply #16 on: April 07, 2011, 20:12:27 »
While i'm sure i can make full use of scripting within MPT, and have a variety of requested capabilities for the outset, i am actually more curious about how scripting is to be integrated within the code, now that i understand how tight the processes are. I equate it to grafting rose bushes into a thicket of briars and ivy.

If you can somehow pull this off, Jojo, i will be amazed at the level of your programming skill and will begin referring to you as "our resident wizard." ;D But i would like to keep up with YOUR thought processes and how you're able to pull it off, as you go along over the next several months. I know you can foresee the challenges, and i guess i want to to be an intern spectating over your surgery.... ;)

Offline Rakib

  • Crazy artist
  • ****
  • Posts: 879
  • Operating System: win7x64
Re: Scripting in OpenMPT
« Reply #17 on: June 28, 2011, 21:34:55 »
People may have heard about Max/msp and pure data, it for programming music. Now it has come as an library, so it can be implemented easily.

This can work as both scripting language and also as sample and effect generator.

http://bugs.openmpt.org/view.php?id=50
http://en.wikipedia.org/wiki/Pure_Data

The library:
http://gitorious.org/pdlib
^^

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,108
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 7 x64
Re: Scripting in OpenMPT
« Reply #18 on: December 04, 2012, 22:07:12 »
Update: Squirrel looks nice. Similar API to Lua (yet a bit better to use), and it looks more like C++/Java/etc., but is just as dynamic as Lua. A nice combination in my opinion, and so far it was much nicer to work with on the implementation side.

There are still some tough decisions to make. For example how scripts should be run. One big difference to Renoise is that OpenMPT can load multiple modules at once. Thus, should a script only be aware of one module (its "owner"), or all modules?
« Last Edit: December 06, 2012, 16:58:40 by Saga Musix »
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

Offline Harbinger

  • Extreme artist
  • *****
  • Posts: 1,133
  • Gender: Male
  • Operating System: Windows XP
Re: Scripting in OpenMPT
« Reply #19 on: December 05, 2012, 21:12:49 »
I use GIMP and they use scripting to get a LOT of their features implemented, esp. in applying filters or effects. These scripts are integrated into the main program, and i wonder if you plan to do the same. I would hate having to run it from a separate console, but with MPT's tight code, there may be no choice, at least at the outset.
 
I'm not sure what your question is referring to, but i would think we should be able to run any script at any time, even combining where possible.
 
Also consider time needed. I for one would much rather have capabilties right away and establish better GUI later, and if it's gonna take a LOT longer to integrate scripting in order to get everything you want now, let's go ahead and enter the new construction with all the 2x4s showing rather than wait for a perfect mansion with all the amenities you've been planning on.

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,108
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 7 x64
Re: Scripting in OpenMPT
« Reply #20 on: December 06, 2012, 17:00:45 »
Quote
I would hate having to run it from a separate console, but with MPT's tight code, there may be no choice, at least at the outset.
There will most likely be a (debugging) console and the possibility to run scripts from some kind of dialog, and scripts could probably even be persistent (always running in the background).

Quote
I'm not sure what your question is referring to, but i would think we should be able to run any script at any time, even combining where possible.
There was a typo in the question, now it should be clearer. The problem is that I'm not sure if scripts should be aware of all modules loaded, because that could make things complicated, but may also open up some interesting possibilities (copying between different modules, for instance.).

GUI and stuff is not a problem concerning time, designing a proper API is. The scripting API should be straight-forward to use and be consistent. Designing this API will be very demanding, as I've never done something like that before.
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

Offline enkore

  • Shy artist
  • Posts: 4
Re: Scripting in OpenMPT
« Reply #21 on: September 18, 2013, 22:40:53 »
You'll maybe want to take a look at QtScript (it does not require using any other component of Qt!), which is a ECMAScript implementation with very good C++ binding (put in another way, QtScript is the binding).

Pro: JS is well-known, simple to use + powerful
Pro: Makes integration with a Qt-based GUI somewhere in the future much easier
Pro: Well-tested implementation

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,108
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 7 x64
Re: Scripting in OpenMPT
« Reply #22 on: September 18, 2013, 23:16:03 »
Con: It's JavsScript? :P

I've been fiddling around with Squirrel quite a bit and I like it a lot so far, Only problem is that there's no standardized tool for automatically creating bindings (might want to look into SWIG, flex or write a custom parser)...
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

Offline enkore

  • Shy artist
  • Posts: 4
Re: Scripting in OpenMPT
« Reply #23 on: September 19, 2013, 00:30:27 »
That's done mostly automa(ti|magi)cally with QtScript... for stuff inheriting QObject.

JS/ECMAScript is actually quite nice, most ppl don't like it b/c they only know it from the JavaScript environment, which is (imho) botchered up in many ways.

Using QtScript is just the obvious thing to do when one already peers after Qt for a while :-)
« Last Edit: September 19, 2013, 00:42:14 by enkore »

Offline arseniiv

  • Active artist
  • *
  • Posts: 37
  • Operating System: Windows 7 x64 SP1
Re: Scripting in OpenMPT
« Reply #24 on: December 25, 2014, 19:52:54 »
Hi all!

Actual interface functions

<…>

- Read / write access to patterns: GetNote(chn, row), GetInstrument(chn, row), ..., SetNote(chn, row)..., ForEachModCommand style callback functions (with row, channel, order parameters), AddChannel, RemoveChannel, MoveChannel, ResizePattern, ShrinkPattern, GrowPattern
- CreatePattern (concept: returns new pattern number, -1 if failed), DeletePattern, DuplicatePattern
Could you also then add a function for creation of one pre-filled pattern? Maybe it could be faster for ‘generator’ scripts making whole patterns of autogenerated notes etc.. I know it is premature optimisation, and there isn’t any scripting yet, but one more idea is no bad. :)

And another idea: not only functions GetString and GetNumber but GetSampleIndex, GetInstrumentIndex, GetPluginIndex and such (from active module) — to query a user of generatior script what things to use in composition.

I hope this late posting isn’t something bad in this topic… :-[
Feel free to correct my English grammar
Music & sounds: [Freesound] [SoundCloud] [Direct links to music on friend’s site]

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,108
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 7 x64
Re: Scripting in OpenMPT
« Reply #25 on: December 25, 2014, 20:03:47 »
Could you also then add a function for creation of one pre-filled pattern?
Ignoring the fact that this would already be possible with the planned interface (using a callback that is run whenever a new song is initialized), you can already do this without scripting by using template songs (and possibly specifying a default template).
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

Offline arseniiv

  • Active artist
  • *
  • Posts: 37
  • Operating System: Windows 7 x64 SP1
Re: Scripting in OpenMPT
« Reply #26 on: December 28, 2014, 20:04:57 »
Ah, sorry, I’ve said it inaccurately. I meant merely random patterns, not ‘static’ ones. Thank you anyway for default template setting, didn’t know about it.
« Last Edit: December 28, 2014, 20:21:25 by arseniiv »
Feel free to correct my English grammar
Music & sounds: [Freesound] [SoundCloud] [Direct links to music on friend’s site]