Author Topic: Scripting in OpenMPT  (Read 6542 times)

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,160
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 7 x64
Re: Scripting in OpenMPT
« Reply #30 on: July 04, 2017, 17:56:12 »
Scripts will not be a part of a module or able to modify the behaviour of module playback (in particular, scripting will not be part of libopenmpt). Scripts will also not be able to modify the drawing behaviour (or any other part) of the UI. This would be beyond the scope of a scripting API. To quote Renoise's scripting readme:
Quote
Change Renoise's existing behaviour. Like, you can't make all C-4s in the pattern editor yellow instead of white. You can write your own pattern editor, but not change the existing one.
The same will be true for OpenMPT, probably for the same reasons as the Renoise developers found.

Being able to create your own windows would be nice in the long run, but I doubt it would be part of the initial API, since that's a rather complex thing.
» 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 hicoleriv1

  • Shy artist
  • Posts: 2
  • Operating System: Linux
Re: Scripting in OpenMPT
« Reply #31 on: July 05, 2017, 01:36:37 »
Okay then.

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,160
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 7 x64
Re: Scripting in OpenMPT
« Reply #32 on: July 05, 2017, 11:53:07 »
To be more precise, the scripting API will mostly focus around reading and altering module data - patterns, samples, instruments, plugins, everything. It will be able to run in various contexts, like automatic background scripts that do something anytime a pattern inserted, or it can be called explicitely by the user. Some MIDI I/O manipulation (like MIDI filters) will probably also be possible. The focus, however, is not on modifying the GUI.
So: I want to hear your ideas of fancy things you want to do with the module data. Maybe running some FFT on sample data? Morphing patterns? Give me ideas! ;)
You can also post any other ideas that are not related to manipulating song data, since I do not want to exclude those. But as said, it's unlikely that things that do something with the program's UI would get into the API.
« Last Edit: July 05, 2017, 12:19:45 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 LPChip

  • Administrator
  • *****
  • Posts: 4,947
    • http://lpchip.nl
  • Operating System: Windows 7 (x64bit)
Re: Scripting in OpenMPT
« Reply #33 on: July 05, 2017, 12:17:53 »
And I don't want another song to be able to modify how my OpenMPT looks like. I don't get it why some programs allow that. The only exception where I understand it, is with Rebirth, where the skin is part of the sound module, and the song itself uses that sound module. Its like bundling your song with a VSTi and that VSTi happens to have that skin.
"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 ndelay33

  • Active artist
  • *
  • Posts: 27
  • Operating System: XP SP3
Re: Scripting in OpenMPT
« Reply #34 on: July 07, 2017, 15:02:43 »
Maybe running some FFT on sample data?  ;)

Wow this would be very cool!! what kinds of fft operations you could add ?  ::)
its been 10 years still havnt seen anything powerfull about FFT on vst than http://rekkerd.org/dtblkfx/

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,160
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 7 x64
Re: Scripting in OpenMPT
« Reply #35 on: July 07, 2017, 15:20:25 »
Quote
its been 10 years still havnt seen anything powerfull about FFT on vst than http://rekkerd.org/dtblkfx/
I didn't mean this as an online processing effect (though that could in theory be possible if I add a scriptable Lua Plugin to the list of built-in plugins), but rather offline, like transforming some sample data to FFT, then doing some operation on the FFT (e.g. removing a specific frequency), and then transforming the FFT data back to a normal sample.
» 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 ndelay33

  • Active artist
  • *
  • Posts: 27
  • Operating System: XP SP3
Re: Scripting in OpenMPT
« Reply #36 on: July 07, 2017, 16:04:22 »
yes i understand about offline.
removing specific freq is interesting and helpfull!
what i've been using a lot is an exageration operation(like anarchy effects Convoluter - free version http://www.anarchy-rhythms.com ) - that is like blending/morphing your sound from sine tones to noise. from very circle to very random.

