Using current value

I wonder if it is at all possible to create a program in c ++ that will work based on the current value.

For example: By changing the sound frequency measured by the microphone, another value changes and some other actions are performed.

If it is not possible in c ++, do you know in which programming language it is possible?

Sure. Create a monitor object of some sort that monitors the microphone input. When it detects a change in frequency, it modifies the value in question. This would probably be in it own thread.

Another thread would watch the value, and when it changes, perform the other action.

Also, you could just do a single-threaded program where the monitor object performs the action.

There are lots of possibilities of how to do what you want. Why not start by learning the basics of the language first. When you get comfortable with C++, then work on just monitoring the microphone input and maybe printing out the measured frequencies. Then build on that.
It's certainly possible in C++. Audio/signal processing isn't a part of the standard library, so you'd have to use third-party libraries.
In Windows, you would probably use Core Audio API or some wrapper for it:
https://docs.microsoft.com/en-us/windows/win32/coreaudio/core-audio-apis-in-windows-vista
Or try searching for "C++ microphone capture".

Normally, you get time-domain amplitude samples from a microphone. You need to convert this into the frequency domain yourself (for example, using the FFT). It would be a cool project, but as doug4 mentioned, it might be hard for a beginner.

Other languages will have libraries available for microphones and audio processing, too.
For example, in Python:
https://stackoverflow.com/questions/1936828/how-get-sound-input-from-microphone-in-python-and-process-it-on-the-fly
Topic archived. No new replies allowed.