How do I put sound into my program?

How do I put sound into my program, preferably mp3. I want to execute mp3's or any sound type file and be able to somtimes place other sound overtop of existing sound and somtimes, cut it out to be replaced with new. I'm not worried about dual yet, if I could just be told on how to exe a sound file inside my program that would get me started fine.


  • I dont now if this works in .net, but it does in vb6:

    Add a control in your toolbox (RMB at the toolbox, customize).
    Add the control ''windows media player''.

    Enter the following lines in your program:

    mediaplayer1.filename = "c:samplefoldermy.mp3" 'IF it does not starts playing automaticly...

    That should be it. Just make the player invisible, and you can add any sound...

  • Did Jeroen's answer make you happy or are you looking for the algorithm of [b]decoding[/b] a mp3-file?

    Kind Regards
    (+46/0) 708-70 73 92

  • ::
    : His answer may allow me to do some things on my site easier but I would really appreciate learning the algorithm of [b]decoding[/b] a mp3-file. That would make things flow much better for the app im composing now. Please send code or link to example, to both peepz, thanx alot but this method is more of what I was looking for, although using win media player will come in very useful too.
  • :thank you for your help... this will come in very handy.... ALthough I'm look more into placing my own sound in the app for instant a game type application.... although, I didn't know how to use this procedure either and will work well with some of my web apps.... thankk you.
  • : I would really appreciate learning the algorithm of [b]decoding[/b] a mp3-file.

    And so would i. Actually i've done some things with it but i don't think i sould give you any tips on that yet. In a week or two, maybe :-).

    Kind Regards
    (+46/0) 708-70 73 92

  • Ok, I'll do anything now... please help me some more.... I can't figure out how to get the windows media player to my application and it appears this is gonna be the best way for me to do it... I have no idea how to do this... I havn't progressed very far in my skills. COuld you please just send me a bit of code with the whole routine possibly even somthing you've used before, i will interpret it and use for my own app. I tried to use your idea but i think I'm edoing somthing all wrong.

  • I have figured out how to add the media player... incase someone else is reading this to know how here are the steps I used. In your toolbox right click/ click customize toolbox. A tab box should appear with the COM components tab selected, scroll down and just choose which you want. Windows Media player will be at the bottom. I had a problem with one so I added both. Then just goto windows form tab/ select windows media player from list and paste it anywhere on the form.
    Ny new question is, how do I make an mp3 part of my project. I ask because I want to make this app an install for others. How do I have the mp3 there, installed with the project? example... If you placed my program on your comp, you wouldn't hear the song I wanted and would develop error, how would I have that mp3 added so when you installed it would be in the directory of installation with application?

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!