Solved

sound play in delphi

Posted on 2004-03-24
7
209 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
Industry Leaders: 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Downloading email attachments 2 84
Wincontrol not (correctly) drawn 15 47
Browsing a TTreeView in Delphi 5 32
Delphi TListView and TEdit (Select item and input into TEdit) 10 44
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

763 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