Giter Club home page Giter Club logo

doppler-android's Introduction

Motion sensing using the doppler effect, for android

This is my implementation of Gupta's Soundwave paper for android. The project is heavily inspired by Daniel Rapp's javascript plugin for the same effect.

Demo

You can check out some sample code/use cases for this library in my demo app.

Download link

How to Use

I haven't figured out how to work this project into gradle/maven, so the only way to use it at the moment is to download the library as a zip and add it to your Android Studio project as a module.

To use the library in your code, just initialize a new Doppler instance, and start it:

Doppler doppler = new Doppler();
doppler.start();
//also, make sure to pause doppler when the user exits your app:
doppler.pause();

You can then start listening for gestures by attach a GestureListener:

doppler.setOnGestureCallback(new Doppler.OnGestureListener() {
  public void onPush() {
    //scroll down
  }
  public void onPull() {
    //scroll up
  }
  public void onTap() {
    //click button
  }
  public void onDoubleTap() {
    //pause scrolling?
  }
});

If you would rather manipulate the raw data, you can attach a ReadCallback as well:

doppler.setOnReadCallback(new Doppler.OnReadCallback() {
  public void onBandwidthRead(int leftBandwidth, int rightBandwidth) {
    //play around with the bandwidth differences
  }
  public void onBinsRead(double[] bins) {
    //graph the frequency bin magnitudes, for example
  }
});

The library is also set to automatically calibrate by default. I find that the best way to use this library is to let Doppler autocalibrate for several seconds before starting whatever task you intend to use it for. Thanks to (dracolytch)[DanielRapp/doppler#9] for his autocalibration algorithm.

Should you wish to turn off autocalibration, just call the method:

doppler.setCalibrate(false);

Disclaimer

I was only able to test the library on my OnePlus One so far, so the library may still be a little buggy. Also, I get some jagged lines near the edges of the 20k frequency reading, which may either be caused by bad code or my device.

Some times, this causes Doppler to bug out and "lock" to one direction, so if this happens, just reinitialize the Doppler instance and it should work again.

doppler-android's People

Contributors

bryant1410 avatar jasper-lu avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.