View Ticket
Not logged in
Ticket UUID: 823c422a090af067ae0a108a7dbb2361694adff4
Title: Conversion of files with loops having insufficient margin is not invertible
Status: Closed Type: Code_Defect
Severity: Minor Priority: Immediate
Subsystem: Resolution: Fixed
Last Modified: 2014-11-22 22:26:32
Version Found In: d0f178c2c0e9c7c7
User Comments:
anonymous added on 2014-11-19 15:06:26:
When converting a .sf2 file to XML and back, loops that elicit the warning message "Insufficient loop margin" get dropped.  I think it would be better to keep them so that as little information as possible is lost in such back-and-forth translation.

To reproduce:

wget http://www.gson.org/bugs/pysf/guitars.sf2
./pysf.py --sf2xml guitars.sf2 guitars.xml
./pysf.py --xml2sf guitars.xml guitars.sf2-1
./pysf.py --sf2xml guitars.sf2-1 guitars.xml-1
diff guitars.xml guitars.xml-1

The output shows a number of loops dropped, for example

<         <loop>
<           <begin>26621</begin>
<           <end>27065</end>
<         </loop>

Suggested fix:

diff --git a/pysf.py b/pysf.py
index c84023b..a83c117 100755
--- a/pysf.py
+++ b/pysf.py
@@ -951,8 +951,6 @@ def SfSdtaShdr(Dict):
                 WLoopEnd < 7      \
             :
                 logging.warn("Wavetable %d: Insufficient loop margin" % (Id))
-                WtLoopstart = 0
-                WtLoopend = 0
         ByOriginalPitch = Def(Val(Wavetable, u'pitch'), 60)
         SfSampleType = 1
         WSampleLink = 0

bencollver added on 2014-11-22 22:26:32:
Thank you for the bug report and fix!  -Ben