4
I have a player open source for Android some time ago. Months ago I created an audio viewer (the type of ones with bars and colors) where the user could interact, simulating an augmented reality (the view appears to be "around" the person, as the person moves the device).
After a few tests, I noticed that the data from the magnetic sensors and acceleration oscillate a lot (as is to be expected in analog sensors), so I use a first-order low-pass filter to smooth the movement. So far, no news.
It turns out that by watching this clip of Björk on Youtube device, I realized that it follows the same principle, and offers a 360 degree experience.
However, I noticed that the movement on Youtube is not as smooth/slow as in my viewer, but it does not "shiver" when released on a smooth surface. In other words: the raw data, soon my viewer, oscillate a lot when the device is at rest, so I had to filter, and the movement ends up being a little slow. But on Youtube, there are no "tremors" when the device is on the same surface at rest, but it responds much faster than my viewer.
As you can see in code where I handle sensor data (function onSensorData
, from line 286), I am using the following filter:
coefNew = (0.03125f / 16.0f) * delta;
coefOld = 1.0f - coefNew;
Remarks:
coefNew
is used in input (x) andcoefOld
at the previous exit (y)delta
is the interval, in milliseconds, between the previous and the current/ 16.0f * delta
serves to adjust the coefficient depending on the fps rate
I have tried to "play" with the coefficient, and if I increase its value, the movement starts to respond faster, but the tremors come back (as expected).
Even though I was in C++, I based myself on the class code SensorManager
, from Android itself, to generate the linear transformation matrix: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/5.0.2_r1/android/hardware/SensorManager.java
Hence my question: Is there another type of filter / technique that can be used in this situation? Does anyone know how Youtube achieves that fast responsive but not "quivering" move (there is another Android data acquisition method to create the linear transformation matrix)?