AudioRecordView — Real-time audio visualizer for android
I am pleased to present my work, which I did about three years ago. As I’ve faced with the problems of drawing real waveforms while recording sound, so I’ve planned to create something to provide the simplest way to do it.
At that time I was looking for a suitable library for my task and I found libraries that draw amplitudes in real-time, but almost every library had two big problems: a fixed interface and not flexible for use. Finally, I decided to write my own flexible custom view.
What are the advantages of this library?
Benefits:
- The library is easy to use
- Small and clear code
- Support to use in both: code and XML
- Active support and improvements
What do we mean when we say flexible? You can
- Choose one of two types of alignment mode: “bottom” and “center”
- Change the color of the chunks
- Set minimum/maximum height of chunks
- Change the width of chunks
- Change space between two chunks.
- Change the drawing direction (right to left /left to right)
- Set the mode of rounded corners
- Enable/disable “Soft Transition” mode
- Control drawing speed
Setup AudioRecordView
In your application project (or root project if you prefer) build.gradle
, make sure you have jcenter
repository added:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add AudioRecordView SDK dependency to your app-levelbuild.gradle
:
implementation'com.github.Armen101:AudioRecordView:latest_version'
//for example
//implementation'com.github.Armen101:AudioRecordView:1.0.5'
After that, in your code (perhaps MainActivity
class), find or create AudioRecordView object programmatically
In XML
And then, in any kind of timer, get the max amplitude from MediaRecorder and just call the AudioRecordView update function
Now, you have the simplest use of AudioRecordView
Note: AudioRecordView SDK supports Android API 16 or later.
License: Apache License, Version 2.0
Thanks for your attention!
References
If you have questions until now, you can see more in the sample project in Github.