Alex Rivera | Logout

How to do Visualizer while recording audio in android

Asked 2012-11-26T05:55:33.157
14

I know Visualizer to show some wave while playing audio using android Media Player.

But i want to show Visualizer while recording audio means while recording i want to show linear wave which changes based on user voice beat.

Is it possible to do in android.

Edit
Report

1 Answer

3

Two important things:

  • you need to convert live bytes (from mic) to numeric values inorder to plot them.
  • Since you use a real-time graph, to plot those points use SurfaceView.

    Convert recording bytes to numeric values refer: Android: Listener to record sound if any sound occurs where you will see the variable "temp" holds the numerical value of your audio.

    Plot points These numeric values which indicates your Y values is plotted against increasing X (time interval) values (0,1,2..) as graph. Using SurfaceView eg..,

//canvas.drawLine(previous X value,previous Y value,X,Y, paint);
canvas.drawPoint(X,Y,paint);
SurfaceHolder.unlockCanvasAndPost(canvas);

You need not plot all values, for efficiency you can filter those values with your conditions and plot for certain intervals of time.

Hope this helps :)

answered 2012-12-04T18:27:33.113

Your Answer