android錄音文件
① 安卓錄音專家app的錄音文件放在哪個文件夾
軟體數據一般都是存放在Android-data的系統文件夾裡面,你軟體的各個應用軟體在這里,比如游戲數據啥的,你可以找找看,文件夾一般是軟體名字的拼音。
② android手機的錄音存在哪個文件夾里
三星手機若需使用錄音機功能,請操作:應用程序-(Samsung)-錄音機-點擊中間的【紅色圓點】,即可錄音。如需結束錄音,點擊白色方框圖標,系統會自動保存錄音文件。
錄音文件保存在我的文件-Sounds文件夾-語音xxx,格式為M4A或3GA,也可將保存路徑更改為存儲卡:錄音機-菜單鍵-設定-存儲器:存儲卡。
如需退出錄音機,請點擊返回鍵退出即可。
③ 安卓手機的通話錄音保存在哪裡
若使用的是vivo手機,在通話的時候點擊鍵盤上的錄音按鈕即可錄音,錄音文件保存在文件管理--本地文件/所有文件/手機存儲--Record/錄音文件夾中(通話錄音的保存路徑無法修改)。
④ 安卓錄音文件在哪個文件夾
手機內置錄音機可以錄音,還支持通話錄音功能,那安卓錄音文件在哪個文件夾的呢,讓我們一起來看看吧~
安卓錄音文件在哪個文件夾
華為手機錄音文件在CallRecord( record)查看;OPPO手機錄音文件在Recordings文件夾查看;小米手機錄音文件在files文件夾中查看。
華 為手機錄音存儲位置:
1、在錄音機App中查看,進入錄音機App即可直接查看普通錄音和通話錄音數據。
2、在文件管理App中查看
普通錄音:進入文件管理 >瀏覽(分類/本地 ) > 我的手機(存儲卡)> Sounds ( Recordings)查看。
通話錄音:進入文件管理 > 瀏覽(分類/本地 ) > 我的手機(存儲卡)> Sounds > CallRecord( record)查看。
小米手機錄音存儲位置:
小米手機錄音機的默認格式為AAC,由於Google分區存儲特性,Android 11內錄音文件暫時無法直接從文件管理內查看,您可以在APP內查看。
如您需要導出錄音文件,可以連接電腦選擇傳輸文件的方式,從電腦端進入手機的Android/data/com.android.soundrecorder/files路徑內查看或導出錄音。
vivo手機錄音存儲位置:
錄音文件保存在文件管理--本地文件/所有文件/手機存儲/SD卡--「Record/錄音」文件夾中。
OPPO手機錄音存儲位置:
1、錄音完成之後,可以進入「工具 > 錄音 > 右下角三根橫線按鈕」,即可查看和播放保存到手機內的錄音。
2、前往文件管理中查找錄音文件:
(1)ColorOS版本,「文件管理 > 存儲 > (Music) > Recordings文件夾」。
(2)非ColorOS版本,「文件管理 > 存儲 > 我的錄音」。
本文以華為p50&&小米12&&opporeno7為例適用於華為p50pro&&MIUI 13&&coloros 12系統
⑤ Android實現錄音功能
1 Android錄音需要聲明錄音許可權
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
2.錄音文件要寫到文件夾中,創建文件夾,在Application的onCreate方法中創建文件夾
@Override
public void onCreate() {
super.onCreate();
CrashHandler mCrashHandler = CrashHandler.getInstance();
mCrashHandler.init(getApplicationContext(), getClass());
initFile();
}
private void initFile() {
//錄音文件
File audioFile = new File(Constant.UrlAudio);
if (!audioFile.exists()) {
audioFile.mkdirs();
} else if (!audioFile.isDirectory()) {
audioFile.delete();
audioFile.mkdirs();
}
//拍攝圖片文件
File imageFile = new File(Constant.UrlImage);
if (!imageFile.exists()) {
imageFile.mkdirs();
} else if (!imageFile.isDirectory()) {
imageFile.delete();
imageFile.mkdirs();
}
}
Constant.UrlImage是個靜態的文件路徑
//錄音文件
public static String UrlAudio = FileUtil.getSdcardPathOnSys()+"/EhmFile/media/audio/";
3.在activity中開始錄音
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.media.MediaRecorder;
import android.text.format.DateFormat;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import java.io.File;
import java.io.IOException;
import java.util.Calendar;
import java.util.Locale;
public class Record2Activity extends AppCompatActivity {
// 錄音界面相關
Button btnStart;
Button btnStop;
TextView textTime;
// 錄音功能相關
MediaRecorder mMediaRecorder; // MediaRecorder 實例
boolean isRecording; // 錄音狀態
String fileName; // 錄音文件的名稱
String filePath; // 錄音文件存儲路徑
Thread timeThread; // 記錄錄音時長的線程
int timeCount; // 錄音時長 計數
final int TIME_COUNT = 0x101;
// 錄音文件存放目錄
final String audioSaveDir = Environment.getExternalStorageDirectory().getAbsolutePath() + "/audiodemo/";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_record2);
btnStart = (Button) findViewById(R.id.btn_start);
btnStop = (Button) findViewById(R.id.btn_stop);
textTime = (TextView) findViewById(R.id.text_time);
btnStart.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// 開始錄音
btnStart.setEnabled(false);
btnStop.setEnabled(true);
startRecord();
isRecording = true;
// 初始化錄音時長記錄
timeThread = new Thread(new Runnable() {
@Override
public void run() {
countTime();
}
});
timeThread.start();
}
});
btnStop.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// 停止錄音
btnStart.setEnabled(true);
btnStop.setEnabled(false);
stopRecord();
isRecording = false;
}
});
}
// 記錄錄音時長
private void countTime() {
while (isRecording) {
Log.d("mediaRe","正在錄音");
timeCount++;
Message msg = Message.obtain();
msg.what = TIME_COUNT;
msg.obj = timeCount;
myHandler.sendMessage(msg);
try {
timeThread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
Log.d("mediaRec", "結束錄音");
timeCount = 0;
Message msg = Message.obtain();
msg.what = TIME_COUNT;
msg.obj = timeCount;
myHandler.sendMessage(msg);
}
/**
* 開始錄音 使用amr格式
* 錄音文件
*
* @return
*/
public void startRecord() {
// 開始錄音
/* ①Initial:實例化MediaRecorder對象 */
if (mMediaRecorder == null)
mMediaRecorder = new MediaRecorder();
try {
/* ②setAudioSource/setVedioSource */
mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);// 設置麥克風
/*
* ②設置輸出文件的格式:THREE_GPP/MPEG-4/RAW_AMR/Default THREE_GPP(3gp格式
* ,H263視頻/ARM音頻編碼)、MPEG-4、RAW_AMR(只支持音頻且音頻編碼要求為AMR_NB)
*/
mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
/* ②設置音頻文件的編碼:AAC/AMR_NB/AMR_MB/Default 聲音的(波形)的采樣 */
mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
fileName = DateFormat.format("yyyyMMdd_HHmmss", Calendar.getInstance(Locale.CHINA)) + ".m4a";
//注意文件夾要創建之後才能使用
filePath = Constant.UrlAudio + fileName;
/* ③准備 */
mMediaRecorder.setOutputFile(filePath);
mMediaRecorder.prepare();
/* ④開始 */
mMediaRecorder.start();
} catch (IllegalStateException e) {
Log.i("mediaEr", "call startAmr(File mRecAudioFile) failed!" + e.getMessage());
} catch (IOException e) {
e.printStackTrace();
Log.i("mediaEr", "call startAmr(File mRecAudioFile) failed!" + e.getMessage());
}
}
/**
* 停止錄音
*/
public void stopRecord() {
//有一些網友反應在5.0以上在調用stop的時候會報錯,翻閱了一下谷歌文檔發現上面確實寫的有可能會報錯的情況,捕獲異常清理一下就行了,感謝大家反饋!
try {
mMediaRecorder.stop();
mMediaRecorder.release();
mMediaRecorder = null;
filePath = "";
} catch (RuntimeException e) {
Log.e("mediaR", e.toString());
mMediaRecorder.reset();
mMediaRecorder.release();
mMediaRecorder = null;
File file = new File(filePath);
if (file.exists())
file.delete();
filePath = "";
}
}
// 格式化 錄音時長為 秒
public static String FormatMiss(int miss) {
return "" + miss;
}
Handler myHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case TIME_COUNT:
int count = (int) msg.obj;
Log.d("meidaRe","count == " + count);
textTime.setText(FormatMiss(count));
break;
}
}
};
@Override
protected void onDestroy() {
super.onDestroy();
myHandler.removeCallbacksAndMessages(null);
}
}
布局文件很簡單
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Record2Activity">
<Button
android:id="@+id/btn_stop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="結束"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/btn_start"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/btn_start"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="開始"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/btn_stop"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/text_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="11dp"
android:layout_marginTop="47dp"
android:text="時間"
app:layout_constraintStart_toStartOf="@+id/btn_start"
app:layout_constraintTop_toBottomOf="@+id/btn_start" />
</androidx.constraintlayout.widget.ConstraintLayout>
這樣就可以使用錄音功能了