User Tools

Site Tools


misc:synchsafe

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

misc:synchsafe [2009/09/28 17:32] – created crustymonkeymisc:synchsafe [2009/09/28 17:38] (current) crustymonkey
Line 1: Line 1:
 ====== Synchsafe Integers ====== ====== Synchsafe Integers ======
-Recently, I was looking at putting together a simple, easy to use, Python library for reading and writing ID3v2 tags in mp3 files.  This is rather non-trivial as the ID3v2 headers are somewhat complicated.  One of the things that I found rather mystifying at first is the use of [[http://en.wikipedia.org/wiki/Synchsafe|Synchsafe Integers]].  The Wikipedia page linked to in the previous sentence actually has a simple algorithm in C to "unsynchsafe" an integer.  Nowhere, that I could find, was the reverse algorithm so I decided to publish mine here.  The example on Wikipedia is in C, but I've done both of the following examples in Python (you should be able to easily adapt this back to C, or any other lang. for that matter).+Recently, I was looking at putting together a simple, easy to use, Python library for reading and writing ID3v2 tags in mp3 files.  This is rather non-trivial as the ID3v2 headers are somewhat complicated.  One of the things that I found rather mystifying at first is the use of [[wp>Synchsafe|Synchsafe Integers]].  The Wikipedia page linked to in the previous sentence actually has a simple algorithm in C to "unsynchsafe" an integer.  Nowhere, that I could find, was the reverse algorithm so I decided to publish mine here.  The example on Wikipedia is in C, but I've done both of the following examples in Python (you should be able to easily adapt this back to C, or any other lang. for that matter).
  
 ===== Unsynchsafe ===== ===== Unsynchsafe =====
misc/synchsafe.1254159124.txt.gz · Last modified: 2009/09/28 17:32 by crustymonkey