Board index » delphi » problem playing .WAV files in a Delphi program running under win 3.11

problem playing .WAV files in a Delphi program running under win 3.11

I've got a problem implementing .WAV files in my Delphi program under win
3.11.

I'm trying to make the .WAV file audible by selecting them in a file
listbox and clicking on a button to play them.

I can't get this to work properly...
Does anybody have any experience with this?

If possible I'd like to make the wave files visible in a plot inside a
delphi program...

Send replies via email to Roel.Vankrieki...@ping.be

 

Re:problem playing .WAV files in a Delphi program running under win 3.11


Quote
Roel.Vankrieki...@ping.be (Roel Vankriekinge) wrote:

>I've got a problem implementing .WAV files in my Delphi program under win
>3.11.

>I'm trying to make the .WAV file audible by selecting them in a file
>listbox and clicking on a button to play them.

        You can play a WAV file just by passing its name as the first
parameter to sndPlaySound. See mmsystem.hlp for details on the second
parameter. (And note you need to uses MMSYSTEM.)

Quote
>If possible I'd like to make the wave files visible in a plot inside a
>delphi program...

        I'd like to do that too, along with a few similar things. We
need to know the *.wav format, leading to the question I was about to post:

        Does anybody know where to find a description of the WAV file format?

--
David Ullrich
Don't you guys find it tedious typing the same thing
after your signature each time you post something?
I know I do, but when in Rome...

Re:problem playing .WAV files in a Delphi program running under win 3.11


This is pretty simple.  You need a media player component somewhere on
your form.  You can make it invisible so it doesn't look so ugly.
Anyways, on the DBlClick event handler of the File List box do
something like this:

begin
   MediaPlayer.Filename := FileListBox.Filename;
  MediaPlayer.Play;
end

That's about it.  Hope that works and helps.  Pretty simple to play
CDAudio, Wav, and other standard windows format with the TMediaPlayer
component.

You could also make calls to mmsystem.dll.

Good luck
Benson
ben...@primenet.com

On 9 May 1996 20:24:40 GMT, David Ullrich <ullr...@math.okstate.edu>
wrote:

Quote
>Roel.Vankrieki...@ping.be (Roel Vankriekinge) wrote:

>>I've got a problem implementing .WAV files in my Delphi program under win
>>3.11.

>>I'm trying to make the .WAV file audible by selecting them in a file
>>listbox and clicking on a button to play them.

>    You can play a WAV file just by passing its name as the first
>parameter to sndPlaySound. See mmsystem.hlp for details on the second
>parameter. (And note you need to uses MMSYSTEM.)

>>If possible I'd like to make the wave files visible in a plot inside a
>>delphi program...

>    I'd like to do that too, along with a few similar things. We
>need to know the *.wav format, leading to the question I was about to post:

>    Does anybody know where to find a description of the WAV file format?

>--
>David Ullrich
>Don't you guys find it tedious typing the same thing
>after your signature each time you post something?
>I know I do, but when in Rome...

Re:problem playing .WAV files in a Delphi program running under win 3.11


        That's great if you want to play a wav file - I'd like to write one
or two. You don't happen to know where I can find a description of the wav
file format, do you?

--
David Ullrich
Don't you guys find it tedious typing the same thing
after your signature each time you post something?
I know I do, but when in Rome...

Re:problem playing .WAV files in a Delphi program running under win 3.11


On 9 May 1996, David Ullrich wrote:

Quote
>    Does anybody know where to find a description of the WAV file format?

A good place to start is the audio formats FAQ. This can be had by ftp from
ftp.cwi.nl pub/audio. There are two parts. I seem to remember that the
second has some information about RIFF (.wav) files and gives at least
two sources for fuller descriptions.

Paul

---------------------------------------------------
Paul Sergeant
School of Psychology
University of St Andrews
Scotland
KY16 9JU
---------------------------------------------------

Re:problem playing .WAV files in a Delphi program running under win 3.11


Quote
David Ullrich wrote:

>         That's great if you want to play a wav file - I'd like to write one
> or two. You don't happen to know where I can find a description of the wav
> file format, do you?

> --
> David Ullrich

The structures below are great if you want to CREATE a .wav file. Look in a
wav file and map them on the twavhead and I think you'll get it. The wave
format does, however, allow more chunks of data than the audio, so it's not
safe for READING wav files.

Hope it helps...

type tarrchar4=array[0..3]of char;
     tlongnullstring=array[0..32768]of char;
type triff=record
         id:tarrchar4;
         size:longint;
     end;
     tform=record
         id1,id2:tarrchar4;
         size:longint;
     end;
     ttag=record
         formattag:word;
         nchans:word;
         sampfreq:longint;
         bytespersec:longint;
         blockalign:word;
         bitspersample:word;
     end;
     tdata=record
         id:tarrchar4;
         size:longint;
     end;
type twavhead=record
         riff:triff;
         form:tform;
         tag :ttag;
         data:tdata;
     end;

--
Svante Granqvist        Speech, Music and Hearing
Phone +46-8-790 7561    Box 700 14
Fax   +46-8-790 7854    S-100 44 Stockholm
sva...@speech.kth.se    http://www.speech.kth.se/~svante

Re:problem playing .WAV files in a Delphi program running under win 3.11


Hello David!

On 09 May 96 at 21:24, ullr...@math.okstate.edu wrote to All:

 uoe> From: David Ullrich <ullr...@math.okstate.edu>

 >> If possible I'd like to make the wave files visible in a plot inside a
 >> delphi program...

 uoe>     I'd like to do that too, along with a few similar things. We
 uoe> need to know the *.wav format, leading to the question I was about to
 uoe> post:

 uoe>     Does anybody know where to find a description of the WAV file
format?

Well, I am far behind in reading my mails, but I followed the answers to this
one, and nobody seemed to answer it.
I suggest you look in the SWAG archives. I checked, there is the wav-header (a
couple of times even) simple players etc. All in source.
I don't know where you live, so I cannot try and find a SWAG-support site close
to you.

For those who read this also:
There are a lot of useful things in the SWAG-files. It's full of pascal-sources
and (since last year I thought) also Delphi.

In between the $$$ and $$$ you find some info I saved some time ago.
Let me know if it helped!

Much regards,
Tineke.

$$$$$$$$$$$$$$$$$$$$

? [7] C.L.P.DELPHI.MISC (2:280/206.23) ????????????????????? C.L.P.DELPHI.MISC
?
 Msg  : 49 of 197
 From : rwalt...@ix.netcom.com              2:280/206.6     06 Feb 96
13:10:00
 To   : All
 Subj : SWAG ??
???????????????????????????????????????????????????????????????????????????????
?

Quote
pr...@BIX.com wrote:
>>Mats Andersson wrote:
>>>Have seen some references to something called a SWAG-file for
>>>Delphi.I know a FAQ when I step on it but could some kind soul
>>>enlight me as to what a SWAG is.

>>>Mats
>>Scientific Wild-Ass Guess  :-\

SWAG also has a web address and ftp site at:

SWAG WWW Address
http://users.aol.com/SWAGWWW/swag.html

SWAG FTP
ftp://users.aol.com/SWAGWWW/files

Most of this is straight pascal stuff, but some interesting usable
example code to point you in the right direction on things Delphi
can't code for you. Some Delphi stuff in newest update.
                           Hope that helps,
                           Ron Walter

Other Threads