Libraryless. Click here for Pure Java version (2194L/14K/51K).
!7 import android.media.*; static int bufferSize = 8192; p { print("Making recorder"); AudioRecord recorder = new AudioRecord.Builder() .setAudioSource(MediaRecorder.AudioSource.VOICE_COMMUNICATION) .setAudioFormat(new AudioFormat.Builder() .setEncoding(AudioFormat.ENCODING_PCM_16BIT) .setSampleRate(16000) .setChannelMask(AudioFormat.CHANNEL_IN_MONO) .build()) .setBufferSizeInBytes(bufferSize) .build(); print("Made recorder"); recorder.startRecording(); print("Started recording"); byte[] buf = new[bufferSize]; while licensed { printWithTime("Read bytes: " + recorder.read(buf, 0, l(buf), AudioRecord.READ_BLOCKING); } recorder.release(); print("Released recorder"); }
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, mqqgnosmbjvj, odkhaoglnmdk, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1027050 |
Snippet name: | Android AudioRecord Test 2 [dev.] |
Eternal ID of this version: | #1027050/6 |
Text MD5: | a4aada5138a5cb1a0214362b759c6210 |
Transpilation MD5: | aac51bbf0431b8111f8fdfbf8da23ceb |
Author: | stefan |
Category: | javax / android |
Type: | JavaX source code (Android) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-02-15 13:02:43 |
Source code size: | 780 bytes / 31 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 300 / 420 |
Version history: | 5 change(s) |
Referenced in: | #1027051 - Android Send Audio Raspi v2 [for Bluetooth headset, OK!] |