这个很简单,
首先你可以要分析wave的格式,看他的采样比特,和通道;
如:16比特,单声道,那么两个字节代表一个音频数据,也是我们要画的
画法如下:(这是我的一个程序中显示wave的一段程序)
procedure TPcmEdit.PrintPcm(ACanvas:TCanvas;AWidth,Aheight:integer);
var
i,j,ZZ,iNow,ibegin
:integer;
iOldPos:Longint;
begin
with ACanvasdo
begin
//画矩形框
Brush.Color:=clBlack;
FillRect(RECT(0,0,AWidth,Aheight));
MoveTo(0,Aheight div 2);
Pen.Color:=clLime ;
LineTo(AWidth,Aheight div 2);
//初始化读数据状态
iOldPos:=FMemPcmFile.Position;
GoTobegin
;
FBuffbegin
:=0;
FBuffSize:=0;
MoveTo(0,Aheight div 2);
ZZ:=GetFileSize div AWidth;
iNow:=0;
while FBuffbegin
+FBuffSize<GetFileSizedo
begin
ibegin
:=iNow;
ReadBuffer(Min(GetFileSize-FMemPcmFile.Position,MaxBuffSize));
for i:=0 to AWidth-1do
begin
if i*zz<=FBuffSize then
inc(iNow)
else
Break;
for j:=0 to ZZ-1do
begin
if i*ZZ+j<=FBuffSize then
LineTo(ibegin
+i,GetPcmToWavByte(FPcmBuffer[i*ZZ+j+1]))
else
Break;
end;
end;
end;
GoToPos(iOldPos);//还原流的状态
end;
end;