Android java foundation) Convert to pcm file wav
How should I convert the .pcm file to .pcm file?I am currently developing Android apps that can be reproduced.I am not used to handle audio, and format.I can record it. stackoverflow.com

감지된 언어가 없습니다.
입력 언어를 확인해 주세요.
Translation to pcm File wavT of voice data stored in the Android device (I’m going to play only? TT) Appropriate files… m.blog.naver.com

[Convert to pcm file wav] There was audio data that I saved on my Android device (I don’t know why I only play with audio data)T) Affected Files…m.blog.naver.com
[Convert to pcm file wav] There was audio data that I saved on my Android device (I don’t know why I only play with audio data)T) Affected Files…m.blog.naver.com

[Convert to pcm file wav] There was audio data that I saved on my Android device (I don’t know why I only play with audio data)T) Affected Files…m.blog.naver.com
[Convert to pcm file wav] There was audio data that I saved on my Android device (I don’t know why I only play with audio data)T) Affected Files…m.blog.naver.com

Private Threads Recording Threads Private AudioRecord mRecorder; private ブールは Recording = false; private void startRecording() { mRecorder = new AudioRecord(MediaRecorder) Yes, audio Source. MIC. Constant.RECORDER_SAMPLERATE、定数.RECORDER_CHANNELs、定数.RECORDER_AUDIO_ENCODING、定数。BufferElements2Rec * 定数。BytesPerElement); mRecorder.startRecording(); isRecording = true; recording thread = newThread(newRunnable() {public void run () {write}AudioDataToFile();}、”AudioRecorder Thread”; Recording Thread.start();}private void writeAudioDataToFile() {/ Output Audio Byte FileOutputStreamos = null; try {os = newFileOutputStream(mFileName);} catch (FileNotFoundExceptione) {e.printStackTrace()} while (isRecording) {// The gets audio output from the microphone to the byte format mRecorder.read(sData, 0, constant).BufferElements2Rec); try {//// buffer/// is the voice buffer Byte bData[] = short2byte(sData); os.write(bData, 0, 定数) stores the .BufferElements2Rec * 定数。BytesPerElement);} catch (IOException e) {e.printStackTrace();} catch (IOException e) Try {e.printStackTrace();}
Private Threads Recording Threads Private AudioRecord mRecorder; private ブールは Recording = false; private void startRecording() { mRecorder = new AudioRecord(MediaRecorder) Yes, audio Source. MIC. Constant.RECORDER_SAMPLERATE、定数.RECORDER_CHANNELs、定数.RECORDER_AUDIO_ENCODING、定数。BufferElements2Rec * 定数。BytesPerElement); mRecorder.startRecording(); isRecording = true; recording thread = newThread(newRunnable() {public void run () {write}AudioDataToFile();}、”AudioRecorder Thread”; Recording Thread.start();}private void writeAudioDataToFile() {/ Output Audio Byte FileOutputStreamos = null; try {os = newFileOutputStream(mFileName);} catch (FileNotFoundExceptione) {e.printStackTrace()} while (isRecording) {// The gets audio output from the microphone to the byte format mRecorder.read(sData, 0, constant).BufferElements2Rec); try {//// buffer/// is the voice buffer Byte bData[] = short2byte(sData); os.write(bData, 0, 定数) stores the .BufferElements2Rec * 定数。BytesPerElement);} catch (IOException e) {e.printStackTrace();} catch (IOException e) Try {e.printStackTrace();}

private void startPlaying() {new Thread(newRunnable() {public void run () {try {File File = newFile(mFileName); byte[] audioData = null; InputStream inputStream(mFileName); audioData= 新しいバイト[定数] です。BufferElements2Rec]; mPlayer = new AudioTrack(AudioManager)です.STREAM_MUSIC, constant.RECORDER_SAMPLERATE, audio format.Channel_OUT_MONO, constant.RECORDER_AUDIO_ENCODING, constant.BufferElements2Rec* constant.Bytes Per Element、AudioTrack です.MODE_STREAM); final float duration = (float) file.length () / 定数です.RECORDER_SAMPLERATE / 2; Log.i(TAG, “PLAYBACK AUDIO”); Log.i(TAG, String.valueOf(duration)); mPlayer.setPositionNotificationPeriod(定数) specifies the .RECORDER_SAMPLERATE/10); mPlayer.setNotificationMarkerPosition(Math.round(duration * 定数) specifies the .RECORDER_SAMPLERATE()); mPlayer.play(); inti = 0;while((i = inputStream.read(audioData))!= -1) {try {mPlayer}を実行します.write(audioData, 0, i);} catch (Exception e) {Log.e(TAG, “Exception:” + e.getLocalizedMessage())};}}} catch (FileNotFoundExceptionfe) {Log.e(TAG, “ファイルが見つかりません: ” + fe.getLocalizedMessage());} catch (IOExceptionio) {Log.e(TAG, “IO例外: ” + io。getLocalizedMessage();}}})start();}
https://cdn.movavi.io/page_type/0023/47/6ac7c2c09e33c9fe4c381d7ce49d4742a89a9768.webpパブリッククラスの「最終的なパブリック Intel」「「」「「」」」「最終静的パブリック Interface= 4100」IN_MONO; 最終的なスタティック public int RECORDER_AUDIO_ENCODING = オーディオ形式です。エンコーディング_PCM_16BですIT。最終スタティックパブリック バッファE2Rec= 1024、// 2 バ””””””””””””””””””””””””””””public class 定数 { final static public int RECORDER_SAMPLERATE = 44100; final static public int RECORDER_CHANNELs = オーディオ形式です。チャネルです_IN_MONO; 最終的なスタティック public int RECORDER_AUDIO_ENCODING = オーディオ形式です。エンコーディング_PCM_16BですIT; 最終的なスタティック public int BufferElements2Rec = 1024; // 2 バイトしか使用しないので、 2048 (2K) を再生したいと思います。なぜなら、 2 バイトは 1024 最終的な static public int BytesPerElement = 2; // 16 ビット形式の 2バイト}public class 定数 { final static public int RECORDER_SAMPLERATE = 44100; final static public int RECORDER_CHANNELs = オーディオ形式です。チャネルです_IN_MONO; 最終的なスタティック public int RECORDER_AUDIO_ENCODING = オーディオ形式です。エンコーディング_PCM_16BですIT; 最終的なスタティック public int BufferElements2Rec = 1024; // 2 バイトしか使用しないので、 2048 (2K) を再生したいと思います。なぜなら、 2 バイトは 1024 最終的な static public int BytesPerElement = 2; // 16 ビット形式の 2バイト}public class 定数 { final static public int RECORDER_SAMPLERATE = 44100; final static public int RECORDER_CHANNELs = オーディオ形式です。チャネルです_IN_MONO; 最終的なスタティック public int RECORDER_AUDIO_ENCODING = オーディオ形式です。エンコーディング_PCM_16BですIT; 最終的なスタティック public int BufferElements2Rec = 1024; // 2 バイトしか使用しないので、 2048 (2K) を再生したいと思います。なぜなら、 2 バイトは 1024 最終的な static public int BytesPerElement = 2; // 16 ビット形式の 2バイト}public class 定数 { final static public int RECORDER_SAMPLERATE = 44100; final static public int RECORDER_CHANNELs = オーディオ形式です。チャネルです_IN_MONO; 最終的なスタティック public int RECORDER_AUDIO_ENCODING = オーディオ形式です。エンコーディング_PCM_16BですIT; 最終的なスタティック public int BufferElements2Rec = 1024; // 2 バイトしか使用しないので、 2048 (2K) を再生したいと思います。なぜなら、 2 バイトは 1024 最終的な static public int BytesPerElement = 2; // 16 ビット形式の 2バイト}プライベート Wave(最終ファイル) 最終ファイル、最終ファイル、最終ファイルの [File] (infile) {ports.files] (Infile) {putole);}、入力.読み取り(RWave)、{filedge(Interfile):{puthow」(fileputhow)。長)// チャンク(出力、//形式(出力、flash))。//形式(ports,//」(出力、hort)、(ショート)://ブロック(出力、 short):// block(prings):// blockings(pring)。リトル_EXENER)、Sort(Sort);バイトBuffer バイト =バイトBuffer. ‘{“””””””””””””””””””””””””””””””= null){出力.}バイト[ファイル] [FileTes] [File] [New] [バイト] [New] [バイト] [新規サイズ=] [新規バイト];ファイル入力ストリーム フィッシュ=新しいファイル入力ストリーム(bumm)、{timeout、0、1,000、サイズ、「読み取り、0、読み取り、0、サイズ){\f」{tpf;}}} [Ieption] {flow」{flow(interface)>「interface」<<<<<<Data”>「ino>「ino」>。書き込み(<>><<<<“””””””””””””””””””””””””””””””””””””””