Android Programming Press on the image to return to the main documentation page.

AudioRecord

Written by Steve Laming

List of types:

AudioRecord

AudioRecord


Permissions:

android.permission.RECORD_AUDIO

Events:

None

Members:


  A_SRC_CAMCORDER As Int

  A_SRC_DEFAULT As Int

  A_SRC_MIC As Int

  A_SRC_VOICE_CALL As Int

  A_SRC_VOICE_COMMINICATION As Int

  A_SRC_VOICE_DOWNLINK As Int

  A_SRC_VOICE_RECOGNITION As Int

  A_SRC_VOICE_UPLINK As Int

  AF_PCM_16 As Int

  AF_PCM_8 As Int

  CH_CONF_MONO As Int

  CH_CONF_STEREO As Int

  ERROR As Int

  ERROR_BAD_VALUE As Int

  ERROR_INVALID_OPERATION As Int

  GetAudioFormat As Int

  GetAudioSource As Int

  GetChannelConfig As Int

  GetChannelCount As Int

  GetMinBufferSize (sampleRateHz As Int, channelConfig As Int, audioFormat As Int) As Int

  GetNotificationMarkerPosition As Int

  GetPositionNotificationPeriod As Int

  GetRecordingState As Int

  GetSampleRate As Int

  GetState As Int

  Initialize (audioSource As Int, sampleRateHz As Int, channelConfig As Int, audioFormat As Int, bufferSize As Int)

  ReadBytes (offset As Int, datasize As Int) As Byte()

  ReadShort (offset As Int, datasize As Int) As Short()

  RECORDSTATE_RECORDING As Int

  RECORDSTATE_STOPPED As Int

  release

  SetNotificationMarkerPosition (frames As Int) As Int

  SetPositionNotificationPeriod (frames As Int) As Int

  StartRecording

  STATE_INITIALIZED As Int

  STATE_UNINITIALIZED As Int

  Stop

  SUCCESS As Int

Members description:

A_SRC_CAMCORDER As Int
A_SRC_DEFAULT As Int
Constant Value 0
A_SRC_MIC As Int
A_SRC_VOICE_CALL As Int
A_SRC_VOICE_COMMINICATION As Int
A_SRC_VOICE_DOWNLINK As Int
A_SRC_VOICE_RECOGNITION As Int
A_SRC_VOICE_UPLINK As Int
AF_PCM_16 As Int
AF_PCM_8 As Int
CH_CONF_MONO As Int
CH_CONF_STEREO As Int
ERROR As Int
ERROR_BAD_VALUE As Int
ERROR_INVALID_OPERATION As Int
GetAudioFormat As Int
Returns the audio format as set in initialize
GetAudioSource As Int
Returns the audio source as set in initialize
GetChannelConfig As Int
returns the channel configuration as set in initialize
GetChannelCount As Int
returns the channel count as set in initialize (channelconfig)
GetMinBufferSize (sampleRateHz As Int, channelConfig As Int, audioFormat As Int) As Int
Returns the minimum buffer size required to record with the given parameters
-1 if the implementation was unable to query the hardware for its output properties
-2 if the recording parameters are not supported by the hardware, or an invalid parameter was passed
GetNotificationMarkerPosition As Int
Returns the notification marker position expressed in frames
(Frame size = No Channels * (1 for 8bit, 2 for 16 bit))
GetPositionNotificationPeriod As Int
Returns the notification update period expressed in frames.
GetRecordingState As Int
Returns the recording state of the AudioRecord instance.
RECORDSTATE_RECORDING = 3;
RECORDSTATE_STOPPED = 1;
GetSampleRate As Int
Returns the configured audio data sample rate in Hz
GetState As Int
Returns the state of the AudioRecord instance.
STATE_INITIALIZED = 1
STATE_UNINITIALIZED = 0
Initialize (audioSource As Int, sampleRateHz As Int, channelConfig As Int, audioFormat As Int, bufferSize As Int)
Initialize AudioRecord:

AudioSource - Same as MediaRecorder
SampleRate - 44100 is standard and should work on all devices,22050,16000.11025 and 8000 may work on some
Channel config - Mono or Stereo depending on available hardware, Mono is the safe option
Audio format, 8 or 16 bit encoding
Buffer size - the total size (in bytes) of the buffer where audio data is written to during the recording.
New audio data can be read from this buffer in smaller chunks than this size.
See getMinBufferSize(int, int, int) to determine the minimum required buffer size for the successful
creation of an AudioRecord instance. Using values smaller than getMinBufferSize() will
result in an initialization failure.
ReadBytes (offset As Int, datasize As Int) As Byte()
Reads audio data from the audio hardware for recording into a buffer.
ReadShort (offset As Int, datasize As Int) As Short()
Reads audio data from the audio hardware for recording into a buffer.
RECORDSTATE_RECORDING As Int
RECORDSTATE_STOPPED As Int
release
Releases the native AudioRecord resources.
SetNotificationMarkerPosition (frames As Int) As Int
Sets the notification marker position expressed in frames
if set you need a subroutine AudioRecord_MarkerReached to be
called
returns
0 = SUCCESS
-3 = ERROR_INVALID_OPERATION
SetPositionNotificationPeriod (frames As Int) As Int
Sets the notification period expressed in frames.
if set you need a subroutine AudioRecord_PeriodPassed to be
called
0 = SUCCESS
-3 = ERROR_INVALID_OPERATION
StartRecording
Starts recording from the AudioRecord instance.
STATE_INITIALIZED As Int
STATE_UNINITIALIZED As Int
Stop
Stops recording
SUCCESS As Int

Top