mediarecorder - Sample Rate in Android Audio Record class and MediaRecord class -


i want know difference between setting audio sample rate in android audiorecord class , media record class? in audio record class set sample rate while creating object of class like

recorder = new audiorecord(mediarecorder.audiosource.mic,                                             samplerateinhz, recorder_channels,recorder_audio_encoding, buffersize);  

while in mediarecorder class set explicitly through function call. i.e.

mrec.setaudiosamplingrate(samplingrate); 

i tried both effect of sample rate can seen while audio recording not while recording throug mediarecorder class. can not understand differnce between both.

as of android sdk documentation, mediarecord used record audio , video. recording control based on simple state machine. use mediarecord record sounds unless need access raw audio data , process them(eg, apply own dsp effects).in scenario use audiorecord.setaudiosamplingrateof mediarecord same passing samplerateinhz audiorecord, setting desired sampling rate.the higher sampling rate better sound quality , frequency range get.an ideal uman ear can hear sound 20 20000 hz.if set sampling rate 4100hz frequency response equal 4100/2 20000hz.however supported freq range devices different. should check if device supports desired frequency.

in order check if specific freq works, may use following piece of code:

    int buffersize = audiorecord.getminbuffersize(rate[i],audioformat.channel_in_mono,audioformat.encoding_pcm_16bit); 

if buffersize value bigger 0 requency provided supported device.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -