Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recording to a wav file

I'm trying to create a wav file using the XE5 Firemonkey for Android

from this link : http://i-liger.com/article/android-wav-audio-recording

I read that we must forget about using the MediaRecorder class .

First of all we have to forget about MediaRecorder class. Instead we have to use AudioRecord, this class providing more flexibility.

How can I use the AudioRecord in XE5 ?

like image 422
randydom Avatar asked Nov 11 '22 13:11

randydom


1 Answers

If you included samples in your XE5 install than you have a working demo in samples folder (usually in the Public docuemnts). Look in the Samples\MobileCodeSnippets\Delphi\AudioRecPlay folder.

Here's what they use to record FMicrophone: TAudioCaptureDevice;

Some of the code in the sample:

FMicrophone := TCaptureDeviceManager.Current.DefaultAudioCaptureDevice;
if HasMicrophone then
begin
  { and attempt to record to 'test.caf' file }
  FMicrophone.FileName := GetAudioFileName('test.caf');
  try
    FMicrophone.StartCapture;
  except
    ShowMessage('StartCapture: Operation not supported by this device');
  end;
end
else
  ShowMessage('No microphone is available.');
like image 142
Sentient Avatar answered Nov 14 '22 22:11

Sentient