Convert Figma logo to code with AI

Cleveroad logoWaveInApp

Live Audio Equalizer with wave effect

1,786
320
1,786
9

Top Related Projects

4,381

An Android text view with scrolling text change animation

1,850

(DEPRECATED) Android experiment showing a sinking TextView

:octocat: 📃 FoldingCell is a material design expanding content cell inspired by folding paper material made by @Ramotion

Render After Effects animations natively on Android and iOS, Web, and React Native

An easy, flexible way to add a shimmering effect to any view in an Android app.

Quick Overview

WaveInApp is an Android library that provides a customizable audio visualization component. It displays audio waveforms in real-time, making it suitable for voice recording, audio playback, or any application that requires visual representation of audio signals.

Pros

  • Easy integration into Android projects
  • Highly customizable appearance and behavior
  • Smooth animation and real-time updates
  • Supports both recording and playback visualization

Cons

  • Limited to Android platform
  • May require additional setup for audio processing
  • Documentation could be more comprehensive
  • No recent updates (last commit was in 2017)

Code Examples

  1. Basic setup in XML layout:
<com.cleveroad.audiovisualization.AudioVisualization
    android:id="@+id/visualizer"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>
  1. Initializing the visualizer in Java:
AudioVisualization audioVisualization = findViewById(R.id.visualizer);
audioVisualization.linkTo(audioRecorder);
  1. Customizing the visualizer appearance:
DbmHandler dbmHandler = new DbmHandler();
audioVisualization.addDbmHandler(dbmHandler);
audioVisualization.setWaveColor(Color.parseColor("#FF4081"));
audioVisualization.setStrokeWidth(5);
  1. Starting and stopping visualization:
// Start visualization
audioVisualization.startVisualization();

// Stop visualization
audioVisualization.stopVisualization();

Getting Started

  1. Add the JitPack repository to your project's build.gradle:
allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
  1. Add the dependency to your app's build.gradle:
dependencies {
    implementation 'com.github.Cleveroad:WaveInApp:1.0.3'
}
  1. Add the AudioVisualization view to your layout XML:
<com.cleveroad.audiovisualization.AudioVisualization
    android:id="@+id/visualizer"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>
  1. Initialize and use the visualizer in your activity or fragment:
AudioVisualization audioVisualization = findViewById(R.id.visualizer);
audioVisualization.linkTo(yourAudioSource);
audioVisualization.startVisualization();

Competitor Comparisons

4,381

An Android text view with scrolling text change animation

Pros of ticker

  • More versatile, supporting various text animations beyond just numeric values
  • Smaller library size, focusing on efficient text animations
  • Better performance for rapid updates and transitions

Cons of ticker

  • Limited to text-based animations, lacking visual elements like waves
  • Less visually striking compared to WaveInApp's graphical approach
  • May require more custom styling to achieve a unique look

Code Comparison

WaveInApp:

waveHelper = new WaveHelper(waveView);
waveView.setShapeType(WaveView.ShapeType.CIRCLE);
waveView.setWaveColor(Color.parseColor("#80D8FF"));
waveHelper.start();

ticker:

tickerView.setCharacterLists(TickerUtils.provideNumberList());
tickerView.setText("1234");
tickerView.setAnimationDuration(500);
tickerView.setAnimationInterpolator(new OvershootInterpolator());

Summary

While WaveInApp offers visually appealing wave animations, ticker provides more efficient and versatile text-based animations. WaveInApp is better suited for graphical representations, while ticker excels in displaying changing text or numerical values with smooth transitions. The choice between the two depends on the specific requirements of the project and the desired visual effect.

1,850

(DEPRECATED) Android experiment showing a sinking TextView

Pros of Titanic

  • Simpler implementation with fewer dependencies
  • Lightweight and easy to integrate into existing projects
  • Focuses on a single animation effect, making it more specialized

Cons of Titanic

  • Limited customization options compared to WaveInApp
  • Less actively maintained (last update was several years ago)
  • Fewer features and animation styles available

Code Comparison

Titanic:

Titanic titanic = new Titanic();
TitanicTextView tv = (TitanicTextView) findViewById(R.id.my_text_view);
titanic.start(tv);

WaveInApp:

