PDA

Click to See Complete Forum and Search --> : How 2 play a sound through PC speaker?


sharkfrom
Mar 21st, 2002, 03:38 AM
IF any1 has N idea 'bout playing sounds through a PC speaker please post it or send mail.
thanks

Hack
Mar 21st, 2002, 07:11 AM
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

Private Function Play(uFlags As Long)
Dim Rc As Long
Rc = sndPlaySound(mFileName, uFlags)
End Function

Private Sub Form_Load()
mFileName = "C:\Windows\Media\hello.wav"
Play (uFlags)
DoEvents
End Sub

Sastraxi
Mar 21st, 2002, 03:14 PM
Do you mean the INTERNAL speaker (PC Speaker) or the sound card's output port? That code will do the sound card one, but not the internal speaker.

Hack
Mar 21st, 2002, 06:23 PM
Don't you need to send sound through the card to get to the speaker?

spyplayer
Mar 21st, 2002, 06:31 PM
I think he already said PC SPEAKER!

all i know is

private sub cmd_butbeep
Beep
End sub



DAMN IM TOO BASIC.....:mad: :D

sharkfrom
Mar 23rd, 2002, 01:15 AM
YES! I mean "PC SPEAKER".No sound cards ,no nothing.
About the 'Beep' command I tried it ,it just doesn't work.
Maybe if we put some more code in it?

sharkfrom
Mar 23rd, 2002, 01:23 AM
SORRY Spyplayer.
Turns out you're right.I just couldn't hear my speaker.
And here's a tip:
for higher sounds alter N
for i= 1 to N
beep
next i
the higher N is the higher the beep is

Bazza81
Mar 24th, 2002, 08:37 AM
Why not just use the API function, hell of a lot easier:


Private Declare Function Beep Lib "kernel32" Alias "Beep" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long

Private Sub cmdBeep_Click()
Beep 1000, 100
Beep 3500, 250
End Sub


You can make some really good tunes out of it. I made 'Twinkle Twinkle Little Start' once.

sharkfrom
Mar 25th, 2002, 04:13 AM
Yet,
these r not the sounds I've been looking for.
I apreciate the effort, but I'm looking more of a 'starting the computer' kind of beep.

Bazza81
Mar 25th, 2002, 06:05 AM
the beep is different on the different BIOS chips available and the different PC Speakers. Have a fiddle with the frequency and duration of the Beep.