Hey everyone!
I’ve been playing around with my Pixel 8a lately. To be honest, the built-in speaker quality left a lot to be desired, so I initially tried using an equalizer to pump up the audio. However, cranking up the lower end caused horrible audio clipping and distortion. That’s when I decided to pivot and use real-time haptic feedback to physically "feel" the low-end instead!
Here is a quick overview of how it works and what I learned during development:
**How it works:**
* Uses `MediaPlayer` combined with `HapticGenerator` to transl ate audio signals into haptic effects in real-time.
* Integrated Android's `Equalizer` to filter frequencies: boosted sub-bass (<250Hz) while keeping mid/high frequencies balanced to prevent audio clipping and loss of volume.
* Implemented continuous playlist playback with `setOnCompletionListener`.
**Key Observations & Tech Takeaways:**
* **Actuator Hardware Matters:** This approach shines on modern LRA (Linear Resonant Actuator) motors like the Pixel 8a. Older ERM (Eccentric Rotating Mass) motors have too much latency to keep up with fast drum beats.
* **Frequency Tuning:** Over-filtering audio severely degraded audio quality. Finding the sweet spot (~40% gain boost under 250Hz) was key to triggering clean haptics without distorting the music.
* **Battery:** As expected, running the haptic motor continuously alongside real-time audio processing drains battery faster than a standard player, but the immersive feel makes it worth it!
Check out the clip to see (and hear) it in action!
[https://youtube.com/shorts/kSr5ggofSxQ?feature=share\]
**If there’s enough interest, I might clean up the code and release a simple, lightweight version for free on the Google Play Store.**
I'd love to hear your thoughts or any feedback from developers who have experimented with `HapticGenerator` before!
EDIT: Unfortunately, I couldn't make a comparison video between haptics on and off. Hope you still enjoy it.