I am writing a music software in visual basic as my final year project and am having problems with displaying a piano and loading sounds into each of the notes.Can someone please!!!! come to my aid. Any help given will be appreciated

Recommended Answers

All 5 Replies

How are you trying to load the music files? What format are you going with? Any dll's or ocx controls used?

What exactly you are trying to do ?
Are you trying to play the sound files ?

if ur intension is only to play the sound files, use windows media player control or windows multimedia control or in advance u can also use the "mcisendstring" api libraries.

what do you use in your form??

if a command button, try loading the sound clip when the command button is click
the do something like

cmdSound.Mpeg.play

make the Mpeg(or media player) set to visibled = false

Here is how you can play wav files.
1. Add a command button and a common dialog box. Copy and paste the sndPlaySound Declare statement from the API Viewer into your application. Also copy the SND_SYNC and SND_ASYNC constants.

Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Private Const SND_ASYNC = &H1
Private Const SND_SYNC = &H0

2. Add this code to the Command1_Click procedure:

Private Sub Command1_Click()
Dim RtnVal As Integer
'Get name of .wav file to play
CommonDialog1.Filter = "Sound Files|*.wav"
CommonDialog1.ShowOpen
RtnVal = sndPlaySound(CommonDialog1.filename, SND_SYNC)
End Sub

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.