![1158924tranceMusicCanvasLandscape | Embarcadero RAD Studio Delphi C++Builder Blogs](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2020/08/1158924_tranceMusic_Canvas_Landscape.jpg?resize=1140%2C675&ssl=1)
Are you someone struggling with how to build the Audio recorder and player in your Delphi/C++ and Lazarus applications? Don’t worry this post is for you. WINSOFT made Delphi/C++/Lazarus developer’s life easy to quickly build Audio recorder and player features using Audio Component Suite. This Audio Component suite uses Standard Windows Waveform Audio API. It contains a Recorder and Player component.
Features:
- It supports raw PCM audio data and PCM audio Wav files. More details about the PCM Wave Sound File Format.
- Flexibility to choose the Audio Input/Output installed on the PC, record, play, pause, resume.
- Able to view the device Capabilities for the selected Audio Input/Output Device.
- Samples per second, Bits per second, and channel can be configured for recording.
- Can adjust the Volume left and Volume right of the selected device.
Versions Supported: Delphi 5 – Delphi 10.4/C++
Platforms: Windows;
Installation Steps:
Prerequisites: Ensure 5.5 MB minimum free space available in the system.
- Download AudioCS Setup and Right-click Open.
- Read the Information Window about features, installation, and copyright. Click Next.
- Browse for the custom destination folder to install and click Next.
- Browse for the custom Start Menu folder and click Next. You can ignore creating by clicking the checkbox Don’t create a Start Menu folder option.
- Review your folder settings and click Install. You can click Back to change your folder settings.
- Once Installation Progress is done click Finish.
- Ensure the Audio Component suite files are shown in the chosen Start Menu Folder by clicking Windows Start Menu.
Installation Steps Demo:
How to build your application with Audio Suite Component:
1.Open RAD Studio 10.4, Navigate to Components bar -> System. Check the Audio Suite Components installed as shown.
2. Drag and Drop the TRecorder and TPlayer component or by adding AudioCS.pas into your unit and create these components by code.
Active : Opens or closes the Waveform-audio input/output device.
Device: The identifier of the waveform-audio Provides the list of Audio input/output devices(0 to N) in the system. The default value is MapperDevice i.e) Waveform Audio input/output device capable of recording/playing the given format. DeviceCount property gives the total number of audio devices. DeviceName[Device: Integer] provides the product name.
Capabilities: Read-only property, provides information about device manufacturer, product identifier, product name, major, minor, standard formats, Channels (mono or stereo).
OnBufferNeeded: A new buffer is needed for audio recording/playback, Recorded/playback waveform data will be placed to this buffer.
OnBufferReleased: Buffer with recorded/playback waveform-audio data is available.
Save: Write PCM Data to the specified file.
Load: Retrieves PCM parameters and data from the specified file.
![Recorder | Embarcadero RAD Studio Delphi C++Builder Blogs Describe about Recorder properties](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2020/08/Recorder.png?resize=426%2C368&ssl=1)
TRecorder;
3. Create a buffer of some fixed size and add to the buffer list when file size grows using onbufferneeded and increase the size onbufferReleased.
4. Select the Device from the DeviceCount list.
5. Recorder.Open //Make active the recorder device for recording
6. Recorder.Start // Start Recording.
7. Recorder.Stop // Stop Recording
8. Recorder.Reset// Resets the current position to zero. All pending buffers is stored to the application. To start fresh recording Reset and clear the buffers and start recording.
9. Save the recorded buffer to the user specified file by Save procedure.
Hope you have progressed to record the audio successfully. Curious to play the recorded Audio ? Here we go!
![image | Embarcadero RAD Studio Delphi C++Builder Blogs](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2020/08/image.png?resize=431%2C430&ssl=1)
10. Load the recorded audio using Load function by an open dialog and store to the buffer list.
11.Select the Audio Output Device from DeviceCount list.
12.Player.Open // Make active the Audio output device for playing
13.Player.Play // Play the audio from the buffer list using onbufferneeded and increase the size onbufferReleased.
14.Player.Pause // Pause the audio at some position in samples.
15.Player.Resume // Resume playing from the last position it paused.
16.Player.Stop // stop playing the Audio.
17.Player.LeftVolume/RightVolume // Adjust the Volume between 0 to 65535 for left and right volume.
Other features: Adjusting the values of Pitch, PitchValue, PlaybackRate, and PlaybackValue based on Audio device supports.
Note: You can update the position of recording/playing by Samples, Milliseconds,Bytes, Midi Time.
Sample Application Demo:
Conclusion: It’s that simple to build recorder and player functionality in your applications. WINSOFT saved our time in nailing the Windows API and boost our productivity.
Check out the full WINSOFT Audio Component for Access in Delphi and C++Builder.
Like what you see? You can get Audio Component Suite and over 100 other fantastic WinSoft components with our Enterprise Component Pack. For a limited time, when you purchase RAD Studio Enterprise or Architect Edition at special Upgrade Pricing, you will also get this package of third-party software worth over $13,000, including the full WinSoft Component Library, at NO EXTRA COST! Step up to RAD Studio 10.4 today!
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition