C # The program issues a warning.

Source: Internet
Author: User

1. You can directly use console. Beep ();

Or console. Beep (frequency, duration); you can customize the audio of any Hz and any time;

However, the EXE generated in Windows 7 will sound from the host in the Windows XP system for unknown reasons;

It may be because the system is different and the compiled exception occurs.

 

2. You can also use the DLL class.

[Dllimport ("kernel32.dll")]
Private Static extern int BEEP (INT dwfreq, int dwduration );
Then you can directly call the beep function; Same as above;

 

3. UseMicrosoft. VisualBasic. Devices.Audio class

// Play the wav file
Audio. Play ("WAV address ");
// Playback Memory Array
Audio. Play (New byte [] {
// Sound data...
}, Microsoft. VisualBasic. audioplaymode. Background );
// Play the system sound
Audio. playsystemsound (system. Media. systemsounds. Beep );

When playing the system sound, different systems may have different beep sounds, Microsoft settings;

4. Use the system. Media. soundplayer class

Soundplayer player = new soundplayer ();

Player. soundlocation = @ ". \ audio \ err.wav.wav"; player. Load (); player. Play (); 5. For audio synthesis, you can use speech to read audio.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.