Results 1 to 10 of 10

Thread: How 2 play a sound through PC speaker?

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2002
    Location
    yugoslavia
    Posts
    4

    How 2 play a sound through PC speaker?

    IF any1 has N idea 'bout playing sounds through a PC speaker please post it or send mail.
    thanks

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    VB Code:
    1. Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
    2.  
    3. Private Function Play(uFlags As Long)
    4.     Dim Rc As Long
    5.     Rc = sndPlaySound(mFileName, uFlags)
    6. End Function
    7.  
    8. Private Sub Form_Load()
    9.        mFileName = "C:\Windows\Media\hello.wav"
    10.         Play (uFlags)
    11.         DoEvents
    12. End Sub

  3. #3
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    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.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Don't you need to send sound through the card to get to the speaker?

  5. #5
    Member
    Join Date
    Nov 2001
    Location
    Heaven........ Whats that fire doing here?
    Posts
    39

    HELLO?!?!?!?!?!?!!!!

    I think he already said PC SPEAKER!

    all i know is

    private sub cmd_butbeep
    Beep
    End sub



    DAMN IM TOO BASIC.....
    []:::::::::::[];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;/

    Did you know that you can be your own grandpa?! It's really cool. . . . . .
    ------------------------------------------------
    But I'm not. . . Im just Myself. . . . .
    Not my own grandpa. . . . . .

    I put on my own pants today. . . . .
    Im so proud of myself. . . . .

  6. #6

    Thread Starter
    New Member
    Join Date
    Mar 2002
    Location
    yugoslavia
    Posts
    4
    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?

  7. #7

    Thread Starter
    New Member
    Join Date
    Mar 2002
    Location
    yugoslavia
    Posts
    4
    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

  8. #8
    Addicted Member Bazza81's Avatar
    Join Date
    Apr 2001
    Location
    Nottingham, UK
    Posts
    203

    Why use a crappy loop?

    Why not just use the API function, hell of a lot easier:

    VB Code:
    1. Private Declare Function Beep Lib "kernel32" Alias "Beep" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
    2.  
    3. Private Sub cmdBeep_Click()
    4.     Beep 1000, 100
    5.     Beep 3500, 250
    6. End Sub

    You can make some really good tunes out of it. I made 'Twinkle Twinkle Little Start' once.
    Who needs rhetorical questions anyway?


    Bazza NET - The place you want to be!

  9. #9

    Thread Starter
    New Member
    Join Date
    Mar 2002
    Location
    yugoslavia
    Posts
    4
    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.

  10. #10
    Addicted Member Bazza81's Avatar
    Join Date
    Apr 2001
    Location
    Nottingham, UK
    Posts
    203
    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.
    Who needs rhetorical questions anyway?


    Bazza NET - The place you want to be!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width