小编use*_*699的帖子

Android如何使用MediaRecorder录制音频并输出为原始PCM?

我目前使用MediaRecorder录制音频以生成.m4a,.mp4,.acc和.3gp,并使用VisualizerView可视化每个录制的输出数据.

现在我想用PCM做同样的事情.

我尝试使用带有ENCODING_PCM_16BIT输入的MediaRecorder和几种不同的输出组合.但是这些组合都没有产生原始PCM输出.

我的问题是:如何使用MediaRecorder录制并将结果输出为原始PCM?

Java代码:

public String mFileName = null;
private String fileName = null;
private String fileNamePcm = null;

String formattedDate = new SimpleDateFormat("MM-dd-yyyy_HH-mm-ss").format(new Date());
fileName = formattedDate;
fileNamePcm = formattedDate;

MediaRecorder mRecorder = new MediaRecorder();

startRecording() {

    // Test Format 1 - produced AMR_WB file
    mRecorder.setAudioSamplingRate(44100);
    mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
    mRecorder.setOutputFormat(AudioFormat.CHANNEL_OUT_MONO); // produced AMR_WB file.
    mRecorder.setAudioEncoder(AudioFormat.ENCODING_PCM_16BIT);


    // Test Format 2 - produced 3gp file
    mRecorder.setAudioSamplingRate(44100);
    mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
    mRecorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT); // produced 3gp file.
    mRecorder.setAudioEncoder(AudioFormat.ENCODING_PCM_16BIT);


    // Test Format 3 - produced 3gp file …
Run Code Online (Sandbox Code Playgroud)

java android pcm audio-recording android-mediarecorder

7
推荐指数
1
解决办法
1227
查看次数

在协作失败中创建新的Python 3笔记本失败并显示错误消息

我最近开始使用Colaboratory,并且正在尝试创建一个新的笔记本。

但是,当我尝试打开新笔记本(新Python 3笔记本)时,如果失败并显示以下错误消息:

笔记本加载错误加载此笔记本时出错。确保该文件可访问,然后重试。 https://drive.google.com/drive/?action=locate&id=1Hfx8Cl68kYnKZu90U5TADO0XqKsBq_fw&authuser=0 [object Object]错误:[object object] at d(https://colab.research.google.com/v2/external/external_polymer_binary .js?vrz = colab_20180222_085323-RC01_186629092:1135:347)在Object.next(https://colab.research.google.com/v2/external/external/external_polymer_binary.js?vrz=colab_20180222_085323-RC01_186629092:1135:493)在b (https://colab.research.google.com/v2/external/external_polymer_binary.js?vrz=colab_20180222_085323-RC01_186629092:522:42)在

我将“欢迎合作”笔记本的副本保存到了Google云端硬盘。当我尝试打开笔记本驱动器并选择笔记本副本时,它会崩溃,并显示与上面相同的错误消息。

我还能尝试创建一个新笔记本吗?

谢谢

google-colaboratory

5
推荐指数
1
解决办法
3172
查看次数