C++Language FeatureLearn C++

Learn How To Easily Record Sound In Powerful Modern C++ On Windows

Sounds are in wave format and in digital form sound has its volume change in timeline. In C++ Builder it is easy to use recording devices on Windows. To record a sound in Multi-Device applications we must use FMX.Media.hpp header.

1. Let’s create a new MultiDevice C++ Builder Project, save all project and unit files to a folder.

2. To define Audio Capture Device we need FMX.Media library. Go to Unit1.h header file add

and lets define Mic device

3. Let’s back to Unit1.cpp codes, now we can define our Mic device as below

4. Now we can define FileName directly

or you can obtain file name by using SaveDialog component as below;

5. Add a Button now we can start recording device by using StartCapture() as below;

6. Add another button to stop recording, and stop it as below;

7. That’s All. Now you can run your codes by pressing F9.

Let’s look at all codes. Unit.h header file should be like this (FMX.Media library is needed);

Unit.cpp file should be like this;

Oh hi there 👋
It’s nice to meet you.

Sign up to receive awesome C++ content in your inbox, every day.

We don’t spam! Read our privacy policy for more info.

About author

Dr. Yilmaz Yoru has 35+ years of coding with more than 30+ programming languages, mostly C++ on Windows, Android, Mac-OS, iOS, Linux, and some other operating systems. He graduated and received his MSc and PhD degrees from the Department of Mechanical Engineering of Eskisehir Osmangazi University. He is the founder and CEO of ESENJA LLC Company. His interests are Programming, Thermodynamics, Fluid Mechanics, Artificial Intelligence, 2D & 3D Designs, and high-end innovations.
Related posts
C++C++11C++14C++17C++20Introduction to C++Learn C++

Learn Copy Constructors in C++ Classes

C++C++11C++14C++17Introduction to C++Learn C++Syntax

Learn How To Use Types Of Destructors In C++?

C++C++11C++14Learn C++Syntax

How To Convert u32string To A wstring In C++

C++C++11C++14C++17C++20Introduction to C++Learn C++

How To Learn The Move Constructors In Modern C++?