Solved

sound play in delphi

Posted on 2004-03-24
7
211 Views
Last Modified: 2010-04-05
Dear all

I want to record the sound and play it from the recorded  one.
as like in window ...


If anybody have  the sample exe would be highly appreciated.
0
Comment
Question by:ravisiva
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10668641
You could use the TMedia Player (System Tab of component pallette) .

If you dont want to have it viewable, set its visible property = False;

Shane
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10668695
The Only issue with TMediaPlayer is,  

to do what you want - you have to give the TMediaPlayeran existing WAV file to start with.
That's not so bad though.  You can fake it by giving it a temp file with just enough header info to
get you started.  Here's what I've done:

procedure TMainForm.NewAudio1Click(Sender: TObject);
var NewWave: TextFile;
begin
  MediaPlayer1.Close;
  IF FileExists(StrPas(TempFileName)) then
   DeleteFile(StrPas(TempFileName));
   GetTempFilename('C','RRA',0,TempFileName);      
  {This creates a file in my Windows TEMP directory called
   RRAxxxx.TMP...  TempFileName is declared globally as a PChar}
   AssignFile(NewWave,StrPas(TempFileName));
   Rewrite(NewWave);
{This next line contains the header info with NO DATA for an 8bit
22khz mono sample.  I'm sure the file formats for others can be easily
obtained from the net or just by examining a valid file with a hex
editor or something.}
     WriteLn(NewWave,'RIFF'+#$34+#$00+#$00+#$00+'WAVEfmt '+
     #$12+#$00+#$00+#$00+#$01+#$00+#$01+#$00+
     #$22+#$56+#$00+#$00+#$22+#$56+#$00+#$00+
     #$01+#$00+#$08+#$00+#$28+#$00+'fact'+
     #$04+#$00+#$00+#$00+#$01+#$00+#$00#$00+'data'+
     #$01+#$00+#$00+#$00+#$80+#$00);
     CloseFile(NewWave);
     MediaPlayer1.FileName := StrPas(TempFileName);
     MediaPlayer1.Open;
     ShowMessage('Record mode enabled.  Press record to start.');
end;


Then when you're finished recording, use MediaPlayer1.Filename :=
'whatever.wav' to change the filename, MediaPlayer1.Save to save the
new data to that new filename, then delete the temp file you created
using the same DeleteFile line from above.

It works.

Shane
0
 

Author Comment

by:ravisiva
ID: 10674597
Dear shaneholmes

I start with the existing wav file .
But sound is not recorded

It plays the old sound ( ie default sound in .wav file)

Why?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:ravisiva
ID: 10674630
Dear shaneholmes

If we press record button the sound files are
store in a defaultfile or

we shoule explicitly  give ...save... command
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10676339
It is stored int he Default file (Fake)

Shane
0
 

Author Comment

by:ravisiva
ID: 10685772
Dear shaneholmes

If we reorded   sound   in the default file
it can overwrite the default sound?
0
 
LVL 11

Accepted Solution

by:
shaneholmes earned 20 total points
ID: 10686792
Yes!

Shane
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month5 days, 2 hours left to enroll

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question