07-02 03:26
Notice
Recent Posts
Recent Comments
07-02 03:26
«   2024/07   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
Archives
Today
Total
관리 메뉴

pear

[AudioRecord] API 본문

android

[AudioRecord] API

pearlab 2022. 8. 9. 14:47

Creator

new AudioRecord(MediaRecorder.AudioSource.VOICE_RECOGNITION, SampleRate, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT, sizeInBytes)

Parameter

MediaRecorder.AudioSource.VOICE_RECOGNITION(사용할 AudioSource 음성인식, need spec  or Support spec)

SampleRate(Sampling Rate of AudioFormat, need spec  or Support spec)

AudioFormat.CHANNEL_IN_MONO(channel type of AudioFormat , need spec or Support spec)

AudioFormat.ENCODING_PCM_16BIT(encode type of AudioFormat , one Sampling per 16bit or Support spec)

sizeInBytes( read record buffer max size)

 

GetBuffer Type

function  read(byte[] buffer, int offtset, sizeInBytes)

extend - Marker & Listener (setNotificationMarkerPosition & OnRecordPositionUpdateListener)

 

Parameter Type Ref Class

public final class AudioSource {
        public static final int CAMCORDER = 5;
        public static final int DEFAULT = 0;
        public static final int MIC = 1;
        public static final int REMOTE_SUBMIX = 8;
        public static final int UNPROCESSED = 9;
        public static final int VOICE_CALL = 4;
        public static final int VOICE_COMMUNICATION = 7;
        public static final int VOICE_DOWNLINK = 3;
        public static final int VOICE_PERFORMANCE = 10;
        public static final int VOICE_RECOGNITION = 6; 
        public static final int VOICE_UPLINK = 2;
    }

 

 

public final class AudioFormat implements Parcelable {

//channel type
    public static final int CHANNEL_INVALID = 0;
    public static final int CHANNEL_IN_BACK = 32;
    public static final int CHANNEL_IN_BACK_PROCESSED = 512;
    public static final int CHANNEL_IN_DEFAULT = 1;
    public static final int CHANNEL_IN_FRONT = 16;
    public static final int CHANNEL_IN_FRONT_PROCESSED = 256;
    public static final int CHANNEL_IN_LEFT = 4;
    public static final int CHANNEL_IN_LEFT_PROCESSED = 64;
    public static final int CHANNEL_IN_MONO = 16;
    public static final int CHANNEL_IN_PRESSURE = 1024;
    public static final int CHANNEL_IN_RIGHT = 8;
    public static final int CHANNEL_IN_RIGHT_PROCESSED = 128;
    public static final int CHANNEL_IN_STEREO = 12;
    public static final int CHANNEL_IN_VOICE_DNLINK = 32768;
    public static final int CHANNEL_IN_VOICE_UPLINK = 16384;
    public static final int CHANNEL_IN_X_AXIS = 2048;
    public static final int CHANNEL_IN_Y_AXIS = 4096;
    public static final int CHANNEL_IN_Z_AXIS = 8192;
    public static final int CHANNEL_OUT_5POINT1 = 252;

//cncode type

public static final int ENCODING_AAC_ELD = 15;
    public static final int ENCODING_AAC_HE_V1 = 11;
    public static final int ENCODING_AAC_HE_V2 = 12;
    public static final int ENCODING_AAC_LC = 10;
    public static final int ENCODING_AAC_XHE = 16;
    public static final int ENCODING_AC3 = 5;
    public static final int ENCODING_AC4 = 17;
    public static final int ENCODING_DEFAULT = 1;
    public static final int ENCODING_DOLBY_MAT = 19;
    public static final int ENCODING_DOLBY_TRUEHD = 14;
    public static final int ENCODING_DTS = 7;
    public static final int ENCODING_DTS_HD = 8;
    public static final int ENCODING_E_AC3 = 6;
    public static final int ENCODING_E_AC3_JOC = 18;
    public static final int ENCODING_IEC61937 = 13;
    public static final int ENCODING_INVALID = 0;
    public static final int ENCODING_MP3 = 9;
    public static final int ENCODING_PCM_16BIT = 2;
    public static final int ENCODING_PCM_8BIT = 3;
    public static final int ENCODING_PCM_FLOAT = 4;
    public static final int SAMPLE_RATE_UNSPECIFIED = 0;

'android' 카테고리의 다른 글

[android] simple GPT retrofit 2 - data  (0) 2023.06.13
[android] simple GPT retrofit 1 - setting  (0) 2023.06.13
[policy] 오디오 입력 공유 (from. android 10)  (0) 2022.07.14
[Util]Logfilter  (0) 2022.07.12
[NDK] r23 LTS 이후 r24 notice  (0) 2022.06.23