logo  Play a Note
This Chapter
Sound
Play Note
Play Recording
Record Sound
Chapters
Home Page
Colours, RGB
Computer Specifications
Dates&Times
Disk Drives
Files
Folders
GPS and OS Ref
VB.Net Forms
Image Files
If & Select
List/Array
Mathematics
NuGet
Sound
String Functions
Sun and Moon
User Controls
Validation
DigitalDan Sites
My Other Sites
Contact Site

Note
Some pages
may contain
inaccuracies
Hits=5
The function below provides a simple method to play a "tone" using dotNet, however, the simplicity does impose certain limitations

Private NotePlaying As Boolean = False
Private Sub PlayNote(f As Integer, t As Integer)
 If NotePlaying Then Exit Sub
 NotePlaying = True
 System.Console.Beep(f, t)
 NotePlaying = False
End Sub
  
You can call the Sub using

PlayNote(frequenc, tim)
  
Where Frequenc is the required frequency (pitch) for the note in Hertz (Hz)
and t is the duration (time) that the note should play in Milliseconds (mS)
Use f=512, t=1000 for a "Middle C" tone lasting 1 second

DigitalDan.co.uk