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.
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.
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.
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.
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.
I know this great tool isn’t exactly maintained but anyways:
I’ve got this issue which is perhaps best explained by an example:
Let’s say I want to merge song 1 and 2 (in that order).
Song 1 contain instrument numbers 00-09. So does song 2 (after merging, song 2’s instrument will be reordered to 0A-13.
Song 2 consists of one track with 3 columns. In the third of these columns there’s a note playing instrument 01 (0B after merge).
Now, in the first two columns of that track there will be inserted two 0A’s in the instrument column.
--- .. --- .. C-4 01
will after the merge operation become
--- 0A --- 0A C-4 0B
while it should be
--- .. --- .. C-4 0B
With complex songs, this means there will be lots of changes to the way the song sounds…
If there’s a quick fix to this, I would be grateful if anyone would make it.
When the second of the merged songs has a track in which a VSTi is AutoAssigned to a track, this Autoassigning will be changed, so that it will now be assigned to the corresponding track (meaning same track number) in the first of the songs that were merged.
See test examples and notice that after merging the sound output is now much louder because the original track dsp in song 2x is now no longer applied to the VSTi.
For test purposes, I’ve used the free VSTi dmihammer (also attached).
Hope this will help you in your “git repo” work.
And if you got a quick fix for xrns-sf too, I’m once again very grateful…
Once again good fix. I changed the code in Wordpad. It works great.
Re. Github: I’m really a simple user and know nothing about coding. So I look for the executable file and when I can’t find it I don’t know what to do. I should somehow execute the xrns_merge.php inside a GitHub program … ?
Btw: found another bug.
When Song 1 doesn’t contain any samples (it’s either empty or all instruments are VSTi’s) and Song 2 contain one or more sample based instruments, merging will fail with this kind of error:
Warning: mkdir(): No such file or directory in C:\...\xrns-sf-1.09\scripts\xrns_functions.php on line 88
b683b171_Track01//SampleData/Instrument10 (Hat-001)/Sample00 (Hat-001).flac): fa
iled to open stream: No such file or directory in C:\...\xrns-sf-1.09\scripts\xrns_functions.php on line 98
Error: File 'C:\Users\.../xrns_merge_af9b6dfbace3518aaf1cbf96b
42e8242_Track02//SampleData/Instrument00 (Hat-001)/Sample00 (Hat-001).flac' coul
d not be copied.
Try merging the two attached songs to produce the error.
Select 2y as the first song to be merged and it’ll work!