Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

How To Add Music To Vb App

Ok i wnated to do something really simple.

I wanted to create a form, then when you click a button called "play me" it plays a .mp3 file.

it dosent matter to how i pick the file, for now i will hard code the path to it in the code, but just needed some help!


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Repeat Music And Pause Music
he dude's i want to repeat music with a click on a button i don't know the option i also want to know how to use the pause option when i use it and press play or something like that it starts all over again so please help me with this problem

Music Help
Hello...I'm new at Visual Basic and I need to know how to add music to a form. I would like my song to be played in Windows Media Player, but I am not sure of the coding to do so. Pleae just post a thread that I can just copy and paste. The song I want to play is not a Midi by the way

How can I put music to the level of my game

MOD Music
Okay, it was suggested that I use MOD music files for my game. I don't have a clue about this format. Could some one tell me how to go about using it, or show me a good website about it?

Is there N E way to play music in visual basic without it holding up the program.

RPG Music
i need some SIMPLE code to playing a mid or an mp3 file for my game. it should be background music. also if i could control the volume that would be good but not necessary if it is too complicated. i need the code to be for direct draw if it is possible since that is what i am currently programming in.

[VB6] Music Help
Does anyone know how I would embed an mp3 into an application, so when I compile it, the mp3 is inside the exe, so I can play it (Inside the exe as bg music) without moving the mp3 everywhere the exe goes? Thanks, Brad.

BTW: Im using windows media player component

How To Put Music In
I am a noobie to programming. I have a school project and i do not know how to put music in to visual basic. net 2003. My teacher does not know how to either. Just wondering if anybody knows how??

Add Music
can i add music or sound in VB 6?

How do you add music in the backround while your program is running?

i wanted to know if anyone out there among all you clever people knew of a SIMPLE way to have a mp3 player of sorts in a project.... nothing fancy... just so that i have a list of songs i can select and have playing (looping) in the background. no pause or stop or song length etc...

just select songs and play??

any help would be appreciated

thanks in advance



I've tried a few things but I can't seem to get my program to play music (on load) - I just want it to play a short wav file.

much appreciate any help

is it possable to have music in visual basic?
me and my friend are trying to make a game at school on vb and need some tunes! either midi or mp3 is good.
if visual basic doesn't let you do that, does c++?
we're learning that next year in computer science so it might be best to wait.
any information or advice would be great!

Music In VB
How do I play an mp3 in VB? thanks..

How do I insert a song file on a form?

this has nothing to do with VB, but ill ask anyways.
anyone know of any good apps that'll remove drums, guitar, or bass, from an MP3. I've seen lyric removers before.

VB Music And SFX ?!?!?
Hi guys,

I'm having a little problem with the audio side of a program that I am writing for my little girl. Basically, I have music running and wish to activate a sound when she clicks on a button. When I click on the button, the sound activates but stops the music from running. I am using the following code:

Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_LOOP = &H8
Const SND_NOSTOP = &H10

Dim x as Integer

x = sndPlaySound("mysound.wav", SND_SYNC Or SND_NODEFAULT)

Question- Is there a way of sounding the event without stopping the music.

Also, if it is possible, how would I then terminate the music? (I am looking to bypass the music termination, but will obviously need to stop
the music at some point.)

Thanks guys in advance


Sid Music
Hello all...

Does anyone know how make a SID player in VB. I have no clue where to start, have searched around but no luck.

Sid are 'old' C64 tunes. I'd like to make a small player in VB.

Thanx in advance.


i am writting a game program and as one of my features i want the user to be able to play there own music if they want from the cd-rom how would i code this.

How would i set music to load from a file when a button is pressed and play once then stop?
Thanks -

To play music i used this code =

Private Const SND_APPLICATION = &H80
Private Const SND_ALIAS = &H10000
Private Const SND_ALIAS_ID = &H110000
Private Const SND_ASYNC = &H1
Private Const SND_FILENAME = &H20000
Private Const SND_LOOP = &H8
Private Const SND_MEMORY = &H4
Private Const SND_NODEFAULT = &H2
Private Const SND_NOSTOP = &H10
Private Const SND_NOWAIT = &H2000
Private Const SND_PURGE = &H40
Private Const SND_RESOURCE = &H40004
Private Const SND_SYNC = &H0
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Private Sub Form_Load()
'KPD-Team 2000
PlaySound "C:Documents and SettingsIGOR.KDesktopNew Folder(3)1 Track 1 ", ByVal 0&, SND_FILENAME Or SND_ASYNC
End Sub
And it doesn't play the song. Can someone tell me what i did wrong? I used this code off a tutorial.

i am looking for a good music loop i need it to be able to play it over and over again but also need to be able to tell it which file to play any ideas?

