The Wave Audio Package v1.90 has been released. This update resolves the compatibility issues of the component with the newer versions of Delphi up to Delphi XE3.
The Wave Audio Package v1.90 has been released. This update resolves the compatibility issues of the component with the newer versions of Delphi up to Delphi XE3.
ok thinks!
Hello,
I’m trying this really cool Wave Audio Package and I think there is an error in writing Wave Header with the TStockAudioRecorder.
RIFF and Fmt are good but “data” contains #0 characters and WaveSize si wrong.
Jerome.
Could you please use the forum to post a sample code or at least instructions to reproduce the problem?
Hello,
Thank you so much for your response.
I get that with my code and just with the sample code “SndRcrdr” include in the folder Demo\Sound Recorder\. I record a short wave in PCM 44100 16Bits Mono and read the header with my woftware (or an other).
I get something like this in the Wave Header :
– RIFF : (‘R’,’I’,’F’,’F’),133542,(‘W’,’A’,’V,’E’) -> OK
– Fmt : (‘f’,’m’,’t’,”),16,1,1,44100,88200,2,16 -> OK
– Data : ((#0,#0,’d’,’a’),159408500 -> WRONG ‘data’ and WRONG file length
It should be ((‘d’,’a’,’t’,’a’) with a file length like 100000 and not like 100000000
You didn’t tell which version of Delphi.
By the way, the package is not compatible with 64bit Delphi.
I’m on Delphi 2006 but I think the problem was my fault, reading DATA.size instead of RIFF.Size. I can now get informations I need when reading Wave Header.
I’m not an expert on waves so I don’t really know if there is really a problem… I use this code to read Waves generated by your component and the “problem” was on WAVE.Data.FileLength (replaced by WAVE.RIFF.FileLength:
//****************************************
THeaderRIFF = Packed Record
ID : Array[1..4]Of Char;
FileLength: Cardinal;
Format: Array[1..4]Of Char;
end;
THeaderFormat = Packed Record
ID : Array[1..4]Of Char;
FileLength: Cardinal;
Format: WORD;
Mode : WORD;
SRate : Cardinal;
BRate : Cardinal; (SRate * Mode * BPS/8)
Align : WORD;
BPS : WORD; //Bits Per Sample
end;
THeaderData = Packed Record
ID : Array[1..4]Of Char;
FileLength: Cardinal;
end;
TWAVE = Packed Record
RIFF: THeaderRIFF;
Fmt : THeaderFormat;
Data: THeaderData;
end;
//**********************************************************
procedure TForm1.GetInfos(Fichier: String);
var
Stream: TFileStream;
tmp : String;
const
Mode: Array[1..2]Of String = (‘Mono’,’Stéréo’);
begin
Stream := TFileStream.Create(Fichier, fmOpenRead);
Try
Stream.Read(WAVE, 44);
If (WAVE.RIFF.ID ‘RIFF’) or (WAVE.RIFF.Format ‘WAVE’) or
(WAVE.Fmt .ID ‘fmt ‘) or (WAVE.Fmt.Format 1) then
Raise exception.Create(‘not valid PCM’);
lblFmt.Caption := ‘WAVE PCM’;
lblFreq.Caption := IntToStr(WAVE.Fmt.SRate) + ‘ Hz’;
lblMode.Caption := Mode[WAVE.Fmt.Mode];
lblBits.Caption := IntToStr(WAVE.Fmt.BPS) + ‘ bits’;
lblTaille.Caption := FloatToStrF(WAVE.Data.FileLength / 1024, ffGeneral, 3, 4) + ‘ Ko’;
lblDuration .Caption := FloatToStrF(WAVE.Data.FileLength / WAVE.Fmt.BRate, ffGeneral, 3, 4);
finally
Stream.Free;
end;
end;
Sorry again, and Thank you 🙂
I’m glad you found the root of problem.