Pattern Edit - Call External Batch File


Renoise writes selection to output.xml when the user presses [key1].
Renoise reads input.xml back into the pattern editor when the user presses [key2].

Step-by-step behaviour:

  1. You press a key/button/hotkey
  2. Selected pattern data (or if no selection is made, the current line where the pattern edit cursor is located) is stored to disc as xml (“in the background”, i.e. no dialog screens or stuff like that pops up).
  3. A user batch file is called/executed/run, also “in the background” (or, if interactive, in the command shell)
  4. The (modified) xml file is fetched back again from disc and pasted into pattern (at the edit cursor position)

Why this is useful:

Because it saves a lot of time when the user wants to call external scripts to analyze and modify XML data. This way we can have an external scripts/programs (written in whatever language) instantly doing whatever they’re supposed to do with the xml. It’s a simple, yet very powerful feature that, in my opinion, should have been implemented in the 1.8 version. Please consider it for 2.2.

For those who don’t fully understand this suggestion, let me give you a few example of typical applications that would speed up your workflow:

Suppose you want a specific chord, yet doesn’t know how to write it in the pattern editor. You just enter “C-4” and strike the hotkey. What then happens in the background is that Renoise instantly writes that “C-4” data as xml and runs a batchfile, which in turn runs an external script/program that works like this (just to give you a very simple idea):

  • Identify root key (in this example it’s “C”)
  • Identify octave value (in this example it’s “4”)

The script will then modify the xml file so that it contains a full chord instead of just one note. The script is written in a pre-configured way so that octave 4 means a specific type of chord (major/minor/etc). Renoise then changes the C-4 you just wrote to the full chord instead. And this happens instantly (because such scripts run very fast).

The possibilities are endless.

But let’s take yet another example:

You have written a sequence on multiple rows that plays in D minor scale. Now you want it transferred to play in G-major instead. So you select the rows of the sequence, press the script hotkey and the script in the background will pop up in the command shell, prompting you for the root scale. You enter it and then gets prompted for the destination scale. You enter it and voila, the script analyzes the notes and bounces back the modified xml to Renoise’s current pattern edit cursor position.

That’s supposed to be simpler? :lol:
Hint: did you ever try holding down shift while entering a chord?

But yeah, I’m with you. Being able to script the pattern data in realtime is one of the most exciting things planned for Renoise :w00t:

Of course I have. But that has nothing to do with this. The point is that such a script (a simple example btw) would in this case allow for faster editing. You just enter “C” and the script prompts you with the type of chord in a menu, you select the advanced chord and don’t need to know which notes are in such chord, you don’t need to spend time entering it manually — the script does it for you!

You bet it is!!! :drummer:

It’s THE most exciting and useful feature of all times, IMO! It’s simple! It’s beautiful! It’s powerful! In fact, I really fail to understand why in heaven it isn’t there already. No need to write an internal scripting engine, or something like a new Renoise scripting language. Actually the above suggestion would be quite sufficient. And, if I remember it correctly, taktik suggested this very solution himself as well.

Something that existed in Impulse tracker and this one worked nicely…:you created the chord, then you copied the chord to the clipboard and used the chord macro. When you hit any specific note, it recreated the chord using the pressed key as the base-key.
I sometimes miss this one as well…

Well, this is something that you can do in e.g. energyXT (v.<2). Still, chords is just one little tiny application of this door to the external world. The main point to consider here is Renoise’s powerful XML data feature and how that feature itself could be further utilized in action, applied to the edit stage itself (let’s face it: most of us spend most of the time hammering the keyboard keys, entering notes and column data in the pattern editor).

The idea is so simple, yet so powerful:

Write selection to output.xml when pressing [key1]. Execute script. Read input.xml back into the pattern editor when pressing [key2].

The thing is that we don’t have to manually copy the data to files for the external script’s processing of that data. It’s a huge time saver and furthermore it opens up more powerful routes for tomorrow’s tracking experience as all we (the users and script writers) need to focus on is to write input.xml for Renoise to read.

Come on guys! Can’t you see the beauty of this concept’s simplicity? B)

Let me also add that when you devs implement this simple but extremely useful feature, I hereby promise that I’ll personally write full range step-by-step tutorials on how to write pattern modification scripts in the Python scripting language (since it’s platform independent and easy for beginners to start with). I’ll basically create a little kit to toy around with and demonstrate in a proper and very pedagogical way how to write your own self-help toolbox.

Python… sounds like you already picked your scripting environment…
There are also other candidates for scripting like Javascript, or Angelscript or Lua?

