[英]Recording sound into bytestream in Android
I want create an app which records a sound into bytestream and it can be listened again. 我想创建一个将声音记录到字节流中的应用程序,然后可以再次收听。 It will not save the recorded audio into a file, rather it will save it into a hardware memory. 它不会将录制的音频保存到文件中,而是会将其保存到硬件存储器中。 And a play option will be there by which the recorded file can be played. 然后将有一个播放选项,可用来播放录制的文件。 Recorded system will be like talking tom: record the audio and play it instantly 录制的系统就像说话的汤姆:录制音频并立即播放
Can anyone provide me a sample code for this functions ? 谁能为我提供此功能的示例代码?
Without saving the audio into a file, you can use the AudioRecord class which lets you read the recorded audio into a byte array. 无需将音频保存到文件中,就可以使用AudioRecord类,该类使您可以将记录的音频读取到字节数组中。
An easier option to code and use would be the MediaRecorder , although it will come with a loss in performance as it does save the audio into a file every time. MediaRecorder是一个更容易编码和使用的选项 ,但由于每次都会将音频保存到文件中,因此会降低性能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.