How would I add a midi or mp3 file to a program so once opened it plays? Thanks.

hi how can i make a song play throut the hole program

i think i have to put the code into the moduel

thanx plenty

How can I put music in my program or sounds for the buttons

Music In 6.0
I'm making an RPG type game in VB 6.0 for a class i'm taking. I would like to include music in the background of the game while playing it, but can't figure out how. Any ideas?

Music In VB
how can i play and add a music file to a vb exe (without the app requireing the mp3 file)

hey i'm currently half way through l earning i would like to know this How do u add music to a program???

Yeah, I know it's stupid, but the only thing I miss about QBasic is how you could play little songs... is there a way to do that in VB without actually loading and playing a file?

MCI For Music...
VB Code:
Public Sub Pause()  Call mciSendString("pause MP3Play", 0, 0, 0)End Sub

Well, I don't have a clue about mci.

Will it work on all systems?
Will it play all sounds types?

Any possible problems I might have with it?

Thanks inadvance.

Vba Music
I have an Access2002 database that stores the location of some audio files (mp3 and wav). I was wondering if there is any way to play these files from within Access using vba ?

Where can i get royalty free MIDI music that i can use as background music in my program?

Help With Music??
How do i use music and movie files in visualbasic????
And i need code to format *.bmp file to *jpg file or *.jpg file to *.bmp file.

How do you get an MP3 file to play within VB?

Music Help
what is the code to play an mp3 or wave file in my program,like when a command button is hit?


Is there any function in vb6

which give music without external speakers...

like in case of qbasic eg. music

give full syntax


Music In VB?????????
Yes I have posted this before, but because of computer problems, I did not get to see any of the responses.

Does anybody know how to put and run a Windows Media Player in VB so that it could play a song at the press of a button?

Please help me out by including the best instructions possible, Thank YOU !!!!!!!!!!!!!

Music (Again)
The FAQs Didnt Help At All I Want The Music To Start When The Programs Launches!

Private Sub Form_Load()
                   <------------What Do I Place Here To Play My Wav!?
End Sub

How Can I Set Music In VB For My Program?

Music Box
Hello, I wanted to give myself a project and came up with, I would like to make a music box that playes a midi file. Sounds easy enough right? Does aneyone know where I can get info on somthing like this or how to get started.

How would I go about playing a .mp3, .wav, or .mid in a Visual Basic program?

icq# 64665116
Please rate this post.

Is there an easy way to have a peice of music playing and looping
when the program starts.

And can you then change the music when the user clicks on a button.

Any help much app as i am

What control would I use to play music on my form?
What would the code look like? What type of music file would I use?

Enbeding Music
Sup Peoples,
I have a question, seems to be hard...
How would i "enbed" a music file... Video Games do it all the time.
I know it would make the exe big, but could someone please tell me how i could do it... i'm totally clueless on this
Please help meh out?

Music, Videos Etc
Hi all
How would I use winsock to get any type of video and music files for my media player or do i have to use the inet control?

If i have to use the Inet control please could you give me a general idea on how to use it to get the files.

Music As Resource
When I move from map to map on my RPG, sometimes the music is supposed to change. For instance, when I enter a house, I load a new midi file and play it. But the act of loading the music makes a long pause while moving into the new map.

Is there any way to put a midi file into the resource editor and load it from there? Is that any faster, or does it just store the path to the music itself and still load from the disk?

Not only that, is there a limit to the number of strings you can keep in the resource editor, because I've been using it for all my player/NPC conversations and I would hate to get halfway into making this game and get some kind of limit exceeded error!

How Do I Add Music To My Game
how do i add music to my game.i want to make different sounds in different maps.

How Do I Add Music To My Game
I don't get why mine's not working...I'm using this code here:

(in Module)

Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA"_
(ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal_
uReturnLength As Long, ByVal hwndCallback As Long) As Long

(In form)

Public Sub StartMusic()
Dim AppPath As String, FileName As String

FileName = ""

AppPath = App.Path

If Right$(AppPath, 1) = "" Then AppPath = Left$(AppPath, Len(AppPath) - 1)

AppPath = AppPath & FileName & ".mid"

If InStr(1, AppPath, " ") Then AppPath = """" & AppPath & """"

mciSendString "open " & AppPath & " type sequencer alias mid1", 0, 0, 0


mciSendString "play mid1 repeat", 0, 0, 0
MsgBox AppPath
End Sub

I have that last command
MsgBox AppPath
so it will show me where it 'thinks' the file is...and it's what's wrong?!

Nonstop Music..
I have a sound file that plays when a certain form is loaded with sndPlaysound code. It works perfectly execept when the user exits the game by hitting the "X" in the upper right hand corner, the music is still playing. Anyone know a way of solving this problem? Thanks

Copyright 2005-08, All rights reserved