Yes, there are, but I’ll create my scripts in Python because it’s widely considered the easiest scripting language for beginners to learn. Mac and Linux users already have Python on their machines, and Windows users can run something like the self-contained portable python within seconds.

Angelscript may be a better choice for a future “advanced” scripting engine for Renoise to interact with since it uses the common C/C++ datatypes for more efficient communication with the host application (and, if I’m not mistaken, Renoise is coded in C++?).

(the above quoted from )

But, really… it doesn’t matter what scripting language you use here. If taktik would just add this small feature (write to output.xml and read from input.xml), all that matters is that input.xml is rendered by something and that it contains valid xml that Renoise can read back and paste at the edit cursor when the user presses a key. All the rest of it is up to us, the users to provide and care for. But it would be such a fantastic door out to the external scripting world…

To be honest with you guys, this suggestion should win a Renoise Academy Award, it’s that good. ;)

Some more examples of simple scripts that you could have instant access to by the press of a button:

Chord analyzer. Suppose you have written the notes C-4, E-4 and G-4 in a row. Now you wonder, what is this strange chord? Maybe it’s a Fdim7? You select the notes and press a button. A script launches in the background and a menu pops up. You choose alternative (2) - Analyze notes, from a menu of 20 items. The script instantly reports back to you, that this is a C major chord.

Chord progressions. A script suggests chords for you, based on the one you’ve entered.

Re-arrange notes within sequence. You select 64 rows of note data and strike the script launch key. The script then re-arranges these notes according to certain rules (random, ordered, etc). This way you can have instant variations and explore new possibilities.

Build composing blocks. You create a multi-track sequence in C major and a script will render similar blocks in D-major, E-major… C-minor, D-minor… etc. You can build huge producer kits this way and call upon them instantly. Just tell the script what chord, what sequence, what variation you want and it will be inserted right where your edit cursor is located.

Transform sequences according to scale. You have made an arpeggio that plays in D-minor. Now you want it to play in harmony with A major. The script will take care of that for you, just feed it with the selection you want to transform.

Pattern creator. Select style and the script will render a new pattern for you, based on producer kits you’ve stored on your harddrive…

Song creator. Select style and the script will render an entire .xrns song project based on the producer kits you’ve built…

Transfer mixing template from song1.xrns to song2.xrns. Instantly apply the settings of all instruments and the mixer in the template song to your current project.

Fetch composing xml blocks from a server where people collaborate on the same .xrns producer kits…

And the list goes on and on… It’s time to realize that Renoise’s XML is a huge resource, a gold mine, to build further upon. We spend most of the time placing out notes and numerical values in the pattern grid, so why not attach new tools to assist us in that very process itself? :P

And of course this is not as comfortable as your suggested solution, but you can right now use Renoises clipboard for this. Select something in the pattern editor, hit Control C, alt tab to your script tool to do whatever with the clipboard xml data, then alt-tab back to Renoise and paste. Thats how the current tools do it

Sure, I know about that thread. I wrote some stuff in there a year ago. But when you published your own suggestion on Feb 5, 2007 along with this comment…

… lots of people instantly ejaculated over their monitors out of pure ecstasy, including myself. So isn’t it the perfect time now in in 2009, soon to be 2010, to take a look at this once and for all? Pushing the capabilities of the XML format really is the way to go! ;)

Yes, this is exactly how I do it today. My suggestion is more of a “workflow” nature, really. It’s just a more rapid, natural and easy way to do, in a safe and platform independent way, something that you already can do manually, but much, much slower. Speed cannot be underestimated in the context of workflow, and this issue is actually what makes the difference between using external scripts and not using external scripts.

AHK is good and can speed things up, but it’s not platform independent (Windows only). But I’ll take a closer look at it again…

Transcender, you also pointed out this “Spartan” software (a multi-clipboard utility):

Basically, before we have in-place scripting, it’s about reducing the number of steps involved with modifying the clipboard externally. And Spartan was really cool, since it recieved the pattern data each time we did a “copy” in the pattern editor. All that was missing, was the option to assign some external script to be executed immediately after the clipboard has recieved, and update the system clipboard accordingly.

That way, the workflow would basically become a question of starting the external program, and select the desired action/script to perform. After that, all it would take it a copy, and then a paste operation in the pattern editor.

Maybe it can already do that? I didn’t go that deep into the features of Spartan, the downside being that it’s a commercial single-platform program :(

I Love the Spartan idea… i just don’t have time to finish creating a similar free-version of it myself.
In general the concept is so damn simple, any minor code-monkey could program it, it costs a lot of time though…