Jump to content


Photo

New Tool (2.8, 3.0): Flexible Pattern Resizer


  • Please log in to reply
82 replies to this topic

#1 dblue

dblue

    Dodgy Geezer

  • Admins
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5551 posts
  • Gender:Male
  • Location:Berlin
  • Interests:Code. Music. Graphics.

Posted 08 December 2010 - 20:12

Pattern Resizer

dblue-pattern-resizer-tool.png

Download v1.06: (Renoise v3.0, API v4)
Attached File  org.illformed.PatternResizer300.xrnx   3.61KB   295 downloads

Download v1.06: (Renoise v2.8, API v3)
Attached File  org.illformed.PatternResizer280.xrnx   3.61KB   257 downloads

Brief description:
  • This tool allows you to resize (expand or shrink) a pattern to any arbitrary length ranging from 1 to 512 lines.
Usage:
  • Context menu: Pattern Editor > Pattern > Resize
  • Key binding : Preferences > Keys > Pattern Editor > Pattern > Resize
Notes:
  • Note delays will be calculated and adjusted automatically. Effect commands and automations will also be repositioned to match as closely as possible, but the effect values themselves are not recalculated or interpolated in any way, so if you use any time-based effects then you may need to be readjust these after you resize the pattern. It's also possible that a note may be delayed/shifted to a new line, causing certain effect commands (sample reverse, sample offset, pitch, etc) to be positioned on the wrong line, so you may need to do some readjustment there as well.
  • I've improved the GUI a little bit and have added a few handy buttons. The '1/1' button will reset the length value so that it matches the current pattern. The other buttons just let you quickly jump to some (hopefully) useful fractions/variations of the pattern length. I'm open to suggestions here for what might be more useful in the long run.
  • In certain situations - especially when shrinking or when your pattern already contains a lot of existing note delays - you may experience some notes being dropped. This is sort of unavoidable due to the nature of the process, as there will inevitably be certain notes that get shifted around, delayed a bit more, etc., and would then try to occupy the exact same pattern line. I have implemented a very basic system to help prioritise which notes are more 'important', which mainly comes into play when shrinking the pattern. I have a few ideas for how to handle this better in the future, but it's still quite basic at the moment. Please let me know if you experience any quirky behaviour, and I'll try to tweak it.
  • Still very much a work in progress! Use at your own risk, etc. Make sure your song is backed up before you go experimenting with this thing smile.gif
Changelog:
  • 2010-12-11 - v1.00 - Release.
  • 2010-12-12 - v1.01 - Small improvements to automation and pattern command processing.
  • 2010-12-19 - v1.02 - Fixed this bug. Made some small performance tweaks when processing note and effect columns.
  • 2010-12-20 - v1.03 - Fixed this bug.
  • 2011-03-14 - v1.04 - Updated for Renoise 2.7
  • 2012-03-05 - v1.05 - Updated for Renoise 2.8
  • 2015-02-24 - v1.06 - Fixed this bug.
Credits:
  • This tool was inspired by Syflom's post (and possibly others I've read in the past).
  • Some of my early code was partly based on the work of Beatslaughter.

  • taktik, It-Alien, danoise and 12 others like this

#2 engine

engine

    Guruh Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 904 posts
  • Gender:Male
  • Interests:killing threads.

Posted 09 December 2010 - 03:24

thank you.

#3 Syflom

Syflom

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1456 posts
  • Gender:Male
  • Location:Australia

Posted 09 December 2010 - 08:47

Big thanks dblue! I'll check it out.

In the beginning was the Word
 My XRNX tools: Loop Block Size, Write BPM, Sustain Instrument
Renoise my suggestions: sample pause command, continually paste within selection, advanced edit resize
OS: Windows and OS X


#4 korsun

korsun

    Member

  • Normal Members
  • PipPip
  • 66 posts
  • Gender:Male
  • Location:Russia
  • Interests:Cats

Posted 09 December 2010 - 10:23

Great! Thx!

