Merge Songs

The script does exactly this, adds new channels and adds the new patterns behind on those new channels, just double checked here. If your XRNS had lot’s of channels you may have to scroll to the right in the pattern matrix to see those added blocks. Maybe i did misunderstood you?

Yes I can see the extra channels added on the right, but not the patterns of the 2nd song… so I do have the instruments of the 2nd song but not it patterns. I’m going to oldskool copy+paste for now, still better than also having to reprogram all vst instruments :)

edit: I just found out that it does copy the patterns but just doesn’t place them in the song, so if in song 1 the last pattern is e.g. 20 the first pattern of song 2 will be on 21, but you still have to manually insert them there… but beats copy+pasting… hell yea :D

This isn’t right.

Patterns of Song2 are appended to Song1. In the Pattern Sequencer with the Pattern Matrix visible scroll to the right, then scroll down. All pattenrs should all be there.

Are you sure?

If it’s really not working, then please help me solve this bug:

Test #1

  1. Create two new songs using Renoise 2.8, just simple junk.
  2. Merge these two songs
    Rationale: These will merge. I’ve tested dozens (and dozens) of XNRS files. They merge as explained above. Confirm that you see this so that we are both talking about the same thing.

Test #2

  1. In Renoise, click “Song Settings” then “Upgrade to latest version”
  2. Repeat for both songs
  3. Merge the two newly saved songs
    Rationale: Maybe you are trying to upgrade old MOD files or something and I just don’t do enough sanity check for old version I never look at anymore.

Get back to me with the results of these two tests. If it’s still not working, send me the XRNS files so I can test myself and fix the script. Send me these by email. I would like to continue this conversation offline.


tested in both 2.8 and 2.5 (which I in most cases still prefer because of the old pattern effect codes, I actually hate the coding in 2.8, except for the other features ofcourse) and still same problem. I will send you an email with 2 really simple tracks and the merged one now.

allright guys fixed it. thank you so much ^^ guess I just needed an updated version after all :P

Just now saw this - awesome! Thanks so much for updating this. It’s already proving quite helpful getting ready for a gig next week.

I’m trying to use this tool on some rather big tracks - and cannot do it due to a memory limitation.
E.g. I get this message:

Fatal error: Allowed memory size of 13427728 bytes exhausted… in C:…xrns_functions.php on line 182.

Any way to increase the “allowed memory size”? My computer should be able to handle it.

I’m sorry if there’s no (or an obvious) way to achieve this. I’m totally ignorant when it comes to php and stuff.

Not sure if this will work, but you could try opening the PHP script file and add the following line near the top of it. Adjust the memory size as needed.


In addition to Beatslaughter’s suggestion, please use the patched version of XRNS-MERGE, available here:

I haven’t updated the Sourceforge files, yet.

Thanks a lot for the suggestion. I tried putting this line in top of both xrns_functions.php and xrns_merge.php, but whatever I set the limit to (tried large and small numbers) it doesn’t matter. It still returns with the message:

Warning: SimpleXMLElement::asXML<>: Memory allocation failed : growing buffer in C\...xrns_functions.php on line 182  

Observering the php.exe working in the Process Manager, I can see that the error message sets in when php.exe is using approx. 1 GB ram (it won’t allocate more than that though there’s approx. 1.5 GB unused ram).
So, I would guess there’s another memory limit at work here but haven’t been able to find anything about it on the internet.

Can you share the XRNS files that cause the error?

I would be happy to share the files with (just) you, Conner.

But it’s a lot of data: They are 130 MB and 170 MB.
If you still wan’t to test them yourself, I can send them via Skype or what you would prefer.

Great. Can you share a folder on Dropbox with me?

dac514 < yacht >

PS: This is not an email I read, it’s more of a spam catcher that I check once a month, linked to these kinds of services. If you need to email me, click my sig then go to my CV for my gmail.

I’ve shared a Dropbox folder. Happy testing!

Edit: The problem seems to arise whenever the songs a loaded with instrument/sample data beyond a certain limit. E.g. it seems I can create the problem with any songs by just filling samples in them.

I did some testing on my OS X machine. (It doesn’t use the XRNS-SF front-end, just uses whatever PHP I have installed at the command prompt.)

I added this to the top of xrns_merge.php, near line 18:

ini_set('memory_limit', '-1');  

This basically says “no limit.”

The merge worked fine for me, so far.

I will do some testing on Windows in the next hour and reply again.

I tried on a Windows (32bit) Netbook with 1 gig of RAM.

i can confirm the problem. I too get a “Memory allocation failed : growing buffer” error.

I tried:

  • Upgrading to PHP 5.4.3
  • Downgrading to PHP 5.3.13
  • Freeing up memory manually (see changes)

Nothing worked.

My guess at this point is that 1 GB of ram is just not enough. My Mac (64bit) has 8 GB of RAM, for example. The merge works fine.

The next test would be to try on a 64bit Windows machine with more memory. You’d have to share your files with Beatslaughter if he’s up for it? Or another tester? (Note to tester: Update from SVN first, please. You can do this by double clicking “get_svn_dev_version_scripts.cmd” in the root dir of XRNS-SF to get my changes.)

Sorry, there isn’t much I can do here. Technically speaking, I don’t want to change from SimpleXML to a leaner library. SimpleXML is simply a memory pig AFAIK.

Yes, i can do that. Running Windows 7 64bit here with 8GB RAM and also have Dropbox. If Drop Shadow is ok with that he can send me an invite to the shared folder to “info <…>”.

I have 3 GB ram here.
Thanks for looking into this issue. I’ve shared the folder with Beatslaughter too.

With default settings i was able to replicate the running out of memory issue and adding that memory size line to the PHP script didn’t help either. I have found a solution it seems by making the PHP executable large address aware. Normally this is a compiler setting, but with this small tool you can patch the file yourself.

  1. Download the small tool from the first post here:
  2. Pick the php.exe file in the php subfolder of xrns-sf as target.
  3. Tick the checkbox which enables the flag and then press the save button.
  4. Try the merge again and it should work.

If you’re too lazy for all that, grab the appended php.exe and change the file with the one included.

I’ve applied the patch and updated the xrns_functions.php and xrns_functions.php to Conner’s latest versions.

I tried it in three different scenarios.

1. WinXP 32bit 3GB ram.
Same issue.

2. WinXP 32bit 3GB ram - With 3GB switch enabled.
It was still not possible but I could see in the Task Manager that the php.exe now topped at around 1.5GB when processing the files (before the patch was applied it was 1GB). So it seemed it got further in the process. And it gave a different error report (still mentioning memory issues though).
Still, it stopped way before all available memory were used.

3. Win7 64bit 2GB ram.
Success! I also tried with some even larger files. Still success.

So, for some reason WinXP 32bit 3GB ram can’t manage the job while Win7 64bit 2GB ram can.

In any case: Thanks for the effort. Using my laptop with Win7, I am now a happy merger.