Takes the input from the Android MediaPlayer and displays visualizations, like in iTunes or WinAmp

Overview

Android Visualizer

A View subclass that Takes the input from the Android MediaPlayer and displays visualizations, like in iTunes or WinAmp

The Visualizer is designed to be modular, so it is very easy to combine visualizations to create more complex effects.

Examples

It's easy to create your own custom visualizations or combine/edit existing ones. Below are a few examples:

A pair of frequency distributions.


This is an example which uses the FFT data rather than the raw audio waveform

Line visualization


Draws the audio waveform on screen, pulsing on prominent beats

Circle visualization


Draws the audio waveform in a circle, with the radius changing over time

Combined visualization


A combination of all the above

License

Released under the MIT license.

Comments
  • java.io.IOException: setDataSourceFD failed

    java.io.IOException: setDataSourceFD failed

    I downloaded the code for "android-visualizer" and I tried to get it to work, but I got the error that I pasted below. What should I to get this to work?

    My company is working on an Android visualizer with OpenGL 3d effects and we would like to reuse the code from "android-visualizer" if possible.


    01-02 10:06:41.282: D/dalvikvm(5376): Late-enabling CheckJNI 01-02 10:06:41.306: I/dalvikvm(5376): Turning on JNI app bug workarounds for target SDK version 9... 01-02 10:06:41.813: E/MediaPlayer(5376): Unable to to create media player 01-02 10:06:41.915: D/MediaPlayer(5376): create failed: 01-02 10:06:41.915: D/MediaPlayer(5376): java.io.IOException: setDataSourceFD failed.: status=0x80000000 01-02 10:06:41.915: D/MediaPlayer(5376): at android.media.MediaPlayer.setDataSource(Native Method) 01-02 10:06:41.915: D/MediaPlayer(5376): at android.media.MediaPlayer.create(MediaPlayer.java:740) 01-02 10:06:41.915: D/MediaPlayer(5376): at com.pheelicks.app.MainActivity.init(MainActivity.java:59) 01-02 10:06:41.915: D/MediaPlayer(5376): at com.pheelicks.app.MainActivity.onResume(MainActivity.java:39) 01-02 10:06:41.915: D/MediaPlayer(5376): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1158) 01-02 10:06:41.915: D/MediaPlayer(5376): at android.app.Activity.performResume(Activity.java:4539) 01-02 10:06:41.915: D/MediaPlayer(5376): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2448) 01-02 10:06:41.915: D/MediaPlayer(5376): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2486) 01-02 10:06:41.915: D/MediaPlayer(5376): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2000) 01-02 10:06:41.915: D/MediaPlayer(5376): at android.app.ActivityThread.access$600(ActivityThread.java:128) 01-02 10:06:41.915: D/MediaPlayer(5376): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161) 01-02 10:06:41.915: D/MediaPlayer(5376): at android.os.Handler.dispatchMessage(Handler.java:99) 01-02 10:06:41.915: D/MediaPlayer(5376): at android.os.Looper.loop(Looper.java:137) 01-02 10:06:41.915: D/MediaPlayer(5376): at android.app.ActivityThread.main(ActivityThread.java:4514) 01-02 10:06:41.915: D/MediaPlayer(5376): at java.lang.reflect.Method.invokeNative(Native Method) 01-02 10:06:41.915: D/MediaPlayer(5376): at java.lang.reflect.Method.invoke(Method.java:511) 01-02 10:06:41.915: D/MediaPlayer(5376): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790) 01-02 10:06:41.915: D/MediaPlayer(5376): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557) 01-02 10:06:41.915: D/MediaPlayer(5376): at dalvik.system.NativeStart.main(Native Method) 01-02 10:06:41.915: D/AndroidRuntime(5376): Shutting down VM 01-02 10:06:41.915: W/dalvikvm(5376): threadid=1: thread exiting with uncaught exception (group=0x40bcf1f8) 01-02 10:06:41.915: E/AndroidRuntime(5376): FATAL EXCEPTION: main 01-02 10:06:41.915: E/AndroidRuntime(5376): java.lang.RuntimeException: Unable to resume activity {com.pheelicks.visualizer/com.pheelicks.app.MainActivity}: java.lang.NullPointerException 01-02 10:06:41.915: E/AndroidRuntime(5376): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2458) 01-02 10:06:41.915: E/AndroidRuntime(5376): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2486) 01-02 10:06:41.915: E/AndroidRuntime(5376): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2000) 01-02 10:06:41.915: E/AndroidRuntime(5376): at android.app.ActivityThread.access$600(ActivityThread.java:128) 01-02 10:06:41.915: E/AndroidRuntime(5376): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161) 01-02 10:06:41.915: E/AndroidRuntime(5376): at android.os.Handler.dispatchMessage(Handler.java:99) 01-02 10:06:41.915: E/AndroidRuntime(5376): at android.os.Looper.loop(Looper.java:137) 01-02 10:06:41.915: E/AndroidRuntime(5376): at android.app.ActivityThread.main(ActivityThread.java:4514) 01-02 10:06:41.915: E/AndroidRuntime(5376): at java.lang.reflect.Method.invokeNative(Native Method) 01-02 10:06:41.915: E/AndroidRuntime(5376): at java.lang.reflect.Method.invoke(Method.java:511) 01-02 10:06:41.915: E/AndroidRuntime(5376): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790) 01-02 10:06:41.915: E/AndroidRuntime(5376): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557) 01-02 10:06:41.915: E/AndroidRuntime(5376): at dalvik.system.NativeStart.main(Native Method) 01-02 10:06:41.915: E/AndroidRuntime(5376): Caused by: java.lang.NullPointerException 01-02 10:06:41.915: E/AndroidRuntime(5376): at com.pheelicks.app.MainActivity.init(MainActivity.java:60) 01-02 10:06:41.915: E/AndroidRuntime(5376): at com.pheelicks.app.MainActivity.onResume(MainActivity.java:39) 01-02 10:06:41.915: E/AndroidRuntime(5376): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1158) 01-02 10:06:41.915: E/AndroidRuntime(5376): at android.app.Activity.performResume(Activity.java:4539) 01-02 10:06:41.915: E/AndroidRuntime(5376): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2448) 01-02 10:06:41.915: E/AndroidRuntime(5376): ... 12 more

    opened by mobilevisuals 28
  • How to change color of every bar in bargraphrender

    How to change color of every bar in bargraphrender

    hey guys, Can anybody please tell me how can i change color of every bar or group of bar into bargraphrender method? I am new to android i dont know much about canvas and rendering. please can you help me to change color of each bar in bar visualizer. like this IMG_0515 visualizer101outofthebox

    opened by swapniladsure 26
  • Magnitude calculation treating unsigned 8-bits incorrectly

    Magnitude calculation treating unsigned 8-bits incorrectly

    The Visualizer documentation says that the returned bytes in getFFT() are unsigned 8-bit numbers. Shouldn't rfk and ifk be converted to positive Java integers before using them like this, or am I missing something?

    int rfk = data.bytes[mDivisions * i] & 0xff;
    int ifk = data.bytes[mDivisions * i + 1] & 0xff;
    
    opened by cypherdare 3
  • Running in Marshmellow crashs app

    Running in Marshmellow crashs app

    headline says all.

    Cheers!

    Rainer

    This error log:

    04-20 18:38:53.406  9750 21279 E         : Request requires android.permission.MODIFY_AUDIO_SETTINGS
    04-20 18:38:53.406 24553 24553 E AudioEffect: set(): AudioFlinger could not create effect, status: -1
    04-20 18:38:53.406 24553 24553 E visualizers-JNI: Visualizer initCheck failed -3
    04-20 18:38:53.406 24553 24553 E Visualizer-JAVA: Error code -3 when initializing Visualizer.
    04-20 18:38:53.407 24553 24553 D AndroidRuntime: Shutting down VM
    04-20 18:38:53.409 24553 24553 E AndroidRuntime: FATAL EXCEPTION: main
    04-20 18:38:53.409 24553 24553 E AndroidRuntime: Process: de.appwerft.hoerdat, PID: 24553
    04-20 18:38:53.409 24553 24553 E AndroidRuntime: java.lang.RuntimeException: Cannot initialize Visualizer engine, error: -3
    

    This permission is in manifest: android.permission.MODIFY_AUDIO_SETTINGS

    opened by AppWerft 2
  • Added asynchronous sound and graphics threads.

    Added asynchronous sound and graphics threads.

    Had some time and I just did some audio/visual multithreading stuff in a private project, so I wanted to give yours a big performance boost.

    The basis of it is sharing sound frames (the captured samples) via a threadsafe queue, in this case a LIFO stack called a "Deque".

    The sound sampler runs as a repeating handler and produces frames for the stack. The graphics thread is standard for a surfaceView, and consumes frames from the stack.

    Runs yah, about 10 times faster and it is very smooth. Also since the sound sampling is constant the waveform is much more defined and not jerking all over the place.

    Tweaked the UI to make the buttons a little bigger. Tweaked the Line and Bar renderer a bit. Added a frames/second counter

    I have a test.mp3 that contains pure tones for calibration activities. Can't upload it via the web interface, but your existing test file should be fine.

    You could further improve this by adding some openGL shaders instead of drawing with canvas. Right now it rocks compared to the previous synchronized version.

    opened by dcerisano 2
  • Implement Tunnel Player workaround code

    Implement Tunnel Player workaround code

    This commit fixes the issue; "Visualization does not work on the new Galaxy devices" https://github.com/felixpalmer/android-visualizer/issues/5

    Original workaround demonstration code: https://github.com/h6ah4i/tunnel_player_workaround)

    opened by h6ah4i 1
  • Issue with NEXUS5 / NEXUS6P

    Issue with NEXUS5 / NEXUS6P

    Hi Felix, as reported you lib runs now as Titanium module.

    Problem: on NEXU5 and NEXUS6P it only works if the audio signal goes to bluetooth or headphone. If I use the loudspeaker, then I see flatline. I'm using audioSessioID 0.

    Edit: if I plugg in the headset in NEXUS5 then it works, if I now plugg out the visualisation keeps, on NEXUS6P after outplugging the visualtion disappears

    Cheers!

    opened by AppWerft 0
  • Didn't find your mail

    Didn't find your mail

    I have released my music visualizer app "Astral 3d worlds", which is inspired by your open source project. I can send you the paid version for free if you want to see how it looks like. This is not an issue and you can close it anytime. I didn't find your mail, so that is why I contacted you this way.

    Your project is mentioned in the product page on Google play:

    https://play.google.com/store/apps/details?id=astral.worldsf&feature=search_result#?t=W251bGwsMSwxLDEsImFzdHJhbC53b3JsZHNmIl0.

    opened by mobilevisuals 0
  • Visualizer class crashes on Android 9

    Visualizer class crashes on Android 9

    There seems to be audio issues with Android 9. It could also be that the audio playing model has been changed in Android 9, but I can not find any information about this. The only audio related change seems to be "HD Audio: Improved performance and support for HD audio delivering clearer, sharper, and richer quality sound."

    It is not only our apps that have issues with Android 9. I tested all the 10 top rated music visualizers. 40% of them have audio issues on Android 9, which makes the audio playing or the visualization not work anymore. I tested the same apps on a device with Android 8, where none of these problems appeared. This will cause big problems for the customers, when 40% of their music visualizer apps no longer work. Here are descriptions and stacktraces of the errors:

    1. Visualizer data capture issue signal 11 (SIGSEGV), code 1 (SEGV_MAPERR) android::RefBase::incStrong(void const*) const backtrace: #00 pc 000000000000bc30 /system/lib64/libutils.so (android::RefBase::incStrong(void const*) const) #01 pc 000000000000f7a8 /system/lib64/libutils.so (android::Thread::run(char const*, int, unsigned long)+124) #02 pc 00000000000bd028 /system/lib64/libmedia.so (android::Visualizer::periodicCapture()+224) #03 pc 00000000000bcdd8 /system/lib64/libmedia.so (android::Visualizer::CaptureThread::threadLoop()+88) #04 pc 000000000000f9d4 /system/lib64/libutils.so (android::Thread::_threadLoop(void*)+280) #05 pc 00000000000bc9cc /system/lib64/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+140) #06 pc 0000000000083840 /system/lib64/libc.so (__pthread_start(void*)+36) #07 pc 0000000000023d80 /system/lib64/libc.so (__start_thread+68)

    I have debugged and researched and found that setDataCaptureListener in Visualizer causes this problem. This is probably not a driver problem, since I see on the Play console that it happens on both Samsung and Motorola.

    1. Radio streaming no longer starts E/MediaPlayerNative: error (1, -2147483646) E/MediaPlayer: Error (1,-2147483648) E/ContentValues: onError
      The '1' value corresponds to the constant in MediaPlayer.MEDIA_ERROR_UNKNOWN. -2147483648 corresponds to hexadecimal 0x80000000 which is defined as UNKNOWN_ERROR in frameworks/native/include/utils/Errors.h. This shows that the error's source is hard to pin down as it is quite a generic return value, thrown by codec and compatibility issues, but also thread cancellations and several other types.
    opened by mobilevisuals 2
  • Cannot initialize Visualizer engine, error: -3

    Cannot initialize Visualizer engine, error: -3

    Fatal Exception: java.lang.RuntimeException: Cannot initialize Visualizer engine, error: -3 at android.media.audiofx.Visualizer.(Visualizer.java) at com.myApplication.android_visualizer.visualizer.VisualizerView.link(VisualizerView.java:85) at com.myApplication.activities.RadioStationActivity.initVisualizer(RadioStationActivity.java:633) at com.myApplication.activities.RadioStationActivity.checkPermissionsAndStartVisualization(RadioStationActivity.java:537) at com.myApplication.activities.RadioStationActivity.onPlayingStarted(RadioStationActivity.java:525) at com.myApplication.services.RadioService.onPrepared(RadioService.java:197) at io.vov.vitamio.MediaPlayer$EventHandler.handleMessage(MediaPlayer.java:1704) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6692) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)

    Some time application get crash with this log

    opened by ominfowave 23
  • how to visualize sound from microphone?

    how to visualize sound from microphone?

    My apps already visualize music from external and internal music players. I want to add live microphone sync, so my apps also visualize sound from the microphone. How can I implement that? I found no info about this on https://developer.android.com/reference/android/media/audiofx/Visualizer.html

    opened by mobilevisuals 10
  • Issue with visualizer

    Issue with visualizer

    I have some issues with the visualizer. The app draws a thin line in the middle of the canvas (about 5 pixels high) and draws the visualization into that. You cannot see it with the eyes. I had to zoom in to ensure it works. Is there someworkaounr for this?

    opened by mainrs 0