#5 mr_mark_dollin

mr_mark_dollin

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 2823 posts
  • Gender:Male
  • Location:In the Pattern Matrix.
  • Interests:Quiet Revolutions.

Posted 09 December 2010 - 11:06

dblue for world president.
Posted Image

#6 flight

flight

    Advanced Member

  • Normal Members
  • PipPipPip
  • 101 posts
  • Gender:Male

Posted 09 December 2010 - 11:09

sexeh \:]/


#7 esaruoho

esaruoho

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 2521 posts
  • Gender:Male
  • Location:Kontula, Helsinki, Finland
  • Interests:// Free Energy // Cymatics // Sound visualization // Sustainable energy production // Apple devices // Tesla Motors //

Posted 09 December 2010 - 11:17

thank you so much dBlue. this is way better than merely getting someone to implement advanced.edit.parameters keyboardshortcuts for Expand and Shrink - because that would still mess up the note-delays.

here's to hoping that the Flexible Pattern Expander will be implemented in Renoise. could there also be a Flexible Pattern Shrinker?


MMD: agreed, dBlue for president

everyone: support this guy. World LUA Scripting President woo! :panic:

Edited by esaruoho, 09 December 2010 - 11:21.

| lackluster Website | lackluster on bandcamp | lackluster on facebooklackluster on soundcloud | esaruoho on twitter |

esaruoho@gmail.comesaruoho on reddit | esaruoho on ello | 

| OS X 10.11 El Capitan | Mac Book Pro 2.66 GHz Intel Core 2 Duo / 8GB 1067 MHz DDR3 |

| Latent Impulse Tracker/Scream Tracker 3/Schism Tracker <-> Renoise fanatic |

More API functions, please! ;)

#8 dblue

dblue

    Dodgy Geezer

  • Admins
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5551 posts
  • Gender:Male
  • Location:Berlin
  • Interests:Code. Music. Graphics.

Posted 09 December 2010 - 11:36

could there also be a Flexible Pattern Shrinker?


One of the problems here is how to deal with data that will overlap after being processed. This currently affects my expander in certain cases, especially when there are already a lot of note delays contained in the original pattern that need to be shifted even further.

Here's an example to demonstrate. I've used alternating C-4 and D#4 notes to more easily show what happens. After expanding, we would expect the result to contain exactly same sequence of alternating C-4 and D#4 notes, but due to the additional note delays necessary some of those notes will end up occupying the same line, therefore some data will be lost.

Before expanding:
Posted Image

After expanding from 16 lines to 19 lines:
Posted Image

In the first track, we can see that a sequence with no existing note delays expands correctly, and nothing is lost.

In the second track, we have the same sequence of notes contained in a single note column with some note delays applied as well. We can see that after expanding + adding extra note delays, there isn't enough room for everything to occupy a single note column anymore, and some notes are lost.

In the third track, after separating the C-4 and D#4 notes into their own columns, we can see that expanding works correctly again because there is enough free space to fit in all the delayed/repositioned notes, even though some of them end up occupying the same pattern line.


So... to improve this expander, I will try to add some kind of logic that looks for empty space in the note columns, in order to automatically move overlapping notes there so that nothing is lost. In cases where the pattern is really packed with a lot of notes, then a method to prioritise which data 'survives' may also be necessary. As you can imagine, this has the potential to get pretty weird, and it will be difficult to take things like note-off's into account, to make sure that it doesn't actually ruin your patterns instead of help them!

A shrinking function will suffer even more from this problem of notes being lost due to overlapping data. Will it simply be acceptable to drop stuff that doesn't fit into the new smaller size, or will it be necessary to keep as much of the original data as possible by automatically separating it into new note columns? Etc. There are certainly a few interesting problems to overcome :)

#9 esaruoho

esaruoho

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 2521 posts
  • Gender:Male
  • Location:Kontula, Helsinki, Finland
  • Interests:// Free Energy // Cymatics // Sound visualization // Sustainable energy production // Apple devices // Tesla Motors //

