Rpg - The Renoise Phrase Generator

Thanks Icarus.

I’ll think this over and then return to you in private. (Right now I just don’t have the time to experiment with this.) But I can tell you right now that the stuff I want to do is far from being advanced, so if you’re able to give an example right away that would be super.

So here’s my “big challenge” ;) for you – and of course it’s not the actual script I want to write… :)

Can you write a AHK-script that does this:

  1. Ctrl+c the selection
  2. Checks if the note in the second column and third row is a C-4 and, if so, then place out a F-6 note at the first row in the forth note column with half the velocity value of whatever the original value at the C-4 note was.
  3. Ctrl+v back into Renoise

I think if you can give me this much, I’ll have a start to build further on and experiment with. Maybe your input could also inspire more guys like me here (i.e. non-programmers) to try writing some scripts as well. Later on when I’m a bit more experienced, I may also put together a tutorial or something. I think a lot of us non-programmers have useful ideas, but may not have the knowledge to write scripts of the professional caliber of those .php-scripts that were developed earlier. With AutoHotKey, however, we could actually get our hands on more customized “on-the-fly” swiss army-knife operations in the pattern editor.

It’s worth a try anyway…

Ok,

The thing with Renoise’s clipboard is this:
It appears that Renoise is managing its own clipboard (and not Windows clipboard) and it will only put things inside the Windows clipboard when you focus away from it, and will read things from the Windows clipboard when you focus back to Renoise.

So, the workaround that I have used in RPG, is that I focus the RPG window at key places in the generation, so that Renoise thinks it is time to share its content or read from the Windows clipboard.

In any event, I have prepared a small sample for you - it does not do what you want but you can modify it as you wish.
Parsing XML is a task I hate very much - the XPath implementation in AHK is painfully slow, so I would not use it.
I would use regular string manipulation - regex and StringReplace.

Run this code, then place at least 10 C-4 notes in your track, and select it.
Then press F12, this code will manipulate it and paste it back.

  
#SingleInstance Force  
  
  
; Create a dummy GUI so that we can alt-tab away from Renoise to our own window  
; so that Renoise will let us handle the clipboard ourselves  
Gui Add, Text,,Dummy  
Gui Show,x0 y0,Dummy  
  
Return  
  
;-------------------------------------------------------------------------------  
; Main Functions  
;-------------------------------------------------------------------------------  
Manipulate( xmlString ) {  
 ; This is where all XML manipulation should be done  
 ; I have placed two examples.  
  
 ; Replace instrument in line 11 (index 10) to 0F  
 If( RegExMatch( xmlString, "(<line index=".10.">.*?<instrument>..</instrument>)", Token ) ) {<br>
	TempString := RegExReplace( Token1, "<instrument>(..)</instrument>", "<instrument>0F</instrument>" )<br>
	StringReplace xmlString, xmlString, %Token1%, %TempString%<br>
  } <br>
  <br>
 ; Replace all C-4 notes with D-6<br>
  StringReplace xmlString, xmlString, <note>C-4</note>, <note>D-5</note>, All<br>
  <br>
  Return xmlString<br>
}<br>
<br>
DoIt:<br>
 ; This routine is called whenever F12 is pressed<br>
<br>
 ; If there is no Renoise in sight, return<br>
  IfWinNotExist Renoise ahk_Class Renoise<br>
	Return<br>
	<br>
 ; Activate Renoise Window and Copy the selection<br>
  WinActivate Renoise ahk_Class Renoise<br>
  WinWaitActive Renoise ahk_Class Renoise<br>
  Send ^c<br>
  <br>
 ; Activate our own GUI so that Renoise will "release" the clipboard to us<br>
  WinActivate Dummy<br>
  <br>
 ; Manipulate the copied data<br>
  Clipboard := Manipulate( Clipboard )<br>
  <br>
 ; Paste the selection back<br>
  WinActivate Renoise ahk_Class Renoise<br>
  WinWaitActive Renoise ahk_Class Renoise<br>
 ;Sleep 100 ; May need to sleep a little if your have a slower computer<br>
  SendInput ^v<br>
<br>
  <br>
