|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to create a sound at specific frequency?Does anyone know how can i create a sound in vb.net that will be a
specific frequency? I can't find anything online that helps. Thanks very much for your help! John > Does anyone know how can i create a sound in vb.net that will be a ' Beep (winbase.h) plays a sound in hertz for a duration in milliseconds> specific frequency? I can't find anything online that helps. ' This function is named BeepApi because Beep is a vb reserved word Public Declare Function BeepApi Lib "kernel32" Alias "Beep" ( _ ByVal dwFreq As Integer, _ ByVal dwDuration As Integer) _ As Integer AMercer wrote:
> Public Declare Function BeepApi Lib "kernel32" Alias "Beep" ( _ And if you don't want to use p/invoke you can use:> ByVal dwFreq As Integer, _ > ByVal dwDuration As Integer) _ > As Integer System.Console.Beep(_frequency, _duration) Thank you for your replies. I tried that earlier. The problem with
this method is that the beep is sounded via the internal PC speaker, not the external speakers, and the quality is very bad. Does anyone know how to get the sound to come out of the external speakers? Thanks! John johnb41 wrote: Show quoteHide quote > Does anyone know how can i create a sound in vb.net that will be a > specific frequency? I can't find anything online that helps. > > Thanks very much for your help! > > John johnb41 wrote:
> Does anyone know how to get the sound to come out of the external You mean through the sound card?> speakers? If you're using .Net 2.0, you can import the System.Media namespace and then call: SystemSounds.Beep.Play() What is played depends on the sound scheme setup in the control panel. > Thank you for your replies. I tried that earlier. The problem with At web site> this method is that the beep is sounded via the internal PC speaker, > not the external speakers, and the quality is very bad. > > Does anyone know how to get the sound to come out of the external > speakers? http://ccrma.stanford.edu/CCRMA/Courses/422/projects/WaveFormat/ is a description of the layout of a .wav file. You could generate such a structure with digitized sinusoid values in the 'data' area, and feed that data to Private Declare Function PlaySound Lib "winmm" Alias "PlaySoundA" ( _ ByVal pszSound() As Byte, _ ByVal hMod As Integer, _ ByVal fdwSound As Integer) _ As Integer Use 0 for hMod, and use &h4 for fdwSound (constant SND_MEMORY). Pass the wave array you build in pszSound. Sounds like some effort, but it should work.
Cut, Copy and Paste?
Diagnostics.Process & MSIEXEC problem... How to Return Value from Module? deploy window application handling money SQL and VB Validating all controls on "Save" exceptions/inner exceptions Getting the full path of a folder. Referencing a MDI Parent form from a Child Expose Count from System.Collections.CollectionBase in an inherited class |
|||||||||||||||||||||||