Windows program for emit a frequency in audible range

I would like to create a Windows program that can do the following:

  • Emit a frequency in the audible range(400Hz-5kHz)
  • Output through the standard Windows sound output
  • Frequency can be changed at any time
  • The frequency output can be started and stopped at any time
  • Without installing additional add-ons

Does anyone have an idea how I can implement such a sound output?

one idea is to create a wave file and play it.

alternate via note player?
https://documentation.xojo.com/api/user_interface/desktop/desktopnoteplayer.html

or via windows api, or Monkeybread Software plug-ins for Xojo?
https://www.monkeybreadsoftware.de/xojo/plugin-audio.shtml

seems you will fill a playing sound buffer in real time.

When you say a frequency, how precise does this have to be. If you are doing a hearing test I’m not sure how accurately a sound card is going to be at producing a pure frequency. You would have to perform some testing to ensure it meets your needs. I agree with Markus that a series of sound files with each frequency is likely the easiest option.

I want to develop an acoustic feedback program to monitor a working PID controller, which would result in a continuously changing frequency.

Thank you, Markus. That was my first thought too, and ChatGPT provided me with the Xojo code to create a wave file. The code was very compact and worked flawlessly after swapping the low and high words in the header. However, I foresee issues with wave files when dealing with a constantly and rapidly changing frequency.