0

I am new to android and trying to learn creation or plotting of graphs in android. I've come across 2 libraries:

  1. GraphView
  2. AndroidPlot.

My intent would be to receive some sound file and plot it on a graph. So, for this purpose which library would be better. Also I wanna know, where I can see the complete implementation or definitions of these libraries i.e. the structure and code for the API's used in the above libraries.

Also I have tried some sample codes available on net. But I'm looking for a more sophiticated code which I could develop on eclipse ADT and hence can learn something out of it.

2
  • what are you plotting the pitch? Commented Jul 1, 2013 at 6:04
  • I just want to plot a sound file, over an interval of time. Could you please suggest which libraries/API's would be useful. You can also post your replies to [email protected] If possible provide a ssample code. Commented Jul 1, 2013 at 12:41

4 Answers 4

1

My intent would be to receive some sound file and plot it on a graph

Neither library does this by default. The libraries are used to plot a graph given a set of data points. Getting the data points from the sound file is up to you.

So, for this purpose which library would be better.

Either library should be fine once you get the data points.

Also I wanna know, where I can see the complete implementation or definitions of these libraries i.e. the structure and code for the API's used in the above libraries.

Check out the sources for GraphView and AndroidPlot.

Sign up to request clarification or add additional context in comments.

Comments

1

I have used Achartengine some times and it works great. I modified it without difficulties.

Comments

0

If You are drawing simple Line Graph using canvas to draw the graph.

Comments

0

Use AndroidPlot. This code draw the content of Vector(in this case filled of zeros). You only have to pass the info of the wav file to the vector. And you can check this thread for the reading issue. Android: Reading wav file and displaying its values

    plot = (XYPlot) findViewById(R.id.Grafica);
    plot.setDomainStep(XYStepMode.INCREMENT_BY_VAL, 0.5);
    plot.setRangeStep(XYStepMode.INCREMENT_BY_VAL, 1);

    plot.getGraphWidget().getGridBackgroundPaint().setColor(Color.rgb(255, 255, 255));
    plot.getGraphWidget().getDomainGridLinePaint().setColor(Color.rgb(255, 255, 255));
    plot.getGraphWidget().getRangeGridLinePaint().setColor(Color.rgb(255, 255, 255));

    plot.getGraphWidget().setDomainLabelPaint(null);
    plot.getGraphWidget().setRangeLabelPaint(null);
    plot.getGraphWidget().setDomainOriginLabelPaint(null);
    plot.getGraphWidget().setRangeOriginLabelPaint(null);
    plot.setBorderStyle(BorderStyle.NONE, null, null);

    plot.getLayoutManager().remove(plot.getLegendWidget());
    plot.getLayoutManager().remove(plot.getDomainLabelWidget());
    plot.getLayoutManager().remove(plot.getRangeLabelWidget());
    plot.getLayoutManager().remove(plot.getTitleWidget());


    //plot.getBackgroundPaint().setColor(Color.WHITE);
    //plot.getGraphWidget().getBackgroundPaint().setColor(Color.WHITE);

    plot.setRangeBoundaries(-25, 25, BoundaryMode.FIXED);// check that, these //boundaries wasn't for audio files 
    InicializarLasVariables();
    for(int i=0; i<min/11;i++){

        DatoY=0;
        Vector.add(DatoY);
        }
        XYSeries series = new SimpleXYSeries(Vector, SimpleXYSeries.ArrayFormat.Y_VALS_ONLY,"");
        LineAndPointFormatter seriesFormat = new LineAndPointFormatter(Color.rgb(0, 0, 0), 0x000000, 0x000000, null);
        plot.clear();
        plot.addSeries(series, seriesFormat);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.