I am trying to solve this problem myself... I created a class that damps the values over a window of previous sensor values.
However with a damping wndow of 6 frames i still have the weird values. Here some logcat output of the damped values: The phone was just laying on my table.. not moving...! (The strange values are visble after the sound is played) 06-09 21:13:49.314: DEBUG/GameController(1104): D Azi,Pitch,Roll: 315, -2, 1 06-09 21:13:49.334: DEBUG/GameController(1104): D Azi,Pitch,Roll: 316, -2, 1 06-09 21:13:49.374: DEBUG/GameController(1104): D Azi,Pitch,Roll: 316, -2, 1 06-09 21:13:49.414: DEBUG/GameController(1104): D Azi,Pitch,Roll: 317, -2, 1 06-09 21:13:49.434: DEBUG/GameController(1104): D Azi,Pitch,Roll: 317, -2, 1 06-09 21:13:49.464: DEBUG/GameController(1104): D Azi,Pitch,Roll: 318, -2, 1 06-09 21:13:49.494: INFO/SoundEffects(1104): Playing: 2131099658 <-- playing sound here 06-09 21:13:49.574: DEBUG/GameController(1104): D Azi,Pitch,Roll: 318, -2, 2 06-09 21:13:49.594: DEBUG/GameController(1104): D Azi,Pitch,Roll: 317, 0, 3 06-09 21:13:49.614: DEBUG/GameController(1104): D Azi,Pitch,Roll: 317, 0, 3 06-09 21:13:49.634: DEBUG/GameController(1104): D Azi,Pitch,Roll: 317, 0, 4 06-09 21:13:49.654: DEBUG/GameController(1104): D Azi,Pitch,Roll: 317, 0, 1 <-- dampnig prevents very high extreme sensor values 06-09 21:13:49.674: DEBUG/GameController(1104): D Azi,Pitch,Roll: 316, -1, 0 06-09 21:13:49.694: DEBUG/GameController(1104): D Azi,Pitch,Roll: 316, -2, -2 06-09 21:13:49.714: DEBUG/GameController(1104): D Azi,Pitch,Roll: 315, -6, -6 06-09 21:13:49.734: DEBUG/GameController(1104): D Azi,Pitch,Roll: 314, -7, -9 06-09 21:13:49.754: DEBUG/GameController(1104): D Azi,Pitch,Roll: 314, -12, -15 06-09 21:13:49.774: DEBUG/GameController(1104): D Azi,Pitch,Roll: 313, -11, -18 <-- however still strange values here 06-09 21:13:49.794: DEBUG/GameController(1104): D Azi,Pitch,Roll: 313, -7, -16 06-09 21:13:49.814: DEBUG/GameController(1104): D Azi,Pitch,Roll: 311, -1, -13 06-09 21:13:49.834: DEBUG/GameController(1104): D Azi,Pitch,Roll: 307, 7, -9 06-09 21:13:49.854: DEBUG/GameController(1104): D Azi,Pitch,Roll: 302, 13, -3 06-09 21:13:49.873: DEBUG/GameController(1104): D Azi,Pitch,Roll: 295, 22, 2 06-09 21:13:49.894: DEBUG/GameController(1104): D Azi,Pitch,Roll: 285, 24, 12 06-09 21:13:49.914: DEBUG/GameController(1104): D Azi,Pitch,Roll: 273, 23, 16 06-09 21:13:49.933: DEBUG/GameController(1104): D Azi,Pitch,Roll: 259, 22, 15 06-09 21:13:49.964: DEBUG/GameController(1104): D Azi,Pitch,Roll: 244, 17, 14 06-09 21:13:49.984: DEBUG/GameController(1104): D Azi,Pitch,Roll: 231, 14, 10 06-09 21:13:50.004: DEBUG/GameController(1104): D Azi,Pitch,Roll: 219, 9, 8 06-09 21:13:50.024: DEBUG/GameController(1104): D Azi,Pitch,Roll: 209, 5, 4 If you want i can post the damping class online ( i wrote it so it can easily be reused ) On 9 jun, 20:08, TjerkW <tje...@gmail.com> wrote: > I am developing a game. > In which the user controls movement using the accelerometer. > Sounds effects can also be enabled. > > However when laying the phone flat down and playing the game without > the accelerometer gives nice 0,0,0 values. > > However when play WITH SOUNDS on, i get a buch of weird values: while > the phone is NOT moving. > > This is really a big bug that makes life hard for Game Developers. > I tried to take an avarge of the last 5 values from the sensor.. but > this is not enough.. > > The harder the sounds plays: the higher the weird sensor values. > > When using the headphones: almost no weird values. > > Seems that sounds interferes with the accelerometer sensor. > > BTW: more developers posted this issue but no reactions at all from > google!!http://groups.google.com/group/android-developers/browse_thread/threa...http://groups.google.com/group/android-developers/browse_thread/threa... > > Is this is hardware problem? > How do i solve it? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---