WaveHelper mWaveHelper = new WaveHelper(waveView);
waveView.setShapeType(WaveView.ShapeType.CIRCLE);
waveView.setWaveColor(Color.parseColor("#80D8FF"));
mWaveHelper.start();

Both libraries offer simple implementation, but WaveInApp provides more customization options and a wider range of animation styles. Titanic focuses specifically on text animation, while WaveInApp can be applied to various UI elements. WaveInApp is more actively maintained and offers more features, but Titanic may be preferred for simpler projects or when a lightweight solution is needed.

:octocat: 📃 FoldingCell is a material design expanding content cell inspired by folding paper material made by @Ramotion

Pros of folding-cell-android

  • More visually appealing and interactive UI component
  • Provides a unique folding animation for expanding/collapsing content
  • Offers customizable content for both folded and unfolded states

Cons of folding-cell-android

  • Limited to a specific UI pattern, less versatile than WaveInApp
  • May require more complex implementation for custom content
  • Potentially higher performance impact due to animation complexity

Code Comparison

folding-cell-android:

val foldingCell = findViewById<FoldingCell>(R.id.folding_cell)
foldingCell.setOnClickListener {
    foldingCell.toggle(false)
}

WaveInApp:

WaveHelper mWaveHelper = new WaveHelper(mWaveView);
mWaveHelper.start();
mWaveView.setWaveColor(
    Color.parseColor("#28f16a7a"),
    Color.parseColor("#3cf16a7a")
);

The folding-cell-android code demonstrates setting up a click listener for the folding animation, while WaveInApp shows initializing and customizing the wave animation. WaveInApp appears to have a simpler API for basic setup and customization, whereas folding-cell-android might require more complex content management for its folded and unfolded states.

Render After Effects animations natively on Android and iOS, Web, and React Native

Pros of lottie-android

  • Supports complex animations created in Adobe After Effects
  • Extensive documentation and community support
  • Cross-platform compatibility (iOS, Android, Web)

Cons of lottie-android

  • Larger file size and potentially higher memory usage
  • Steeper learning curve for creating custom animations

Code Comparison

WaveInApp:

WaveHelper mWaveHelper = new WaveHelper(mWaveView);
mWaveHelper.start();

lottie-android:

LottieAnimationView animationView = findViewById(R.id.animation_view);
animationView.setAnimation(R.raw.animation);
animationView.playAnimation();

Key Differences

  • WaveInApp focuses specifically on wave animations, while lottie-android supports a wide range of animation types
  • lottie-android requires animations to be created in Adobe After Effects, whereas WaveInApp uses built-in wave generation
  • WaveInApp offers more customization options for wave properties directly in code

Use Cases

  • WaveInApp: Ideal for simple wave animations in audio visualizers or loading screens
  • lottie-android: Better suited for complex, custom animations in various app elements

Community and Support

  • lottie-android has a larger community and more frequent updates
  • WaveInApp has fewer contributors but is still actively maintained

Performance

  • WaveInApp may have better performance for simple wave animations
  • lottie-android can handle more complex animations but may require more resources

An easy, flexible way to add a shimmering effect to any view in an Android app.

Pros of shimmer-android

  • More widely adopted and battle-tested in production environments
  • Simpler implementation for basic shimmer effects
  • Smaller library size, potentially reducing app bloat

Cons of shimmer-android

  • Limited to shimmer effects only, less versatile than WaveInApp
  • Less customizable in terms of animation styles and patterns
  • No longer actively maintained by Facebook

Code Comparison

WaveInApp:

WaveHelper mWaveHelper = new WaveHelper(waveView);
waveView.setShapeType(WaveView.ShapeType.CIRCLE);
waveView.setWaveColor(
    Color.parseColor("#28f16d7a"),
    Color.parseColor("#3cf16d7a"));
mWaveHelper.start();

shimmer-android:

ShimmerFrameLayout container = (ShimmerFrameLayout) findViewById(R.id.shimmer_view_container);
container.setDuration(1500);
container.setRepeatCount(ValueAnimator.INFINITE);
container.setRepeatMode(ValueAnimator.RESTART);
container.startShimmer();

