Two things first:
1) This is
not a spectrum. It is the waveform, which is the time-amplitude diagram of a sound. A spectrum would be a time-frequency diagram.
2) I do not understand so far, why your arrays "ArrWaveX" are two-dimensional. The following piece actually shows that it shouldn't be:
Delphi-Quellcode:
for i := 0 to WvWig do
begin
ArrWaveL[j][WvWig - i] := ArrWaveL[j][WvWig - i - 1];
ArrWaveR[j][WvWig - i] := ArrWaveR[j][WvWig - i - 1];
end;
Here, you set all values of all dimensions (apparently "WvWig" many, where ever that value comes from) the same as their first. Why? You only need that first value. You also go ahead and paint all the dimensions, which could cost you a lot of performance, but does nothing to the output.
But your main issue seems not to be included in the code you have shown. Since you do properly start from 0 everywhere, it appears that the original waveform buffers ("wavebufX") were already filled only in their last half. It's a bit hard to tell, because a number of global variables come into play here, which are not explained anywhere.
More importantly: You seem to not initialize your arrays "ArrWaveX" anywhere. It's a small miracle this doesn't blow up at runtime, and might even be part of the problem. You even
access a negative index in the snippet above, which also might cause you your troubles. I would try to fix these first, and see what the result is.
In the end, your waveform doesn't look bad at all. It's just that the first half seems to be missing, and of course it's a waveform. Not a spectrum.
"When one person suffers from a delusion, it is called insanity. When a million people suffer from a delusion, it is called religion." (Richard Dawkins)