Site icon Embarcadero RAD Studio, Delphi, & C++Builder Blogs

Audio Recorder And Player Component For Delphi/C++ Applications On Windows.

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:

Versions Supported: Delphi 5 – Delphi 10.4/C++

Platforms: Windows;  

Installation Steps:  

Prerequisites: Ensure 5.5 MB minimum free space available in the system.

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.

<strong>Recorder Properties<strong>

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!

<strong>Player Properties<strong>

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!

Exit mobile version