This is off of the top of my head and without an IDE to test in, but I think I got it close. This is based off of the original source WILL posted.[pascal]// This routine doesn't allocate or check memory boundries, thats left up to you
procedure DecodeBlock(SrcPtr, DstPtr : Pointer; Length : SizeInt; InitialVal : ShortInt = 0);
var
Start : Pointer;
old,
worker : ShortInt;
begin
old := InitialVal;
Start := SrcPtr;
while ((SrcPtr-Start)<Length) do
begin
// First get a value from the source pointer
worker := PShortInt(SrcPtr)^;
// Now perform your math on the worker
worker := worker + old;
// Reset the old value for the next itteration
old := worker;
// Write out the new value
DstPtr^ := worker;
// Move forward
inc(SrcPtr, SizeOf(worker));
inc(DstPtr, SizeOf(Worker));
end;
end;

procedure LoadSamples(Instrument : TInstrumentType; NumberOfSamples : SizeInt; FileStream : TFileStream);
var
i : Integer;
begin
for i := NumberOfSamples - Instrument.NumOfSamples to NumberOfSamples - 1 do
begin
// Get a worker block the size of the sample data
// NOTE : DON'T FORGET TO FREE IT LATER WHEN YOU FREE INSTRUMENT
GetMem(Samples[i].SampleData, Samples[i].SampleLength);
// Load the file data from the file
FileStream.ReadBuffer(Samples[i].SampleData^, Samples[i].SampleLength);
// Decode the memory
DecodeBlock(Samples[i].SampleData^, Samples[i].SampleData^, Samples[i].SampleLength);
end;
end;[/pascal]