Recently, we have been working on an Android project in which we needed audio data visualisation. After doing some research, I found an open source project called Ringdroid, which among many other features offered great waveform visualisation. As I didn’t want to reinvent the wheel and Ringdroid perfectly suited my needs, I decided to adapt the code to our project. However, I found it to be quite memory inefficient, especially while dealing with large audio files. I spent some time analysing and refactoring code and in the result I managed to reduce memory usage by more than 50%. The major change was to completely replace the drawing algorithm. Instead of keeping cached audio values for all zoom levels, I dynamically draw waveform using input values and a scaling factor. Moreover, internal audio representation used by Ringdroid has been cleaned. There is still room for improvement, but the I released the modified code as a new project, which is called Waveform Android. To make it more reusable, the waveform visualization is extracted to a Fragment.
You can find the code here: https://github.com/Semantive/waveform-android. I prepared an example to get you started, you just need to extend WaveformFragment and provide a path to an audio file.
Key features:
- reusable fragment
- memory optimized
- waveform visualisation of audio file
- integrated player
- 4 zoom levels
- easy to customize
Thanks for sharing you work!
You’re welcome
its amazing thanks for sharing
You’re welcome
thanks, can you give me the steps involved in importing this project into mine. I appreciate your help.
You can find details on the github page https://github.com/semantive/waveform-android
Nice work! By the way, if you would like to make your music player more awesome, look at this Live Equalizer with wave effect. We released the code in GitHub to make it useful for everyone! Have a look: https://github.com/Cleveroad/CRAudioVisualizationView.
Thanks, will check it out
I have imported this project. could you please tell me where I need to give the path to my wave file. It is throwing FILE_NOT_FOUND exceptions. please help me. Thanks
You probably need to use an absolute path like /storage/emulated/0/Music/your_file, but it depends on where you store your audio file