The Protracker Sample Compression/Decompression Algorithm


Original Documentation

--- Protracker sample compression / decompression

		  Get the number of sample bytes to process.
		  Call this SamplesLeft.

		  Set Delta counter to 0.

		  DO
			Get a byte from the buffer.
			Store the byte in Temp.
			Subtract the Delta counter from the byte.
			Store it in the buffer.
			Move the Temp byte into the Delta Counter
			Decrement SamplesLeft.
		  WHILE(SamplesLeft <> 0)

		  The technique for conversion back to the raw data is:

		  Get the number of sample bytes to process.
		  Call this SamplesLeft.

		  Set Delta counter to 0.

		  DO
			Get a byte from the buffer.
			Add onto the byte the Delta Counter.
			Store the byte in Delta Counter.
			Store the byte in Temp.
			Decrement SamplesLeft.
		  WHILE(SamplesLeft <> 0)

This information is from Corion.net and is used with permission.

More Resources