Posted 09 December 2010 - 11:56

A shrinking function will suffer even more from this problem of notes being lost due to overlapping data. Will it simply be acceptable to drop stuff that doesn't fit into the new smaller size, or will it be necessary to keep as much of the original data as possible by automatically separating it into new note columns? Etc. There are certainly a few interesting problems to overcome :)


it was acceptable to drop the lost-in-between-notes for most trackers. i guess it'd be really confusing if the script switched from track#1 having one column of notes to two or four, after shrinking. could be a nightmare to handle?

| lackluster Website | lackluster on bandcamp | lackluster on facebooklackluster on soundcloud | esaruoho on twitter |

esaruoho@gmail.comesaruoho on reddit | esaruoho on ello | 

| OS X 10.11 El Capitan | Mac Book Pro 2.66 GHz Intel Core 2 Duo / 8GB 1067 MHz DDR3 |

| Latent Impulse Tracker/Scream Tracker 3/Schism Tracker <-> Renoise fanatic |

More API functions, please! ;)

#10 dblue

dblue

    Dodgy Geezer

  • Admins
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5551 posts
  • Gender:Male
  • Location:Berlin
  • Interests:Code. Music. Graphics.

Posted 09 December 2010 - 12:04

it was acceptable to drop the lost-in-between-notes for most trackers. i guess it'd be really confusing if the script switched from track#1 having one column of notes to two or four, after shrinking. could be a nightmare to handle?

You're quite right. Nobody really questions the fact that in order to shrink the pattern you will inevitably lose some data. This is just me thinking about ways to improve upon that process. At the end of the day, it's all just checkboxes in a dialog to enable and disable various things. I certainly wouldn't enforce any particular method on people when the results would be so experimental. I'll see what I can come up with :)

#11 Ledger

Ledger

    Guruh Motha Fakka Knows More About Renoise Than Taktik

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 3333 posts
  • Gender:Male

Posted 09 December 2010 - 13:44

Thanks for this dblue will check it out!

Good to see you having some time for a bit of Lua :)

--> Lua For Beginners <--
--> Lua for newbies <--

My Scripts On Forum

Top Tip!

 

cpu : Xeon 1231 v3, os : Win 7 64bit, audio: Audient iD4
posts as 4tune @ KvR and some other music related sites


#12 Djeroek

Djeroek

    Probably More God or Borg Than Human Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 6664 posts
  • Gender:Male
  • Location:Borneo

Posted 09 December 2010 - 19:19

Really cool stuff! Thanks

#13 dblue

dblue

    Dodgy Geezer

  • Admins
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5551 posts
  • Gender:Male
  • Location:Berlin
  • Interests:Code. Music. Graphics.

Posted 11 December 2010 - 16:45

Bump.

A new and improved tool is now available in the original post above.

Expanding and shrinking is now possible.

If you tried the old version of this tool - org.illformed.PatternExpander.xrnx - then please just delete that and use org.illformed.PatternResizer.xrnx instead.

Cheers!

#14 Djeroek

Djeroek

    Probably More God or Borg Than Human Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 6664 posts
  • Gender:Male
  • Location:Borneo

Posted 11 December 2010 - 16:47

cheers!

Please delete org.illformed.PatternExpander.xrnx and use org.illformed.PatternResizer.xrnx instead.


Overwriting doesn't work?

#15 dblue

dblue

    Dodgy Geezer

  • Admins
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5551 posts
  • Gender:Male
  • Location:Berlin
  • Interests:Code. Music. Graphics.

Posted 11 December 2010 - 16:54

Overwriting doesn't work?

They're both different tools, so you could have them both installed if you want, although it'd be rather pointless.

It should have been 'Pattern Resizer' from the start. My mistake. Sorry for the confusion. Just ditch the old one. :)

#16 Djeroek

Djeroek

    Probably More God or Borg Than Human Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 6664 posts
  • Gender:Male
  • Location:Borneo

