Method of implementing hearing aid with audiorecord improved by Android

Generally speaking, during Android project development, the recording function can be realized through mediarecorder and audiorecord. Mediarecorder directly saves the microphone data to a file and can directly encode (such as AMR, MP3, etc.), while audiorecord reads the microphone audio stream. This paper uses audiorecord to read the audio stream, audiotrack to play the audio stream, and realizes a simple hearing aid program by "reading and playing" and increasing the volume.

Note here: since the current Android simulator does not support audiorecord, this program needs to be compiled and run on the real machine.

First post the screenshot of the program:

Also note: in this program, the volume adjustment is only the internal volume adjustment of the program. To adjust to the maximum volume, you need to manually set the system volume.

You must apply for a license to use audiorecord. Add this sentence in androidmanifest.xml:

The source code of main.xml is as follows:

The source code of testrecord.java is as follows:

I hope the examples described in this paper have a certain reference value for everyone's Android project development.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>