appnext

Senin, 01 Maret 2021

Android 12 features we love: Haptics and audio can work together

Android 12 can make your phone dance to the music.

Android 12 has plenty of features to explore, but one of the coolest may be the ability for your phone's haptic motors to work in tandem with an audio stream. Vibration is something every Android phone — from the best phone to the most budget-friendly phone — already has and every phone can also play sounds through its external speaker. Pairing the two might lead to some really innovative stuff!

What are haptics?

Inside of every phone is a small motor that is purposefully made to be off-balance, called a linear resonant actuator. When Android tells a phone to vibrate, this motor spins. Because it's off-balance, it shakes and vibrates while it's spinning and this vibration is what we're feeling when our phone is on mute and someone calls.

Haptic feedback isn't a small feature, and it isn't easy to get it right.

These vibrations are useful for other things, too. The most familiar — and for many the most vital — thing is vibrating when you tap a letter on the keyboard. Haptics are one of the three ways (visual and audio are the others) our phone can give us a clue that it's performing some sort of action. In our example, it's letting us know that we've successfully entered a character from the keyboard.

Haptic feedback is vital for phones, but it's also very useful in your PlayStation controller, wearable devices, and even as an accessibility option for those with hearing issues.

Haptics and audio

Pay close attention to this short video, courtesy of XDA Editor in Chief Mishaal Rahman and an app from an independent developer who goes by the name kdrag0n. The volume of the phone is turned off but you can clearly hear the phone vibrate in time with the beat when placed on a wooden table. That's the haptic audio coupling of Android 12 in full effect.

All the magic works during the audio post-processing and causes zero overhead.

The app was built using the new Haptic Generator API found in Android 12, which the documentation describes as "an audio post-processor which generates haptic data based on the audio channels". In simple terms, that means that any sound generated can trigger the haptic motor based on when and how a developer wants it to turn on and off.

Because this is done during the audio processing, it doesn't matter if the volume is on or off or how loud it is. Another interesting note is that the new API works on the Pixel 4, but not the Pixel 4a, Pixel 4a 5G, or the Pixel 5. If I were a betting man, I would say those issues will be addressed before Android 12 is officially released sometime this fall.

While seeing this demo in action is really cool, what else could be done with it is a lot more interesting. Two very nice additions to Android come to mind: gaming and custom vibration patterns.

Most of us have used an Xbox or PlayStation and know that a shaking controller is a pretty nifty addition. Whether you're playing a first-person shooter, a racing game, a flight simulator, or any other sort of action game, having the controller rumble in your hands when you do something like wreck a car makes for better gameplay.

When you crash while playing Asphalt, your phone should shake!

There's no reason the same can't be done with your phone. A game developer could use the new Haptic Generator API to cause the motor to fire up at a specified intensity when an event happens. Android is getting plenty of great 3D games, and those games could make great use of this feature!

A little more mundane but just as important would be the ability to assign a specific vibration pattern when a specific contact calls or messages you. Having custom ringtones and messaging tones for a contact isn't a new idea. Let's say the developer of the next great messaging app wants to go a step further, and let you assign both a ringtone and a vibration pattern for a contact. While there would still be extra work, the Haptic Generator makes it far less involved.

Of course, Android developers have a lot of great ideas of their own, as we see every day in the apps we use and love. "Custom" Haptics may not sound like the sexiest feature of Android 12, but I think it's one of the coolest.

Tidak ada komentar:

Posting Komentar