Jak narysowac wykres obwiedni pobierajc dane z pliku muzycznego wav.
Pobieram takie take dane z pliku. Brakuje mi tylko sposobu na narysowanie wykresu OBWIEDNI za pomocą TImage.
var p:tfilestream;
dialog:topendialog;
zz,z,i,j,ll,pp:integer;
g,h:integer;
dane:record
ChunkID :array[0..3] of char;
ChunkSize :integer;
Format :array[0..3] of char;
Subchunk1ID :array[0..3] of char;
Subchunk1Size :integer;
AudioFormat :integer;
NumChannels :integer;
SampleRate :integer;
ByteRate :integer;
BlockAlign :integer;
BitsPerSample :integer;
Subchunk2ID :array[0..3] of char;
Subchunk2Size :integer;
end;
begin
dialog:=topendialog.Create(form1);
dialog.Filter:='wav';
if dialog.Execute then
begin
p:=tfilestream.Create(dialog.FileName,fmopenread);
p.Read(dane.ChunkID,4);
p.Read(dane.ChunkSize,4);
p.Read(dane.Format,4);
p.Read(dane.SubChunk1ID,4);
p.Read(dane.SubChunk1Size,4);
p.Read(dane.AudioFormat,2);
p.Read(dane.NumChannels,2);
p.Read(dane.Samplerate,4);
p.Read(dane.ByteRate,4);
p.Read(dane.BlockAlign,2);
p.Read(dane.BitsPerSample,2);
p.Read(dane.Subchunk2ID,4);
p.Read(dane.Subchunk2Size,4);
zz:=dane.Subchunk2Size;
z:=dane.BlockAlign;
case dane.NumChannels of
1: begin
for i:=0 to ((zz div z)) do
begin
p.Read(dane.lewy,z);
p.Seek(z,sofromcurrent);
end;
end;
2: begin
for i:=0 to ((zz div z)) do
begin
p.Read(dane.lewy,(z div 2));
p.Read(dane.prawy,(z div 2));
p.Seek(z,sofromcurrent);
end;
end;
end;
p.Free;
end;