Posted 11 December 2010 - 17:09

It should have been 'Pattern Resizer' from the start. My mistake. Sorry for the confusion. Just ditch the old one. :)


No worries! Great tool for trying strange grooves, I like this a lot :)

If you ever update this tool in the future, consider implementing an option for running the script on pattern selection as well, with a checkbox to keep pattern-length or not. Nice for offsetting rhythmical patterns on separate tracks.

#17 flight

flight

    Advanced Member

  • Normal Members
  • PipPipPip
  • 101 posts
  • Gender:Male

Posted 11 December 2010 - 17:10

woop woop .. always wanted a time sig tool.. sweet

thanks

Edited by flight, 11 December 2010 - 17:11.



#18 dblue

dblue

    Dodgy Geezer

  • Admins
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5551 posts
  • Gender:Male
  • Location:Berlin
  • Interests:Code. Music. Graphics.

Posted 11 December 2010 - 17:19

If you ever update this tool in the future, consider implementing an option for running the script on pattern selection as well, with a checkbox to keep pattern-length or not. Nice for offsetting rhythmical patterns on separate tracks.

For sure. I'm still just figuring out the core logic and trying to optimise things. But I'm definitely thinking about how this could apply to a wider range of selections. Making a selection of 16th notes within the pattern, and then transforming those to triplets or something like that, without affecting anything outside your selection, etc. At the moment I'm mainly using it on a temporary pattern within my song, so that I can experiment with ideas and then copy bits and pieces into other patterns.


woop woop .. always wanted a time sig tool.. sweet

I should clarify things, just in case. Those buttons in the GUI don't really relate to time signatures in the way you might think. They're just handy shortcuts for quickly setting the pattern length to half, or double, or three quarters, etc. You can definitely use this to help you convert stuff to different time signatures, but my tool doesn't do anything really clever (yet).

#19 Djeroek

Djeroek

    Probably More God or Borg Than Human Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 6664 posts
  • Gender:Male
  • Location:Borneo

Posted 11 December 2010 - 17:31

I'm mainly using it on a temporary pattern within my song, so that I can experiment with ideas and then copy bits and pieces into other patterns.


I like how this tool stretches 'regular' sounding groove over an arbitrary pattern length using delay values where necessary and so have the quantized note input on a newly programmed track sound groovish :) .

I should clarify things, just in case. Those buttons in the GUI don't really relate to time signatures in the way you might think. They're just handy shortcuts for quickly setting the pattern length to half, or double, or three quarters, etc.


Heh, was thinking about time signatures as well, and a previous pattern conversion request of mine:
http://www.renoise.c...ndpost&p=167874

Edited by Jonas, 11 December 2010 - 17:32.


#20 esaruoho

esaruoho

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 2521 posts
  • Gender:Male
  • Location:Kontula, Helsinki, Finland
  • Interests:// Free Energy // Cymatics // Sound visualization // Sustainable energy production // Apple devices // Tesla Motors //

Posted 12 December 2010 - 11:08

dBlue: just tried the new version, and its great! resized a 64 row pattern to 32 and then to 31 and the delays are there. wonnerful work!

i know this is asking a bit much: but do you think it'll eventually be possible to run this on an individual track or a selection? ;)

| lackluster Website | lackluster on bandcamp | lackluster on facebooklackluster on soundcloud | esaruoho on twitter |

esaruoho@gmail.comesaruoho on reddit | esaruoho on ello | 

| OS X 10.11 El Capitan | Mac Book Pro 2.66 GHz Intel Core 2 Duo / 8GB 1067 MHz DDR3 |

| Latent Impulse Tracker/Scream Tracker 3/Schism Tracker <-> Renoise fanatic |

More API functions, please! ;)

#21 dblue

dblue

    Dodgy Geezer

  • Admins
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5551 posts
  • Gender:Male
  • Location:Berlin
  • Interests:Code. Music. Graphics.

Posted 12 December 2010 - 12:45