another thing is a spectral compression that can delete frequencies below selected volume, for example -50db(things only closest to silent will be deleted) - this is very usefull for extracting specific instruments from a mixed tracks. or give it a range like "keep frequencies from -20db to -30db, all other frequencies must be deleted"... there is a tutorial on this particular plugin for max for live on youtube, but i guess it wont help you ???

this fft technology is all exclusive :)

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,160
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 7 x64
Re: Scripting in OpenMPT
« Reply #37 on: July 07, 2017, 16:08:12 »
Yeah, I think all of that should be doable. ;) I've been working on a lot of stuff related to this during the last week, and I think we should be able to have at least a basic scripting API in OpenMPT 1.28. Some simple operations are already possible, like converting all samples to 8-bit with a single line of code.
» 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 Diamond

  • Workaholic artist
  • ***
  • Posts: 243
Re: Scripting in OpenMPT
« Reply #38 on: July 08, 2017, 00:21:54 »
LOL maybe I'm simplistic in my thinking, but I would like the ability to bind scripts to keyboard shortcuts for the purpose of triggering playback of specific patterns, samples, and so on for live performances.

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,160
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 7 x64
Re: Scripting in OpenMPT
« Reply #39 on: July 08, 2017, 00:27:55 »
Yes, as mentioned, scripts can be run in different contexts, e.g. at startup, or when a key is pressed. Play/Pause is already a planned but not implemented part of the API, playing a specific note of a sample/instrument might also be sensible.
» 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 LPChip

  • Administrator
  • *****
  • Posts: 4,947
    • http://lpchip.nl
  • Operating System: Windows 7 (x64bit)
Re: Scripting in OpenMPT
« Reply #40 on: July 08, 2017, 11:15:38 »
Probably going to happen, but it would be nice if it could fire up all commands available through the menu. In my case I'd want to load the most recent song. Maybe even the most recent two.
"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 Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,160
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 7 x64
Re: Scripting in OpenMPT
« Reply #41 on: July 08, 2017, 19:19:40 »
It's not been in the API wishlist yet but it has been added now. :) The difficult part is how to make it work smoothly and easily, since e.g. command IDs and positions may change. Having access to the MRU list even without the menus might be more sensible.
» 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 LPChip

  • Administrator
  • *****
  • Posts: 4,947
    • http://lpchip.nl
  • Operating System: Windows 7 (x64bit)
Re: Scripting in OpenMPT
« Reply #42 on: July 08, 2017, 20:36:32 »
Yeah. I guess the MRU doesn't actually have to be tied to File->1-0. But other commands in the menu might be nice. For example having a script that performs a few actions and then opening the setup screen for you, or switching to a different song in memory.
"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 Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,160
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 7 x64
Re: Scripting in OpenMPT
« Reply #43 on: July 08, 2017, 20:38:34 »
Sure, the intention is that most, if not all things that can already be called manually would be available in the API as well. If I overlook some of them, they can of course always be added later, but having ideas of what people want to do with the API will minimize the risk that something important is missing. :)

Current Status: After a week of work on the scripting integration, I already made good progress in implementing various things that already make it possible to run a script "with a purpose", for example I can already run a script that would convert all samples to 8-bit mono. Switching between songs and getting a list of loaded songs is also possible.
» 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 LPChip

  • Administrator
  • *****
  • Posts: 4,947
    • http://lpchip.nl
  • Operating System: Windows 7 (x64bit)
Re: Scripting in OpenMPT
« Reply #44 on: July 09, 2017, 10:32:24 »
Can it open a textfile, read its content, parse it, and perform actions based on that?

Can it also get information FROM the tracker instead of performing an action? For example, get the maximum length of the current song, know when the song is about to end, perform an action when the song ended and the tracker is no longer playing (can happen if looping is disabled), etc.

One could create a playlist engine this way which could be benefitial for one who wants to perform on stage.

Oh, and if possible, can the script generate a dialog with buttons and perform actions based on custom button presses?

For example, the script loads preprogrammed songs and waits for a button press to advance in the script.
"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