录音在android系统 [英] Recording sound in android

查看:215
本文介绍了录音在android系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想知道如何录制声音的特定时间内,如果没有它保存到一个文件 - 拿着例如字节流。此外,如果可能,使它看起来像一个AMR文件。我试着搜索谷歌,并且还写了一些code自己,但没有成功。如果你可以链接我解释如何做到这一点,还是举个例子一个页面,那将是非常不错的你:)

感谢。


解决方案

  MediaRecorder记录=新MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR);
recorder.setOutputFile(文件名);
recorder.setAudioEn codeR(MediaRecorder.AudioEn coder.AMR_NB);。录音机prepare();
recorder.start();

我不知道,如果你可以跳过setOutputFile步骤,并保持记录在内存中(可能不是)。


I'd like to know how to record sound for a specific amount of time, without saving it to a file - holding in a byte stream for example. Also, if possible, make it look like an AMR file. I've tried to search google, and also wrote some code myself, but had no success. If you can link me to a page that explains how to do so, or give an example, it would be very nice of you :)

Thanks.

解决方案

MediaRecorder recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR);
recorder.setOutputFile(fileName);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);

recorder.prepare();
recorder.start();

I'm not sure if you can skip the setOutputFile step and keep the recording in memory (probably not).

这篇关于录音在android系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