Please...i ask helping from..all ....
i want to write sound value from dinamic array,,to save in .wav type...
i tried to write header .wav and result it i think is true...
but i still confused how way to write sound value..
i put sound value in array, name is hasil_wav,,,
i take example i want write for wav 16 bit mono in DELPHI 7.0
please help me....

my listing like this...

procedure TForm1.Button4Click(Sender: TObject);
var
// chan, frq, vl : DWORD; Tmp: Integer;
// buf : array [0..10000] of BYTE;
// BytesRead : integer;
temp : string;
i : longint;
RecStream : TFileStream;
nChannels : Word; // number of channels (i.e. mono, stereo, etc.)
nSamplesPerSec : DWORD; // sample rate
nAvgBytesPerSec : DWORD; // transfer rata-rata per detik
nBlockAlign : Word;
wBitsPerSample : Word; // number of bits per sample of mono data
// FileName : String;
begin
nChannels := 1;
wBitsPerSample := 16;
nBlockAlign := nChannels * wBitsPerSample div 8;
//BASS_ChannelGetAttributes(chan, frq, vl, Tmp);
nSamplesPerSec := 22050;
nAvgBytesPerSec := nSamplesPerSec * nBlockAlign;

// FileName := ExtractFileName(SourceFileName);
// FileName := Copy(FileName, 1, Length(FileName) - Length(ExtractFileExt(FileName)));
// RecStream := TFileStream.Create(OutPath + FileName + '.wav', fmCreate);
RecStream := TFileStream.Create('Cinta.wav',fmCreate);

// Write header portion of wave file
temp := 'RIFF';
RecStream.write(temp[1], length(temp));
temp := #0#0#0#0;
RecStream.write(temp[1], length(temp)); // File size: to be updated
temp := 'WAVE';
RecStream.write(temp[1], length(temp));
temp := 'fmt ';
RecStream.write(temp[1], length(temp));
temp := #$10#0#0#0;
RecStream.write(temp[1], length(temp)); // Fixed
temp := #1#0;
RecStream.write(temp[1], length(temp)); // PCM format
if nChannels = 1 then
temp := #1#0
else
temp := #2#0;
RecStream.write(temp[1], length(temp));
RecStream.write(nSamplesPerSec, 2);
temp := #0#0;
RecStream.write(temp[1], length(temp)); // SampleRate is given as dWord
RecStream.write(nAvgBytesPerSec, 4);
RecStream.write(nBlockAlign, 2);
RecStream.write(wBitsPerSample, 2);
temp := 'data';
RecStream.write(temp[1],length(temp));
temp := #0#0#0#0;
RecStream.write(temp[1],length(temp)); // Data size: to be updated
// RecStream.Write(buf, SizeOf(Buf));

{complete WAV header
Rewrite some fields of header }
i := RecStream.Size - 8; // size of file
RecStream.Position := 4;
RecStream.write(i, 4);
i := i - $24; // size of data
RecStream.Position := 40;
RecStream.write(i, 4);
RecStream.Free;
end;

PLease...
I very need help from your all...
to solve my problem....

This article has been dead for over six months. Start a new discussion instead.