Both libraries offer easy-to-use APIs for implementing their respective effects. WaveInApp provides more customization options for wave animations, while shimmer-android focuses solely on shimmer effects with a simpler setup. WaveInApp is actively maintained and offers a wider range of visual effects, making it more versatile for developers seeking diverse animation options. However, shimmer-android's simplicity and established track record may be preferable for projects requiring only basic shimmer functionality.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

WaveInApp Awesome

Header image

Welcome to WaveInApp - Audio Visualization View with wave effect.

Our library can take audio from any source (audio players, streams, voice input) and animate it with high frame rate. Cool animation, designed specially for the library, responds to sound vibrations. The animation becomes intense when music plays, and once it is paused or stopped – waves calm down.

The library is a part of implementation of music player.

Demo image

Great visualization can spruce up any app, especially audio player. We suggest you smart and good-looking Audio Visualization View for your Android app. You can read about all the advantages this library has and find out how to implement it into your app in our blog post: Case Study: Audio Visualization View For Android by Cleveroad

Article image

Awesome

Setup and usage

To include this library to your project add dependency in build.gradle file:

    dependencies {
        implementation 'com.cleveroad:audiovisualization:1.0.1'
    }

Audio visualization view uses OpenGL ES 2.0 for drawing waves. So you need to include this line in your manifest:

    <uses-feature android:glEsVersion="0x00020000" android:required="true" />
Using VisualizerDbmHandler

All functionality of this handler built upon Visualizer object, so you also need to include this permissions in your manifest:

    <uses-permission android:name="android.permission.RECORD_AUDIO"/>
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
Using SpeechRecognizerDbmHandler

All functionality of this handler built upon SpeechRecognizer object, so you also need to include this permissions in your manifest:

    <uses-permission android:name="android.permission.RECORD_AUDIO"/>

You must be very careful with new Android M permissions flow. Make sure you have all necessary permissions before using GLAudioVisualizationView.

There are two ways to include GLAudioVisualizationView in your layout: directly in XML layout file or using builder in Java code.

Via XML:

    <com.cleveroad.audiovisualization.GLAudioVisualizationView
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/visualizer_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:av_bubblesSize="@dimen/bubble_size"
        app:av_bubblesRandomizeSizes="true"
        app:av_wavesHeight="@dimen/wave_height"
        app:av_wavesFooterHeight="@dimen/footer_height"
        app:av_wavesCount="7"
        app:av_layersCount="4"
        app:av_backgroundColor="@color/av_color_bg"
        app:av_bubblesPerLayer="16"
        />

Via Java code:

    new GLAudioVisualizationView.Builder(getContext())
        .setBubblesSize(R.dimen.bubble_size)
        .setBubblesRandomizeSize(true)
        .setWavesHeight(R.dimen.wave_height)
        .setWavesFooterHeight(R.dimen.footer_height)
        .setWavesCount(7)
        .setLayersCount(4)
        .setBackgroundColorRes(R.color.av_color_bg)
        .setLayerColors(R.array.av_colors)
        .setBubblesPerLayer(16)
        .build();

GLAudioVisualizationView implements AudioVisualization interface. If you don't need all GLSurfaceView's public methods, you can simply cast your view to AudioVisualization interface and use it.

    private AudioVisualization audioVisualization;
    
    ...
    
    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        // you can extract AudioVisualization interface for simplifying things
        audioVisualization = (AudioVisualization) glAudioVisualizationView;
    }

    ...

To connect audio visualization view to audio output you can use linkTo(DbmHandler) method. See DbmHandler.Factory class for the list of available handler implementations.

    // set speech recognizer handler
    SpeechRecognizerDbmHandler speechRecHandler = DbmHandler.Factory.newSpeechRecognizerHandler(context);
    speechRecHandler.innerRecognitionListener(...);
    audioVisualization.linkTo(speechRecHandler);
    
    // set audio visualization handler. This will REPLACE previously set speech recognizer handler
    VisualizerDbmHandler vizualizerHandler = DbmHandler.Factory.newVisualizerHandler(getContext(), 0);
    audioVisualization.linkTo(vizualizerHandler);

You must always call onPause method to pause visualization and stop wasting CPU resources for computations in vain. As soon as your view appears in sight of user, call onResume.

    @Override
    public void onResume() {
        super.onResume();
        audioVisualization.onResume();
    }
    
    @Override
    public void onPause() {
        audioVisualization.onPause();
        super.onPause();
    }

