Reduce sampling frequency to 8000 Hz
This commit is contained in:
@@ -21,7 +21,7 @@ import android.media.AudioFormat;
|
|||||||
import de.rochefort.childmonitor.audio.G711UCodec;
|
import de.rochefort.childmonitor.audio.G711UCodec;
|
||||||
|
|
||||||
public class AudioCodecDefines {
|
public class AudioCodecDefines {
|
||||||
public static final int FREQUENCY = 11025;
|
public static final int FREQUENCY = 8000;
|
||||||
public static final int ENCODING = AudioFormat.ENCODING_PCM_16BIT;
|
public static final int ENCODING = AudioFormat.ENCODING_PCM_16BIT;
|
||||||
public static final G711UCodec CODEC = new G711UCodec();
|
public static final G711UCodec CODEC = new G711UCodec();
|
||||||
public static final int CHANNEL_CONFIGURATION_IN = AudioFormat.CHANNEL_IN_MONO;
|
public static final int CHANNEL_CONFIGURATION_IN = AudioFormat.CHANNEL_IN_MONO;
|
||||||
|
|||||||
@@ -88,7 +88,6 @@ public class MonitorActivity extends Activity {
|
|||||||
final int read = audioRecord.read(pcmBuffer, 0, bufferSize);
|
final int read = audioRecord.read(pcmBuffer, 0, bufferSize);
|
||||||
int encoded = CODEC.encode(pcmBuffer, read, ulawBuffer, 0);
|
int encoded = CODEC.encode(pcmBuffer, read, ulawBuffer, 0);
|
||||||
out.write(ulawBuffer, 0, encoded);
|
out.write(ulawBuffer, 0, encoded);
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(TAG, "Connection failed", e);
|
Log.e(TAG, "Connection failed", e);
|
||||||
|
|||||||
Reference in New Issue
Block a user