hobbysoft.pro

Haptic Forge · Feature

Generate haptics from audio: turn sound into a haptic pattern

To generate haptics from audio, you analyze a sound for sharp onsets and sustained energy, then map onsets to transient taps and steady stretches to continuous vibration. Haptic Forge does that first pass for you, then lets you hear the sound and feel the pattern together while you refine it.

By HobbySoft, iOS & Mac developer Updated

How audio-to-haptics conversion works

Sound and touch are related but not the same. A good conversion does not copy the waveform into the motor; it picks out the moments that should be felt. There are two things to find in a sound:

  • Onsets: the start of a sharp sound such as a kick drum, a door slam or a gunshot. These become transient events, single crisp taps.
  • Sustained energy: stretches where the sound holds steady, such as a bass note, an engine or wind. These become continuous events, with intensity following loudness.

A common approach in audio analysis is to track the signal’s loudness envelope over time and detect sudden rises in energy as onsets. Whatever the method, the output is the same kind of thing: a timeline of transient and continuous events that Core Haptics can play.

What Haptic Forge does with a sound

In Haptic Forge, my Core Haptics editor for iPhone, iPad and Mac, you import a sound and get a pattern back:

  • A tap on every beat it detects.
  • A continuous rumble through every steady stretch.
  • The waveform sits under the chart, so you can see why an event is where it is.
  • Sound and pattern play together, so you judge the result the way users will experience it.

The generated events are ordinary layers. You can delete, move, reshape or retune any of them, and export the result as a standard AHAP file.

Why generated haptics still need a designer

Automatic generation is a starting point. Some things a tool cannot know:

  • Which beats matter. A busy drum track can produce a tap every 100 ms. That is tiring on the hand. Often you keep only the downbeats or the snare.
  • Relative weight. The loudest sound is not always the most important one. A quiet “click” of a lock may deserve a stronger tap than a loud background crash.
  • Sharpness. Loudness maps naturally to intensity, but sharpness is about character. A bass drop wants low sharpness; a hi-hat wants high sharpness.
  • Silence. Leaving gaps gives the next hit more impact.

A refining checklist

  1. Play the sound and pattern together on an iPhone.
  2. Remove taps that blur into a buzz.
  3. Raise the intensity of the two or three moments that carry the scene.
  4. Set sharpness per layer: low for thumps and rumble, high for clicks and ticks.
  5. Add a short fade at the end of continuous layers so they do not cut off abruptly.

Use cases for audio-driven haptics

Use caseWhat to keep from the audioTypical result
Music player or rhythm gameKick and snare onsetsSteady taps on the beat, light rumble under bass
Game sound effectsImpacts and explosionsStrong transient plus short continuous tail
App trailers and onboardingKey hits in the soundtrackA few deliberate taps on big moments
Meditation or breathing audioSlow swellsGentle continuous events that rise and fall
UI soundsThe click itselfOne transient, matched in timing

For game-specific patterns such as engines, weapons and UI, see haptics for game developers.

Keeping sound and haptics in sync in your app

Sync is where audio-driven haptics most often fail in production. A few rules:

  • Start both together. Prepare the audio player and the haptic pattern player ahead of time, then start them in the same step.
  • Or put the audio in the pattern. AHAP supports AudioCustom events that reference a sound file, so Core Haptics schedules both on one timeline.
  • Keep the engine running during playback. Handle the engine’s stopped and reset callbacks so a backgrounded app does not lose the haptics halfway through.
  • Check on device. Only an iPhone plays Core Haptics; the Simulator, iPad and Mac do not.

How I built it

The tricky part was not detecting beats; it was making the output something a designer wants to edit. Generated events land as normal layers with the waveform beneath them, so the first pass and the hand-tuned result live in the same timeline. If you want to understand the two event types the generator produces, read transient vs continuous haptics.

FAQ

Questions and answers

Can I convert an audio file to haptics on iPhone?

Core Haptics does not convert audio by itself, so you need a tool or your own analysis code. Haptic Forge imports a sound and generates a pattern with taps on beats and rumble through steady stretches.

Do generated haptics need manual editing?

Usually yes. Automatic generation gives a solid first draft, but deciding which beats matter and how strong they should feel is a design choice, so plan to trim and adjust.

Can the generated pattern be used in my own app?

Yes. Haptic Forge exports standard AHAP files, which any app using Core Haptics can load and play.

Will the haptics stay in sync with the sound?

In the editor, sound and pattern play together so you can check sync. In your app, start the audio and the haptic player at the same moment, or embed audio events in the AHAP file.

Designed, built and shipped by one iOS developer

Haptic Forge brings together core Haptics, audio analysis, encrypted local-network pairing and iCloud sync, on iPhone, iPad and Mac. Need an app built with the same care for your business?

Hire me