Owner
null
Make your native android Dialog Fancy. A library that takes the standard Android Dialog to the next level with a variety of styling options. Style your dialog from code.

FancyAlertDialog-Android Prerequisites Add this in your root build.gradle file (not your module build.gradle file): allprojects { repositories { ..

Shashank Singhal 350 Dec 9, 2022
Nature takes back over.

ShatteredReclamation This is a plugin that allows the wild to slowly take player creations back over. Config Threads This plugin uses multiple threads

ShatteredSoftware 3 Jul 15, 2022
TileView is a subclass of android.view.ViewGroup that asynchronously displays, pans and zooms tile-based images. Plugins are available for features like markers, hotspots, and path drawing.

This project isn't maintained anymore. It is now recommended to use https://github.com/peterLaurence/MapView. MapView is maintained by Peter, one of o

Mike Dunn 1.5k Dec 29, 2022
A new canvas drawing library for Android. Aims to be the Fabric.js for Android. Supports text, images, and hand/stylus drawing input. The library has a website and API docs, check it out

FabricView - A new canvas drawing library for Android. The library was born as part of a project in SD Hacks (www.sdhacks.io) on October 3rd. It is cu

Antwan Gaggi 1k Dec 13, 2022
Simple Visualizer from mic input for Android.

Voice Recording Visualizer Simple Visualizer from mic input for Android. Usage @Override protected void onCreate(Bundle savedInstanceState) {

Takayuki Yorikane 542 Nov 24, 2022
Floating label input widgets

Android Floating Label Widgets A set of input widgets with a hint label that floats when input is not empty. Demo A demo of the widget is worth a thou

MarvinLabs 450 Nov 25, 2022
A Tinder-like Android library to create the swipe cards effect. You can swipe left or right to like or dislike the content.

Swipecards Travis master: A Tinder-like cards effect as of August 2014. You can swipe left or right to like or dislike the content. The library create

Dionysis Lorentzos 2.3k Dec 9, 2022
Created a Tinder like Card Deck & Captain Train like Toolbar

TinderView Created A Simple and Beautiful Tinder like card deck & Captain Train like toolbar. This is heavily based on AndroidSwipeableCardStack, wenc

Aradh Pillai 328 Jun 18, 2022
SmileyRating is a simple rating bar for android. It displays animated smileys as rating icon.

Smiley Rating SmileyRating is a simple rating bar for android. It displays animated smileys as rating icon. Drawn completely using android canvas Insp

Sujith Niraikulathan 1.1k Dec 22, 2022
An android custom view that displays a circle with a colored arc given a mark

MarkView An android custom view that displays a circle with a colored arc given a mark. Usage Add as a dependency compile 'com.github.xiprox.markv

İhsan Işık 200 Nov 25, 2022
Android View that displays different content based on its state

MultiStateView Android View that displays different content based on its state. Based off of MeetMe/MultiStateView The four different states the view

Kenny 1.2k Dec 16, 2022
Displays your screen time in a permanent notification.

Screen Time Displays your screen time in a permanent notification. By making screen time more prominent, you can get a better sense of how much of the

Markus Fisch 24 Nov 29, 2022
A simple launcher which displays all the apps on a RecyclerView trying to KISS

A simple launcher which displays all the apps on a RecyclerView trying to KISS

Alex Allafi 1 Jun 17, 2022
TabSlider - An expanding slider widget which displays selected value

TabSlider - An expanding slider widget which displays selected value

null 1 Apr 20, 2022
An Android library supports badge notification like iOS in Samsung, LG, Sony and HTC launchers.

ShortcutBadger: The ShortcutBadger makes your Android App show the count of unread messages as a badge on your App shortcut! Supported launchers: Sony

Leo Lin 7.2k Dec 30, 2022
Android view that allows the user to create drawings. Customize settings like color, width or tools. Undo or redo actions. Zoom into DrawView and add a background.

DrawView Android view that allows the user to create drawings. Draw anything you like in your Android device from simple view. Customize draw settings

Oscar Gilberto Medina Cruz 839 Dec 28, 2022
:balloon: A lightweight popup like tooltips, fully customizable with an arrow and animations.

Balloon ?? A lightweight popup like tooltips, fully customizable with arrow and animations. Including in your project Gradle Add below codes to your r

Jaewoong Eum 2.8k Jan 5, 2023
Code Guide: How to create Snapchat-like image stickers and text stickers.

MotionViews-Android Code Guide : How to create Snapchat-like image stickers and text stickers After spending 2000+ hours and releasing 4+ successful a

Uptech 474 Dec 9, 2022
💳 A quick and easy flip view through which you can create views with two sides like credit cards, poker cards etc.

The article on how this library was created is now published. You can read it on this link here. →. ?? EasyFlipView Built with ❤︎ by Wajahat Karim and

Wajahat Karim 1.3k Dec 14, 2022