Merge Songs

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.

So…

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

Can you post two XRNS that I can use to duplicate the problem?

Thanks.

Two really simple songs here…

Thanks for looking into it.

Thanks for that. XRNS files to duplicate bugs are really really helpful.

The problem is as follows:

Old XSD (every version before 2.8)

<element name="Instrument" type="xs:string" minoccurs="0"></element>  

Newest XSD (RenoiseSong37.xsd)

<element name="Instrument" type="xs:string" default=".." minoccurs="0"></element>  

The old value was always “numeric” whereas the new value can be both “numeric” and “…” - I’m not sure if this is a bug/mistake in Renoise? Anyways…

The fix is to change line ~279 from:

if ($z->Instrument) {  

To:

if ($z->Instrument && '..' != $z->Instrument) {  

See this commit for more details. As I am shutting down XRNS-PHP I’m not sure how to get these changes to you. The best way is to change the code yourself until something is worked out. Or get comfortable with the command line and clone my new git repo, which I will be updating from now on.

Hope this helps.

Cheers.

Great. I changed the code and it works.

However, I’ve encountered a new issue.

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…

Thanks Drop Shadow, xrns examples are awesome, you are my favourite user of the tool.

I will check this out and reply here soon.

Ok I found the problem.

The issue is that I cut and paste this code snippet verbatim a long time ago, but it never worked. Nobody has reported it as clearly as you did until now.

The fix is this diff. Or replace the old routing code with:

  
// AssignedTrack routings  
foreach ($sx2->Instruments->Instrument as $x) {  
 if ($x->PluginProperties->OutputRoutings->OutputRouting) {  
 foreach ($x->PluginProperties->OutputRoutings->OutputRouting as $y) {  
 if ($y->AssignedTrack != -1) {  
 $y->AssignedTrack += $offset;  
 }  
 }  
 }  
 if ($x->MidiInputProperties->AssignedTrack != -1) {  
 $x->MidiInputProperties->AssignedTrack += $offset;  
 }  
}  
  

The code is on GitHub. Can you work with this?

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  
  
Warning: copy(C:\Users\.../xrns_merge_55e65da6fd51f4be6a897391  
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!

If GitHub is unfamiliar to you, Wordpad is fine.

Again thanks for the bug report. Amazing as usual. The fix has been committed here.

Basically look for:

  
// SampleData directory  
if (is_dir($unzip2 . '/SampleData/')) {  
 foreach(new DirectoryIterator($unzip2 . '/SampleData/') as $file) {  
  

And change to:

  
// SampleData directory  
if (is_dir($unzip2 . '/SampleData/')) {  
  
 if (!is_dir($unzip1 . '/SampleData/')) {  
 $ret = mkdir($unzip1 . '/SampleData/');  
 }  
  
 foreach(new DirectoryIterator($unzip2 . '/SampleData/') as $file) {  
  

Hope this helps.

1 Like