Link to home
Start Free TrialLog in
Avatar of tyfing
tyfing

asked on

Play Mp3

how can i make my programme play .wav and .mp3s ? Points easily negotiable.
Avatar of amebikes
amebikes

Hello,
try this:
- in your uses clause add mmsystem
- execute this line:
 PlaySound(Pchar('filename.wav'), 0,  SND_FILENAME + SND_ASYNC);

it works with .wav files, maybe also with .mp3 ??
Hello,
try this:
- in your uses clause add mmsystem
- execute this line:
 PlaySound(Pchar('filename.wav'), 0,  SND_FILENAME + SND_ASYNC);

it works with .wav files, maybe also with .mp3 ??
Drop MediaPlayer component:

MediaPlayer1.FileName:= 'Your filename.wav or .mp3';
MediaPlayer1.Open;
MediaPlayer1.Play;

In case of opening MP3 I think that you whould have the libraries that run MP3, this libraries will be installed in Windows if you install MP3 player such as Windows media player.

Motaz
To play a .WAV just do as amebikes said.
To play an .MP3 have a look at the following sites:

http://www.undu.com/Articles/991125a.html
http://www.xaudio.com/

Cheers,

Alan
Hi...
To play an mp3 do this....

New project:
drop a TMediaplayer, a button and an OpenDialog comp.

add this code in the button Begin / End block

//USES MMSystem//
----------------------------------------
  OpenDialog1.DefaultExt := 'mp3';
  OpenDialog1.Filename := '*.mp3';
  if OpenDialog1.Execute then
  begin
    MediaPlayer1.Filename := OpenDialog1.Filename;
    MediaPlayer1.Open;
    Mediaplayer1.play;
  end;
  end;
-----------------------------------------
when you click the button, the OpenDialog box opens,
navigate to an mp3 file on your system and click OK,
play it!
easy as that. Have fun!
tongalite

your entire Unit should look like this:

------------------------------------------
unit Unit1;

interface

uses
  Windows, Messages,MMSystem, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, MPlayer;

type
  TForm1 = class(TForm)
    MediaPlayer1: TMediaPlayer;
    Button1: TButton;
    OpenDialog1: TOpenDialog;
    procedure Button1Click(Sender: TObject);

  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);

begin
  OpenDialog1.DefaultExt := 'mp3';
  OpenDialog1.Filename := '*.mp3';
  if OpenDialog1.Execute then
  begin
    MediaPlayer1.Filename := OpenDialog1.Filename;
    MediaPlayer1.Open;
    Mediaplayer1.play;
  end;
  end;


end.
------------------------------------------------
I can give you a working Example for playing mp3's and wav's without TMediaPlayer and with full source code. It's a small example of using nothing from within windows like codecs or system dll's. You are independent :-)

Give me your email address an I will send it to you (hope you will give me the points *g).

Bye, TDS.
TDS, sounds interesting. Can you please send it to me too. Thanks! delfreak@thedoghousemail.com
Hi,
I too am interested in this....
Could you please mail me a copy?
tongalite@ic24.net
TIA
T.
hi i'm also intrested in playing mp3's without tmediaplayer

email me r.nash@ntlworld.com

cheers
classic_gaming
Okay, I will send you a link where you can download the code from my homepage. I will pack it till tommorow because I'm tired now :-)

Bye, TDS.
Here is the link. The source code for the DLL is written in C/C++ but can easy change the code (I hope)

http://www.tds-net.de/experts/mp3.zip

All files should be included, if not mail me:
webmaster@tds-net.de

If you grade this question, please give me a "A" :-)

Bye, TDS.
Avatar of tyfing

ASKER

i'm very confused about .dlls, how do i use them ?
Hi tyfing
You are getting some mileage out of this question... I like your style ;-)
t.
Hmm, you don't have to think about dll's. The only thing is that you have to register all needed component and that the mpegdll.dll is in the directory you'll start your program.

Bye, TDS.
ASKER CERTIFIED SOLUTION
Avatar of Mathias
Mathias
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You have 12 open questions, some of which date back to the year 2000.  ADMINISTRATION WILL BE CONTACTING YOU SHORTLY.  Moderators Computer101 or Netminder will return to finalize these if they are still open in 14 days.  Experts, please post closing recommendations before that time.

Below are your open questions as of today.  Questions which have been inactive for 21 days or longer are considered to be abandoned and for those, your options are:
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you, but may help others. You must tell the participants why you wish to do this, and allow for Expert response.  This choice will include a refund to you, and will move this question to our PAQ (Previously Asked Question) database.  If you found information outside this question thread, please add it.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question (if it has no potential value for others).
   --> Post comments for expert of your intention to delete and why
   --> YOU CANNOT DELETE A QUESTION with comments; special handling by a Moderator is required.

For special handling needs, please post a zero point question in the link below and include the URL (question QID/link) that it regards with details.
https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click this link for Help Desk, Guidelines/Member Agreement and the Question/Answer process.  https://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

Click you Member Profile to view your question history and please keep them updated. If you are a KnowledgePro user, use the Power Search option to find them.  

Questions which are LOCKED with a Proposed Answer but do not help you, should be rejected with comments added.  When you grade the question less than an A, please comment as to why.  This helps all involved, as well as others who may access this item in the future.  PLEASE DO NOT AWARD POINTS TO ME.

To view your open questions, please click the following link(s) and keep them all current with updates.
https://www.experts-exchange.com/questions/Q.11700099.html
https://www.experts-exchange.com/questions/Q.11762279.html
https://www.experts-exchange.com/questions/Q.11872738.html
https://www.experts-exchange.com/questions/Q.20080036.html
https://www.experts-exchange.com/questions/Q.20106355.html
https://www.experts-exchange.com/questions/Q.20108005.html
https://www.experts-exchange.com/questions/Q.11610182.html
https://www.experts-exchange.com/questions/Q.20239389.html
https://www.experts-exchange.com/questions/Q.20244108.html

To view your locked questions, please click the following link(s) and evaluate the proposed answer.
https://www.experts-exchange.com/questions/Q.20108209.html
https://www.experts-exchange.com/questions/Q.20267321.html
https://www.experts-exchange.com/questions/Q.20276914.html

*****  E X P E R T S    P L E A S E  ******  Leave your closing recommendations.
If you are interested in the cleanup effort, please click this link
https://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643 
POINTS FOR EXPERTS awaiting comments are listed in the link below
https://www.experts-exchange.com/commspt/Q.20277028.html
 
Moderators will finalize this question if in @14 days Asker has not responded.  This will be moved to the PAQ (Previously Asked Questions) at zero points, deleted or awarded.
 
Thanks everyone.
Moondancer
Moderator @ Experts Exchange
Avatar of tyfing

ASKER

ok