When user leaves screen with audio visualization view, don't forget to free resources and call release() method.

    @Override
    public void onDestroyView() {
        audioVisualization.release();
        super.onDestroyView();
    }

Live wallpapers

You can use our Audio Visualization View as a live wallpaper. Just create your own WallpaperService. Method onCreateEngine() should return your own Engine's implementation, in which you must override the following methods:

  • void onCreate(SurfaceHolder surfaceHolder) – here create instances of DbmHandler, GLAudioVisualizationView.Builder (see example below) and GLAudioVisualizationView.AudioVisualizationRenderer in which you must set Engine's surface holder and two previous instances via constructor(GLAudioVisualizationView.Builder) and handler() methods;
  • void onVisibilityChanged(final boolean visible) – here you must call onResume() methods for audioVisualizationView and dbmHandler instances if visible parameter is true, otherwise – call onPause();
  • void onDestroy() – just call release() for dbmHandler and onDestroy() for audioVisualizationView instances Check JavaDoc of this methods for more info.
    public class AudioVisualizationWallpaperService extends WallpaperService {
        @Override
        public Engine onCreateEngine() {
            return new WallpaperEngine();
        }
        
        private class WallpaperEngine extends Engine {
        
        private WallpaperGLSurfaceView audioVisualizationView;
        private DbmHandler dbmHandler;
        private GLAudioVisualizationView.AudioVisualizationRenderer renderer;
        ...
            @Override
            public void onCreate(SurfaceHolder surfaceHolder) {
                AudioVisualizationWallpaperService context = AudioVisualizationWallpaperService.this;
                audioVisualizationView = new WallpaperGLSurfaceView(context);
                dbmHandler = DbmHandler.Factory.newVisualizerHandler(context, 0);
                ...
                GLAudioVisualizationView.Builder builder = new GLAudioVisualizationView.Builder(context)
                        //... set your settings here (see builder example below);
                renderer = new GLAudioVisualizationView.RendererBuilder(builder)
                        .glSurfaceView(audioVisualizationView)
                        .handler(dbmHandler)
                        .build();
                audioVisualizationView.setEGLContextClientVersion(2);
                audioVisualizationView.setRenderer(renderer);
            }
            @Override
            public void onVisibilityChanged(final boolean visible) {
                //Please follow the next order of methods call!
                if (visible) {
                    audioVisualizationView.onResume();
                    dbmHandler.onResume();
                } else {
                    dbmHandler.onPause();
                    audioVisualizationView.onPause();
                }
            }
            @Override
            public void onDestroy() {
                dbmHandler.release();
                audioVisualizationView.onDestroy();
            }
         

See uploaded AudioVisualizationWallpaperService example.

Implementing your own DbmHandler

To implement you own data conversion handler, just extend your class from DbmHandler class and implement onDataReceivedImpl(T object, int layersCount, float[] outDbmValues, float[] outAmpValues) method where:

  • object - your custom data type
  • layersCount - count of layers you passed in Builder.
  • outDbmValues - array with size equals to layersCount. You should fill it with normalized dBm values for layer in range [0..1].
  • outAmpValues - array with size equals to layersCount. You should fill it with amplitude values for layer. Check JavaDoc of this method for more info.

Then call onDataReceived(T object) method to visualize your data.

Your handler also will receive onResume(), onPause() and release() events from audio visualization view.

Migrations

See all migration manuals.

Changelog

See changelog history.

Troubleshooting

Visualization

If you have some issues with visualization (especially on Samsung Galaxy S or HTC devices) make sure you read this Github issue.

Live wallpapers

  • If you have some issues with WaveInApp live wallpapers on Android 6.0 (and later) make sure that all next permissions are granted: android.permission.RECORD_AUDIO, android.permission.MODIFY_AUDIO_SETTINGS.
  • If you run a wallpaper selection screen when the permissions was not granted, the wallpaper will not be appear. You must open settings screen and allow all permissions. If the wallpaper is not yet appeared, just restart the wallpaper selection screen.

Support

If you have any other questions regarding the use of this library, please contact us for support at info@cleveroad.com (email subject: "Android visualization view. Support request.")

License


The MIT License (MIT)

Copyright (c) 2016 Cleveroad Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.