Board index » delphi » Wav file format
George Kuasha
![]() Delphi Developer |
George Kuasha
![]() Delphi Developer |
Wav file format2005-02-24 02:18:38 AM delphi139 I get the following error when trying to play a .wav file "no wave device that can play files in current format". Other wav files play fine. Are there differences in wav formats and what type of "devices" are needed to play them? |
Heinrich Wolf
![]() Delphi Developer |
2005-02-24 03:02:59 AM
Re:Wav file format
I am just guessing:
I know the basic structure of the *.wav header. The header allows *.wav to have more then 2 channels (left and right). I never found a *.wav file with more than 2 channels. But I wonder, what media player will do with such a file on a familiar sound device, which supplies only 2 channels. |
Jon Lennart Aasenden
![]() Delphi Developer |
2005-02-26 05:40:55 PM
Re:Wav file format
There are two types: Raw and compressed.
But 99.9% of aøø players support both types, especially if they call the winapi or DirectShow to do the playing. But more importantly than compression -is the wave sample format, and i get the feeling this is your problem. I have a an expensive 24bit sound card for harddisk recording, and it supports sampling at a wild range of frequencies. If your card dont support the frequency the samples were recorded in - then that would be the error message you get if you tried to play one of my wavs. Most recordings exist in the 40 -/+ hz. area, but there are exceptions to this rule. Does it play in winamp or the standard windows player? Try getting a wave-file editor and check out the samplerate and compression. Kind regards "George Kuasha" <XXXX@XXXXX.COM>writes QuoteI get the following error when trying to play a .wav file "no wave device |
Heinrich Wolf
![]() Delphi Developer |
2005-02-27 01:56:10 PM
Re:Wav file format
Check the header's contents of the wave file.
Here is the basic structure. I do not know about compressions. Const WavePCM = 1; type {$IFDEF VER80} LongWord = LongInt; {$ENDIF} {$IFDEF VER100} LongWord = LongInt; {$ENDIF} tWaveHeader = packed Record RiffID : Array[0 .. 3] of char; { 'RIFF' } RiffLen : LongWord; { length of following data } WaveID : Array[0 .. 3] of char; { 'WAVE' } FmtID : Array[0 .. 3] of char; { 'fmt ' } FmtLen : LongWord; { length of tFormat } end; tWaveFormat = packed Record case Tag : Word of WavePCM: ( PCMChannels : Word; PCMSamplesPerSec : Word; PCMAvgBytesPerSec : Word; PCMBlockAlign : Word; PCMUnKnown1 : Word; PCMUnKnown2 : Word; PCMBitsPerSample : Word; PCMUnKnown3 : Array[1 .. 20] of Byte; { variable length } ); 2: ( { and all other Tags } OtherChannels : Word; OtherSamplesPerSec : Word; OtherAvgBytesPerSec : Word; OtherBlockAlign : Word; OtherUnKnown : Array[1 .. 20] of Byte; { variable length } ); end; tWaveData = packed Record ID : Array[0 .. 3] of char; { 'data' } Len : LongWord; { length of following data } end; pWaveData = ^tWaveData; tWaveBytes = Array[0 .. 0] of ShortInt; tWaveWords = Array[0 .. 0] of SmallInt; pWaveBytes = ^tWaveBytes; pWaveWords = ^tWaveWords; tWaveFile = Record Header : tWaveHeader; Format : tWaveFormat; { variable length } { Data : tWaveData; left sample right sample left sample right sample ... } end; pWaveFile = ^tWaveFile; |