do you think it'll eventually be possible to run this on an individual track or a selection? ;)

Sure thing. I'll try to set aside some time to work on this thing every couple of days or something like that. There's still lots of room for improvement.

#22 FoZ

FoZ

    Member

  • Normal Members
  • PipPip
  • 43 posts
  • Gender:Male
  • Location:Nørrebronx - Denmark

Posted 12 December 2010 - 13:10

Very nice tool. :rolleyes:

Is it possible to expand/shrink the patterns in the entire song with one click, or did I overlook this feature?
-CPU- Intel Core i7-3770K CPU @ 3.50GHz
-OS- Windows 764-bit
-Audio- M-Audio FastTrack Pro, NI Rig Kontrol 3

#23 vV

vV

    God's or Borg's Chief and Ruler of All Species

  • Moderator
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 16855 posts
  • Gender:Male
  • Location:Netherlands

Posted 12 December 2010 - 14:00

Very nice tool. :rolleyes:

Is it possible to expand/shrink the patterns in the entire song with one click, or did I overlook this feature?


I don't think this is too hard....
Simply an extra mechanism to scan the complete sequence and let the original program reprocess the supplied pattern. I haven't peeked at the code though, but i suspect the pattern-size is looked up currently from the current cursor position and sequencer position. This would require a little change in that case.
Vv....


cpu Intel Core i7-4820K @3.70GHz
chipset Intel X79 chipset
mem 32 Gb 2400Mhz
os Win 7 64-bit SP1, DirectX 11
audio ESI ESP1010e - > Driver rev:2.0.6.0
video nVidia Geforce GTX780 - > Driver rev:335.23


Renoise Official Manual

#24 dblue

dblue

    Dodgy Geezer

  • Admins
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5551 posts
  • Gender:Male
  • Location:Berlin
  • Interests:Code. Music. Graphics.

Posted 12 December 2010 - 15:04

Is it possible to expand/shrink the patterns in the entire song with one click, or did I overlook this feature?


I don't think this is too hard....


The act of processing all patterns is of course very easy, but the main reason I did not add this yet is because your song may contain patterns that are different sizes, so it could be tricky for my tool to understand what it should do in those situations. Beatslaughter's 4 LPB to 12 LPB tool could easily process the entire song because the conversion is always working with whole numbers. This tool is a bit more involved, because it's potentially working with fractional conversions, and therefore extra care is required.

Let's imagine you have a pattern that you want to convert from 32 lines to 57 lines - a silly example I know, but stick with me.

The conversion ratio for this would be: 57 / 32 = 1.78125

All the notes in the pattern, note delays, etc. are processed (expanded in this case) using this ratio of 1.78125

But what if the next pattern in your song is only 16 lines long, rather than 32? If we apply the same ratio to that 16 line pattern, then we end up with a new pattern length that needs to be: 16 * 1.78125 = 28.5 lines

Obviously we cannot have half of a pattern line, so what should happen in this case? The new pattern length could be rounded down to 28 or rounded up to 29, but in both cases you end up with some incorrect results: If we just use the same conversion ratio, then one of the notes will end up being positioned incorrectly, and possibly even delayed so much that it disappears off the bottom of the pattern itself and is never actually heard. But if we change the ratio to fit 28 or 29 lines, then that pattern will have slightly different timing to all the other patterns, which could dramatically alter how that particular pattern sounds.

So, I still need to do some thinking about the smartest way to handle these kind of situations. It probably won't be a big problem most of the time, but I don't want the tool to produce any really incorrect results that might give people a nasty surprise. Maybe I'll allow the user to perform the 'incorrect' conversion anyway, but simply warn them about it first by analysing the pattern lengths and looking for potential problems.

Anyway... :)

#25 dalezy

dalezy

    New Member

  • Normal Members
  • Pip
  • 1 posts
  • Gender:Male

Posted 12 December 2010 - 15:39

awesome, that's something i've been missing since i left ft2 behind.