Return<br>
<br>
;-------------------------------------------------------------------------------<br>
; Hotkeys<br>
;-------------------------------------------------------------------------------<br>
F12::Gosub DoIt<br>
<br>
<br>
<br>
<br>```

</line>

Icarus, this is a great foundation to build further upon. I’ll start by learning a bit more about AHK’s string operations. Thanks!

All you need is RegExMatch, RegExReplace and StringSplit

But for a full list, see the String Management folder in the help file.
If you are comfortable with RegEx, than I am guessing you will not need anything else.

Version 0.50 is released.

  • Changed: Phrases are no longer limited to 8. There was no real reason to limit. The new limit for the up/down arrows is 64, although typing of a higher number is allowed (but probably not necessary).
  • Added : “Fixed Note” functionality to the Position Probability control area. Now, specific positions can be forced to use a specific note (Frozen, or Fixed note). This is good for step sequencing, and for semi-random step-sequencing. Note that when transposing the keyboard, if fixed notes are falling outside of the range, they will be bounced back by one octave (e.g. If you transpose down by one note, any fixed C-0 note will become B-0).
    Fixed notes are relative to the selected octave range (e.g. C-0 is the C note in the first selected octave).
  • Added : “Stretch Phrase” functionality to the Data control area. When enabled, each phrase will occupy 32 rows instead of 16 - a blank row will be inserted after each of the original 16 rows.
  • Added : Some presets to demonstrate the new functionalities.
  • Changed: Base octave is now an up/down control instead of the drop down list.

As some of you know, I wanted to make a variant of RPG that will be designed specifically for step-sequencing and trance-gating. I wanted to do our own little small arpeggiator (ArPG ? :) )

But, as I learned in this thread, It was impossible at this time to do sub-tick volume slicing for VST instruments, so for now, I dropped that idea.

Instead, I added a simple step sequencing functionality to RPG.
Hope you like it, and please report bugs if you find them.

Version 0.51 is released.

Mainly to improve usability of the step sequencer.

  • Changed: Transpose is no longer allowed if there are fixed notes that may fall off keyboard. This is replacing the old behaviour which bounced off-keyboard fixed notes back into the keyboard (with one octave shift).
  • Added : Fixed notes will now be highlighted on the keyboard. Also works during changing of the fixed note in the note selector.
  • Changed : Right clicking a fixed note button to disable it (make it Random), will now remember its previous value so that we can toggle the same key on and off by repeated right clicking. Same is implemented in the note selector dialog.
  • Added : Mouse wheel on top of a fixed note button will now also change the note, so we can add and remove fixed notes without opening the note selector dialog at all.

Short sample song made with the new features.
This song uses 3 tracks of “stretched” phrases - instead of 16 rows per phrase, there are 32 rows with a blank row after each, so the result sounds a little more melodic and slower.

Also, all three RPG tracks in this short song are using some fixed notes, and some random notes, so this is the “semi-random” step sequencer in action.

Listen to Semi-Random Stretched Sequence

cool, keep on rawkin \m/

when i make a sequence that uses 3 tracks and 3 instruments then the notes get pasted kinda randomly, as in for example, track 1 will have notes for all 3 instruments. could you make it so that the notes go into their own instrument track ? notes for instrument 1 will go in track1, notes for instrument 2 will go in track 2 etc

Can you please send me an example? My emails is in the help.
Send me the INI file so that I can see if it behaves as designed or not.

Also, there are two multiple track paste modes:
One pastes all inside the same track, in multiple sub tracks, and the second method pastes the notes in a different track.

Pasting different instruments into different tracks, is just like generating another RPG phrase, in that other track.

The Instrument randomization function is intended to provide additional flexibility - in case you want to generate one track that uses different instruments on that same track (for example, put two types of bass synth)

It was not designed to let you generate complete songs in one press, but perhaps, if I understand what you are looking for better, I can add an INI configuration to allow for the functionality you are seeking.

thx, well if you look at my song for the mutant compo

http://downloads.renoise.com/mbc/7kilo_maya.xrns (right click, save as)

it uses 3 instruments on the first track, while i wanted to them to go on 3 tracks linked to their own instrument then i would be able to use different fx on each separate instrument… and not one for all. (do i still make sense here?)

well there are some work arounds, so if its to much work or just not possible then i can still do what i want, just takes a bit more effort. with this song the rule was not use any vst’s so that’s why it made me wonder about it…

@7kilo,

I see what you mean, but this “multiple instrument” feature was not designed for this. If I understand what you want, is that RPG will generate some phrases, based on the same logic, and paste them in three separate tracks, with each track using its own instrument.
The reason I did not implement such a thing is because I did not think it will be useful - I mean, what are the chances that you would want to have the very same track logic on three different instruments?

Also, it is quite easy to do what you want, if I understood it correctly, by generating a track for one instrument, moving to the next track and generating it for another instrument. This way, you can also do some minor tweaks so it will not sound the same.

I have prepared some audio samples and RPG INI files for you so that these two features may be clearer to you and others, will post it in the next post (hoping that the “board ghost” will not merge the two posts together)

BUT - there may be something that will partially help your cause - see RPG.ini in your RPG folder, and towards the end there is SubTrackPaste =1, change it to SubTrackPaste =0
This will paste in a new track instead of a new subtrack, so that each track can have its own effects (but not its own instruments)
You may use this with a single instrument, and then remap the instruments in these new tracks using advanced edit.

RPG Multiple Instruments and Multiple Tracks Tutorial

Here is a short explanation and some examples of the two features:
Multiple Instruments and Multiple Tracks.

In general, the multiple instruments feature was designed to help in creating more interesting lines. For example, putting a few lead sounds that mix well together, and generating one track may have some very rich results.

Example for a single track, three instruments:

Now, the multiple track feature was designed to allow generation of phrases that occasionally have chords in them. A good way of testing it and understanding how it works, is to use a single instrument and two or three tracks.
It is recommended to use low values for the position probability sliders, so that chords will not appear as often, but only on some occasions.
It can also help if you use at least 40% on the Off slider, and an instrument that does not have a quick decay.

Example for a single instrument, three tracks:

Finally, although I originally did not intend for these two features to be used together, if you understand them both, you can combine them and generate interesting results.
This example uses three instruments, and three tracks. Note (in the INI file) how I used low position probabilities, so that in many rows, the note exists only on one track and chords are hit only on occasions.

Example for three tracks and three instruments:

Version 0.60 is released.

  • Added : “Fetch” functionality, to copy track information from Renoise, and automatically set the various sliders in RPG. Activate by selecting a bunch of notes in Renoise and pressing the Fetch button or by pressing Ctrl+W in Renoise or in RPG.

I am happy to announce the first version that supports copying data from Renoise and analyzing it to automatically set the RPG sliders.
Although I feel that this feature is stable enough, keep in mind that this was a relatively heavy addition - around 200 new lines of code done in a few hours, so I would love to hear about problems if you find some.

The help file is updated accordingly, with additional description about this feature (See Interface section).

Oh yes!! A really nice and important feature is finally implemented! Thanks for those additional lines of code, Icarus. :D

It just occured to me that your RPG application actually holds the key to other great utilities for Renoise. How about:

  • A chord pad. For example you keep the piano roller and then just put major, minor, sus, etc chord keys and “RCP” will paste that chord at Renoise’s pattern cursor…

  • A clip pool. There are assignable pad buttons. Copy a selection to such button, then just press the button and the selection assigned to it will be pasted at Renoise’s pattern cursor…

;)

:)

Renoise already has some few clipboards no?
I am redoing that fetch function - the code is ugly and messy, but tell me if it works ok.

Version 0.61 is released.

  • Changed: Complete rewrite of the Fetch feature.
  • Added: Fetch will now enable the Split Keyboard function if it is necessary and possible.
  • Added: Fetch will now set the instrument to the first one found in the fetched data.
  • Added: Fetch will now attempt to learn what is the level of the Off slider.
  • Added: Fetch will now attempt to learn what are the levels of the Fx/Ex sliders. Note that this feature is sensitive to the effects you have selected to use in RPG. If your two effect sliders control Fx and Dx, the fetch command will look for Fx and Dx (instead of the default Fx and Ex).
  • Added: Fetch will now consider the “Stretched Mode” button. If this button is pressed prior to the fetch action, RPG will attempt to obey, and treat the fetched data as stretched phrases (i.e. consider each 32 rows as a phrase). Note that this is possible only if the copied data is indeed stretched - meaning, each second row is empty (or at least non-note).
  • Added: Detailed documentation in the Advanced Topics section of the help file for the Fetch command.

@Transcender - is it working as expected?
You seem to be the only client, although I agree it is an important feature and was done mostly because of your request.

Hello everybody,

I have decided to start preparing a series of RPG tutorials, just for the fun of it, and in hope it may help some people in understanding the features a little better.

Although everything is documented in the help file, I know most people do not read help files.
As a smart man once said: “Help. Doesn’t.”

So, after a small research and some help from fellow renoisers as for what would be a good way to record on screen, I have prepared the first two tutorials, and am planning on making some more.

You can see the both on the RPG homepage

Although I uploaded the files as top quality XviD, the video hosting service reduced them just a little, but I am sure you will find them to be more than watchable (quality wise) - of course, enlarge them to full screen.

Your feedback - as always - is welcomed and appreciated.

Respect Icarus for the pro looking tutorials! :slight_smile: Helpful as well, like how you integrated the video’s into your site.

Hey thanks!
This Viddler site is 10 times better than YouTube.
I guess its all “location, location, location”… :)

Wow, very slick tutorials. I like the robotic voice. I like the pacing. Nice work! Port your app to OS X? :badteeth:

Youtube has the audience.

Location, in a desert, with no one watching, is good for you, bad for promotion?