# Merge Songs

**URL:** <https://forum.renoise.com/t/merge-songs/18643>\
**Category:** Renoise XML Fileformats & Tools\
**Created:** [January 4, 2007, 2:36am UTC](https://forum.renoise.com/t/merge-songs/18643 "2007-01-04T02:36:51Z")\
**Posts on this page:** 20\
**Page:** 8

<div class="post-metadata">

**Author:** ![Beatslaughter](https://forum.renoise.com/user_avatar/forum.renoise.com/beatslaughter/32/236_2.png) [@Beatslaughter](https://forum.renoise.com/u/Beatslaughter)\
**Post date:** [April 9, 2012, 1:30pm UTC](https://forum.renoise.com/t/merge-songs/18643/141 "2012-04-09T13:30:07Z")

</div>

> [@Wikipediamedia](#):
>
> Hey guys,
> 
> I just stumbled upon this thread via google actually, and finally got the merge script working. Now the instruments of both xrns files are merged, but the patterns of the 2nd file are missing. I’d hoped it would sorta ‘paste’ the patterns of the 2nd xrns file under the patterns of the 1st xrns (making for example two 2:00 minutes songs into one 4:00 minute song) Would there be a way to achieve this?
> 
> I’m loving the input here btw… keep it up ![:)](https://forum.renoise.com/uploads/default/original/2X/f/f31646767a12ff3f4d6b8c4766d2ea41b23d4ab9.gif)

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?

---

<div class="post-metadata">

**Author:** ![MixmasterX](https://forum.renoise.com/letter_avatar/mixmasterx/32/6_449c533f586939b6e5f246632a46421f.png) [@MixmasterX](https://forum.renoise.com/u/MixmasterX)\
**Post date:** [April 9, 2012, 4:02pm UTC](https://forum.renoise.com/t/merge-songs/18643/142 "2012-04-09T16:02:14Z")

</div>

> [@Beatslaughter](#):
>
> 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 ![:)](https://forum.renoise.com/uploads/default/original/2X/f/f31646767a12ff3f4d6b8c4766d2ea41b23d4ab9.gif)

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](https://forum.renoise.com/uploads/default/original/2X/4/4e279733a789da83bda5b44aedcf6a0d5178edcb.gif)

---

<div class="post-metadata">

**Author:** ![dac514](https://forum.renoise.com/user_avatar/forum.renoise.com/dac514/32/100_2.png) [@dac514](https://forum.renoise.com/u/dac514)\
**Post date:** [April 9, 2012, 4:43pm UTC](https://forum.renoise.com/t/merge-songs/18643/143 "2012-04-09T16:43:05Z")

</div>

> [@Wikipediamedia](#):
>
> 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](https://forum.renoise.com/uploads/default/original/2X/4/4e279733a789da83bda5b44aedcf6a0d5178edcb.gif)

This isn’t right.

Patterns of Song2 are appended to Song1. In the [Pattern Sequencer with the Pattern Matrix visible](http://tutorials.renoise.com/wiki/Pattern_Sequencer) 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”](http://tutorials.renoise.com/wiki/Song_Settings)
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](http://www.trotch.com/dac_cv.html). I would like to continue this conversation offline.

Regards,

---

<div class="post-metadata">

**Author:** ![MixmasterX](https://forum.renoise.com/letter_avatar/mixmasterx/32/6_449c533f586939b6e5f246632a46421f.png) [@MixmasterX](https://forum.renoise.com/u/MixmasterX)\
**Post date:** [April 9, 2012, 5:10pm UTC](https://forum.renoise.com/t/merge-songs/18643/144 "2012-04-09T17:10:59Z")

</div>

> [@dac514](#):
>
> This isn’t right.
> 
> Patterns of Song2 are appended to Song1. In the [Pattern Sequencer with the Pattern Matrix visible](http://tutorials.renoise.com/wiki/Pattern_Sequencer) 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:

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.

---

<div class="post-metadata">

**Author:** ![MixmasterX](https://forum.renoise.com/letter_avatar/mixmasterx/32/6_449c533f586939b6e5f246632a46421f.png) [@MixmasterX](https://forum.renoise.com/u/MixmasterX)\
**Post date:** [April 9, 2012, 6:19pm UTC](https://forum.renoise.com/t/merge-songs/18643/145 "2012-04-09T18:19:01Z")

</div>

allright guys fixed it. thank you so much ^^ guess I just needed an updated version after all ![:P](https://files.renoise.com/forum/emoticons/default/tongue.gif)

---

<div class="post-metadata">

**Author:** ![agargara](https://forum.renoise.com/user_avatar/forum.renoise.com/agargara/32/801_2.png) [@agargara](https://forum.renoise.com/u/agargara)\
**Post date:** [May 10, 2012, 6:57am UTC](https://forum.renoise.com/t/merge-songs/18643/146 "2012-05-10T06:57:28Z")

</div>

> [@dac514](#):
>
> Fixed in v1.09. Thanks for mentioning it.
> 
> Download: [XRNS-PHP download | SourceForge.net](https://sourceforge.net/projects/xrns-php/)

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

---

<div class="post-metadata">

**Author:** ![Drop\_Shadow](https://forum.renoise.com/letter_avatar/drop_shadow/32/6_449c533f586939b6e5f246632a46421f.png) [@Drop\_Shadow](https://forum.renoise.com/u/Drop_Shadow)\
**Post date:** [June 1, 2012, 9:20pm UTC](https://forum.renoise.com/t/merge-songs/18643/147 "2012-06-01T21:20:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Beatslaughter](https://forum.renoise.com/user_avatar/forum.renoise.com/beatslaughter/32/236_2.png) [@Beatslaughter](https://forum.renoise.com/u/Beatslaughter)\
**Post date:** [June 4, 2012, 11:15am UTC](https://forum.renoise.com/t/merge-songs/18643/148 "2012-06-04T11:15:19Z")

</div>

> [@Drop Shadow](#):
>
> 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.

ini\_set(“memory\_limit”,”16M”);

---

<div class="post-metadata">

**Author:** ![dac514](https://forum.renoise.com/user_avatar/forum.renoise.com/dac514/32/100_2.png) [@dac514](https://forum.renoise.com/u/dac514)\
**Post date:** [June 4, 2012, 12:22pm UTC](https://forum.renoise.com/t/merge-songs/18643/149 "2012-06-04T12:22:34Z")

</div>

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

> [@Xrns-php](https://forum.renoise.com/t/xrns-php/20035):
>
> Too old, didn’t read. URLs to project. [http://xrns-php.sourceforge.net/](http://xrns-php.sourceforge.net/) -=-=- I have put in a request for xrns-php which will be reviewed by [SourceForge.net](http://SourceForge.net) staff in the next two business days xrns-php, licensed as “public domain” will be used to consolidate all areas of activity and maintain a centralized repository for scripts which could be used standalone at the prompt (on OS X or Linux, for example) or dropped into the Windows front-end by doing a simple cvs check-out. The idea is…

I haven’t updated the Sourceforge files, yet.

---

<div class="post-metadata">

**Author:** ![Drop\_Shadow](https://forum.renoise.com/letter_avatar/drop_shadow/32/6_449c533f586939b6e5f246632a46421f.png) [@Drop\_Shadow](https://forum.renoise.com/u/Drop_Shadow)\
**Post date:** [June 4, 2012, 4:29pm UTC](https://forum.renoise.com/t/merge-songs/18643/150 "2012-06-04T16:29:08Z")

</div>

> [@Beatslaughter](#):
>
> 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.
> 
> ini\_set(“memory\_limit”,”16M”);

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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![dac514](https://forum.renoise.com/user_avatar/forum.renoise.com/dac514/32/100_2.png) [@dac514](https://forum.renoise.com/u/dac514)\
**Post date:** [June 4, 2012, 5:12pm UTC](https://forum.renoise.com/t/merge-songs/18643/151 "2012-06-04T17:12:45Z")

</div>

Can you share the XRNS files that cause the error?

---

<div class="post-metadata">

**Author:** ![Drop\_Shadow](https://forum.renoise.com/letter_avatar/drop_shadow/32/6_449c533f586939b6e5f246632a46421f.png) [@Drop\_Shadow](https://forum.renoise.com/u/Drop_Shadow)\
**Post date:** [June 4, 2012, 8:06pm UTC](https://forum.renoise.com/t/merge-songs/18643/152 "2012-06-04T20:06:22Z")

</div>

> [@dac514](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![dac514](https://forum.renoise.com/user_avatar/forum.renoise.com/dac514/32/100_2.png) [@dac514](https://forum.renoise.com/u/dac514)\
**Post date:** [June 4, 2012, 8:22pm UTC](https://forum.renoise.com/t/merge-songs/18643/153 "2012-06-04T20:22:35Z")

</div>

> [@Drop Shadow](#):
>
> 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](http://db.tt/oMtKiLwv) with me?

dac514 \< yacht \> [hotmail.com](http://hotmail.com)

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.

---

<div class="post-metadata">

**Author:** ![Drop\_Shadow](https://forum.renoise.com/letter_avatar/drop_shadow/32/6_449c533f586939b6e5f246632a46421f.png) [@Drop\_Shadow](https://forum.renoise.com/u/Drop_Shadow)\
**Post date:** [June 4, 2012, 10:29pm UTC](https://forum.renoise.com/t/merge-songs/18643/154 "2012-06-04T22:29:46Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dac514](https://forum.renoise.com/user_avatar/forum.renoise.com/dac514/32/100_2.png) [@dac514](https://forum.renoise.com/u/dac514)\
**Post date:** [June 5, 2012, 1:06am UTC](https://forum.renoise.com/t/merge-songs/18643/155 "2012-06-05T01:06:33Z")

</div>

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:

```auto
  
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.

---

<div class="post-metadata">

**Author:** ![dac514](https://forum.renoise.com/user_avatar/forum.renoise.com/dac514/32/100_2.png) [@dac514](https://forum.renoise.com/u/dac514)\
**Post date:** [June 5, 2012, 2:43am UTC](https://forum.renoise.com/t/merge-songs/18643/156 "2012-06-05T02:43:17Z")

</div>

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](http://xrns-php.svn.sourceforge.net/viewvc/xrns-php?view=revision&revision=147))

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.

---

<div class="post-metadata">

**Author:** ![Beatslaughter](https://forum.renoise.com/user_avatar/forum.renoise.com/beatslaughter/32/236_2.png) [@Beatslaughter](https://forum.renoise.com/u/Beatslaughter)\
**Post date:** [June 5, 2012, 11:42am UTC](https://forum.renoise.com/t/merge-songs/18643/157 "2012-06-05T11:42:05Z")

</div>

> [@dac514](#):
>
> 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?

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 \<…\> [beatslaughter.de](http://beatslaughter.de)”.

---

<div class="post-metadata">

**Author:** ![Drop\_Shadow](https://forum.renoise.com/letter_avatar/drop_shadow/32/6_449c533f586939b6e5f246632a46421f.png) [@Drop\_Shadow](https://forum.renoise.com/u/Drop_Shadow)\
**Post date:** [June 5, 2012, 3:53pm UTC](https://forum.renoise.com/t/merge-songs/18643/158 "2012-06-05T15:53:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Beatslaughter](https://forum.renoise.com/user_avatar/forum.renoise.com/beatslaughter/32/236_2.png) [@Beatslaughter](https://forum.renoise.com/u/Beatslaughter)\
**Post date:** [June 5, 2012, 5:20pm UTC](https://forum.renoise.com/t/merge-songs/18643/159 "2012-06-05T17:20:49Z")

</div>

> [@Drop Shadow](#):
>
> 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: [http://www.techpowerup.com/forums/showthread.php?t=112556](http://www.techpowerup.com/forums/showthread.php?t=112556)
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.

---

<div class="post-metadata">

**Author:** ![Drop\_Shadow](https://forum.renoise.com/letter_avatar/drop_shadow/32/6_449c533f586939b6e5f246632a46421f.png) [@Drop\_Shadow](https://forum.renoise.com/u/Drop_Shadow)\
**Post date:** [June 5, 2012, 9:31pm UTC](https://forum.renoise.com/t/merge-songs/18643/160 "2012-06-05T21:31:04Z")

</div>

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.

[Previous page](https://forum.renoise.com/t/merge-songs/18643.md?page=7)

[Next page](https://forum.renoise.com/t/merge-songs/18643.md?page=9)
