Link to home
Create AccountLog in
Avatar of whitefoxdennet
whitefoxdennet

asked on

VB.NET beep from sound card, not PC speaker

I am trying to create a beep sound (for use in morse code generation) from a VB.NET windows application, and I need the sound to come out the sound card not the PC speaker.  I need to be able to adjust the tone and duration of the beep.

I've tried using the Windows kernel beep function:
Private Declare Function Beep Lib "kernel32" Alias "Beep" (ByVal dwFreq As Integer, ByVal dwDuration As Integer) As Long

But this always causes the sound to come out of the sound card.  I need it to come out the sound card speaker output so I can link it to a radio transmitter.
Avatar of MerijnB
MerijnB
Flag of Netherlands image

You'll have to do this yourself by generating a sine into a wave and playing that.
Avatar of whitefoxdennet
whitefoxdennet

ASKER

A code example of exactly how to do that in VB.NET would be nice.


Also a correction to the original description, it should read:
But this always causes the sound to come out of the PC speaker.  I need it to come out the sound card speaker output so I can link it to a radio transmitter.
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
The class that is created as part of that project has a method that does exactly what I needed.  Just added a reference to the dll and was able to do exactly what I needed.