Android: Display data captured using AudioRecord in form a dynamic chart using android plot

497 views Asked by At

I am recording audio in WAV format using AudioRecord. How to plot the received data while recording in form of a realtime graph using android plot.

1

There are 1 answers

5
Nick On

This question is much too broad to fully answer, but I can hopefully at least point you in the right direction to get started. I'd suggest beginning by converting your data into an XYSeries. There are multiple ways to do this and which one you choose depends on how you want your dynamic data to look:

  • Will the plot scroll, or will the data scroll across the plot?
  • Are the domain / range min/max values fixed or dynamic?
  • Will timestamps or sample indexes be used to represent x?

Once you know the answer to these questions you can begin to decide how to represent each sample in terms of [x, y] values. This means converting each sample(i) into an x and y value. For y, you'll need to convert your wav amplitude into a Number. For x, if you just want to show the sample index, use i. If you want to show time then you'll probably want to use the sampling frequency and recording start time to convert i into a timestamp.

Once you've got the basics of your XYSeries implementation figured out you can move on to displaying the series data in an XYPlot. Take a look at the Plotting Dynamic Data guide, which includes a link to source samples.