I recommend to use dynamic arrays.
Code:
SetLength(Samples[j].SampleData, Samples[j].SampleLength); // Instead of GetMem
if Samples[j].SampleLength > 0 then BlockRead(FileStream, Samples[j].SampleData[0], Samples[j].SampleLength * SizeOf(Samples[j].SampleData[0]));
where Samples[j].SampleData is declared like this:
Code:
SampleData: array of Byte; // or whatever you want instead of byte
Of course you can manipulate with the array data as you wish.