fluid-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

sf2-xml WAS: Re: [fluid-dev] Preparing for 1.0.9 release


From: wg2002a
Subject: sf2-xml WAS: Re: [fluid-dev] Preparing for 1.0.9 release
Date: Mon, 20 Apr 2009 07:21:15 -0700 (PDT)


> Date: Sun, 19 Apr 2009 22:05:22 -0700
> From: Josh Green <address@hidden>
> 
> I like your idea of turning your SoundFont into a
> collaborative project.
> I've thought about this type of thing before, in regards to
> creating a
> SoundFont patch format, using XML which could be used to
> pass around
> changes and merge them.  libInstPatch already has the
> begging of
> serializing SoundFont objects to XML.  Gotta get some
> other things done
> first though.

On a tangential note to the subject line, Sf2 to XML and back would be nice.  I 
have not done anything with soundfont and never really used a soundfont editor 
yet.  Anyway, I'm at a loss with swami.

About Sf2 to XML and back, there is pysf-2 (new BSD license).  It a python sf2 
to xml and back, but it only handles wave file format and maybe one other 
format, but not ROM sample, so it is not quite complete.  And libinstpatch may 
need to support a few other formats, too.  It can be found at:

   http://code.google.com/p/pysf/
   http://freepats.zenvoid.org/tools/

The code that generates XML uses recursive string copy of the whole XML content 
for every token/line, that can be painfully slow.  I have patched it to use a 
text stream instead and it is at least couple of magnitude difference.  The 
patch also continues but ignore the XML generation for ROM samples instead of 
quitting the conversion, so round trip conversion will lose references to ROM 
samples in the original sf2 file.  I ran into a ROM sample in Unison.sf2.  I 
haven't had a chance to contact the author/mantainer at the google hosted page 
yet.  I'll try that later.

Anyway, here's my pysf-2 diff from the Dec 2007 pysf-2.zip at the google 
project page.

>>>>>>>>>>
diff -r pysf-2.original/pysf.py pysf-2.speedup/pysf.py
291c291
< def DictToXmlStr(Dict):
---
> def DictToXmlStr(Dict, Target):
298c298,299
<             R = R + '\n' + L
---
>             R = '\n' + L
>             Target.write(R);
300,301c301,304
<             R = R + L.strip()
<     R = R + '\n'
---
>             R = L.strip()
>             Target.write(R);
>     R = '\n'
>     Target.write(R);
303c306
<     return R
---
>     return
393c396
<     Xml.write(DictToXmlStr(Dict))
---
>     DictToXmlStr(Dict, Xml)
477a481
>         IgnoreSample = 0
496c500,501
<             LogDie("wavetable %d, can't use %s SampleType %d" % (Order + 1,
---
>             IgnoreSample = 1
>             logging.warn("wavetable %d, can't use %s SampleType %d" % (Order 
> + 1,
505c510,511
<         List.append(WDict)
---
>         if IgnoreSample == 0:
>             List.append(WDict)
522c528,529
<         Order = Order + 1
---
>         if IgnoreSample == 0:
>             Order = Order + 1
679c686
<     OutHandle.write(DictToXmlStr({u'sf2': Dict}))
---
>     DictToXmlStr({u'sf2': Dict}, OutHandle)
<<<<<<<<<<


Jimmy



      




reply via email to

[Prev in Thread] Current Thread [Next in Thread]