# HAC Files (Android)

HAC (Haptics and Audio Container) files are zip files used to package haptic and audio signals in a single format which is straightforward to deploy.

# Contents

Track.hac
├── Audio_Track.wav
├── main.hla
└── main.ogg

HAC files always contain one HLA file that represents the haptic signal. In addition, it contains all OGG files and audio files referenced in the HLA file.

As such, it contains all the data necessary to play back the signal in a single file.

# Playback

We strongly recommend using one of our open-source libraries to handle HAC files since they handle unzipping, preloading, and playback.

Add the exported files to your applications's assets directory so they are bundled with the app.

# React Native

You can easily play the exported signals using our React Native package. Read more here.

# Flutter

You can also easily play the exported signals using our Flutter plugin. Read more here.

# Kotlin

To play back haptic signals encoded in HAC files using Kotlin, use our hapticlabsplayer Android library:

import io.hapticlabs.hapticlabsplayer.HapticlabsPlayer

// Instantiate the player
val hapticlabsPlayer = remember { HapticlabsPlayer(context) }

// Play HLA file
hapticlabsPlayer.play(
    "path/to/file.hac"
) {
  println("HAC finished playing")
}

For more information, check out the docs and our full example of the library's usage.