New Tool (2.7): Set Pattern Length From Sample

Set Pattern Length From Sample v1.02: (2.7, 2.8)
1807 org.illformed.SetPatternLengthFromSample.xrnx

See this thread for more information on the origins of this tool.

Usage :
Select a pattern, select a sample, then launch the tool via context menu or key binding:
Pattern Editor > Pattern > Set Pattern Length From Sample

The tool has 3 functions:

1) Set Pattern Length:
Take the current song BPM and calculate the number of pattern lines needed to play the whole sample at that BPM. If your sample does not precisely fit into a whole number of pattern lines at the current BPM, then the timing may be off by a fraction of a pattern line. Your song BPM will not be adjusted.

2) Set Pattern Length and BPM:
Take the current song BPM and calculate the number of pattern lines needed to play the whole sample at that BPM. Your BPM may also be adjusted by a small amount, in order to precisely fit everything together. If your starting BPM is 120, for example, then your final BPM may be some fractional amount like 120.3 or 120.7 BPM, depending on the sample length.

3) Set BPM:
Take the current pattern length and calculate the BPM required to fit the sample into that whole pattern.

The tool does not make any attempt to analyse the content of the sample in order to calculate its tempo or number of beats, etc. It simply takes the sample duration in seconds, and tries to calculate a pattern length and/or BPM required to fit that duration as closely as possible. Your song’s BPM and LPB is important here because it will be used as the basis for calculating the number of patterns lines required for the sample to fit into a whole pattern.

If your sample is really long, then it may exceed the maximum pattern length of 512 lines. The tool will simply clamp the values if this happens, and does not try to do anything clever like spanning multiple patterns.

sweet, always wanted something like this as i work with samples mostly. thanks dude, i’ll grab this

i’ve downloaded and put the xrnx file into the preferences folder of renoise but the tool is still not seen in the tool bar or browser.

any suggestions?

After download, I usually just drag and drop the xrnx file onto Renoise.

Yep, this is what you should do. Drag & Drop the xrnx on Renoise window.

It would be awesome to have an updated version that works with the current version of Renoise :w00t:

perhaps not the best way, but if you open the manifest.xml from inside the scripting terminal and change the api version to 4 it should work…

Yep. Renoise will not auto-upgrade the API version in this case, since I’m using and a bunch of crap changed relating to the instrument properties.

However, you can simply edit the manifest.xml as slippycurb suggests, and change the ApiVersion to 4.

Nevertheless, I’ve attached an updated version of the tool that’ll work in Renoise 3.0.

Didn’t think many people were even using this weird thing. I’d be curious to hear what some of you are using it for? :slight_smile:

I guess I’d use it for syncing recorded and/or sampled sounds. It’s sort of like a sync-to-bpm function for instruments, except globally and inverted.

It saves on having to fire up the calculator? :slight_smile:

Felt like using this tool today, glad it still works in the latest version of Renoise. Had to change the api version in the manifest to 6.1.

1 Like

sorry for the noob question, but how do i open the file? when i open it with notepad its a bunch of “NULLS”, thx

Check out;

After the scripting editor is enabled, you can go inside a tools guts and change things like the api nr;


Thanks for the help, i changed the api version value in the manifest.xml successfully, but it’s not working. I tried api version 6.1 as you said, reloaded tools, tried reopening renoise, also re-installing the tool, but the shortcut “Set Pattern Length From Sample” on the preferences menu still didn’t appear. :confused: What am i missing? When i try to install the tool it says it was disabled, because of the wrong version, do i need to enable it after i change the api version? How do i do it? Sorry for the stupid questions…

If you haven’t already; after changing the api version nr, you need to hit execute for it to be saved.

Couldn’t find a menu entry real quick, can’t remember if it exists at all(?), but you can find it in the preferences keys tab and hook it up to a keyboard shortcut;


Found the context menu. You can find it right clicking inside the pattern editor and then going into the ‘pattern’ entry.

1 Like

To add to Djeroeks advice: You will also need to make sure you re-enable the tool in the Tool Browser as it will still be disabled by renoise from the first install, even after re-executing the xml:

tool browser

loop from sample


Here is a version with the manifest upgraded and version set to 1.03, I’ll leave it here unless @dblue wants it removed:


This should work fine as a first install in 3.3 but @Kozyus You still will have to enable in the ‘Tool Browser’ as renoise has flagged it from your first install.

note: there is a preferences file with pattern length set to 64 though I couldn’t at first galnce see where that preference is used in the tool; it’s usually accessed with an ‘options.X.value’. May just have been left in from an earlier version, but the tool seems to work fine on other pattern lengths here too.

1 Like

Ohhh that was it! Such a small detail that i didn’t noticed lol. Thanks a lot guys! Hopefully my question will help some newbie in the future as well haha!

1 Like