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.