android支持多种音频格式、编码、解码以及录音格式
- AAC(Advance Audio Coding):高级音频编码、编解码器,对应的是 .m4a(audio/m4a) .3gp(audio/3gpp)文件
- MP3(MPEG--1 Layer 3) 对应的是.p3(audio/mp3)
- AMR (Adaptive Multi-Rte) 自适应多速率编解码器 对应的是.3gp(audio/3gpp) .amr(audio/amr)文件 不利于处理音乐
- PCM (Pulse Code Modulation) 脉冲编码调制 是一个未压缩的音频文件数据表示一段音频随时间变化而变化的振幅 通常用于WAVE/WAV(波形音频文件)文件.wav(audio/x-wav)
调用android内置的音频播放器
Intent intent=new Intent(Intent.ACTION_VIEW); String path="文件的路径" intent.setDataAndType(Uri.fromFile(path),MIME); MIME是上述几种格式对应的文件(audio/..) startActivity(intent);
例子:
Intent intent=new Intent(Intent.ACTION_VIEW);
File sdPath= Environment.getExternalStorageDirectory();
File audioFlie=new File(sdPath.getPath()+File.separator+"output_audios.wav");
intent.setDataAndType(Uri.fromFile(audioFlie),"audio/x-wav");
startActivity(intent);