Swiftpack.co - highfidelity/hifi-spatial-audio-swift as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
A Swift Framework used to integrate High Fidelity's Spatial Audio technology into iOS applications.
.package(url: "https://github.com/highfidelity/hifi-spatial-audio-swift.git", from: "v0.0.4")
High Fidelity Spatial Audio


GitHub issues

Discord Twitter Follow

The High Fidelity Spatial Audio Client Library for Swift allows developers to integrate High Fidelity's spatial audio technology into their projects.

Getting Started

Usage in Your iOS Apps

If you'd like to make use of the HiFiSpatialAudio Swift Package in your iOS apps:

  1. Open your iOS app's code in XCode.
  2. Click File in the top left, then click Swift Packages, then click Add Package Dependency...
  3. Under "Search or enter package repository URL", paste the following URL:
  4. Click Next, then follow XCode's instructions.

You'll Need a Developer Account

To use the Spatial Audio API, you'll need to sign up for a High Fidelity Developer Account. Sign up for free at account.highfidelity.com.


Click here to view documentation on the latest version of the Spatial Audio Client Library for Swift.


You can explore some of the features of the Swift client library by compiling and running any of the included Test Apps in the Test Apps subdirectory of this repository. All of the sample apps run on an iPhone Simulator via XCode and on real iOS hardware.

  • The HiFiSpatialAudioTest app is the simplest, most straightforward, and closest to "production-ready".
  • The HiFiUnionSquare app is a complex app which uses device sensor fusion to place your avatar on a map of Union Square. Your avatar's position and orientation are driven by your phone's real-world position and orientation.
  • The (unfinished) HiFiPlace app shows your avatar and other avatars on a map.

Release Notes

Release notes for the Spatial Audio Client Library are available on the GitHub releases page.

Additional Details

The HiFiSpatialAudio Swift Package is a Swift version of High Fidelity's Spatial Audio client library for TypeScript. Click here to access documentation for the TypeScript version of our client library.

The goal of this project is to mirror the functionality of the TypeScript library for iOS applications. However, you may find that not all features from the TS client library are present in the Swift client library. Additionally, some functionality may be different, and some functionality may be buggy.

Important Information

Audio Peripherals and Bluetooth

By default, the HiFiSpatialAudio Swift package will automatically use whatever stereophonic headphones or AirPods that may be connected by wire or by Bluetooth, using the Apple-defined behavior of “last peripheral connected, wins”. If there is no such stereo peripheral connected, the two speakers on the phone are used, where the “bottom” speaker is the left channel, and the “top” speaker is the right channel. The phone microphone is used.

The constructor for the HiFiCommunicator object also accepts a boolean named argument called echoCancellingVoiceProcessingInMono, which instead uses hardware echo cancellation and automatic gain control, but the ouput is monophonic and of “speech” quality. In this mode, wireless peripherals are connected via the “hands-free” Bluetooth mode. In this mode, if the wireless hardware contains a microphone, that microphone will be used for audio input.

Other Information

Explanation of Package Dependencies

The HiFiSpatialAudio package relies on several Swift Package Dependencies, all of which should be automatically downloaded before your project is built.

These Swift Package Dependencies include:

  • Gzip (for un-gzipping binary peer data sent from the mixer)
  • Promises (for JavaScript-like Promises)
  • Starscream (for Web Sockets)
  • A custom version of WebRTC for iOS, which includes stereo output support (for...WebRTC stuff)

Generating Documentation

First, install Jazzy with gem install jazzy from a Terminal window.

Then, run the following command from the repository directory to generate documentation for the HiFiSpatialAudio Swift package:



Stars: 1
Last commit: 3 days ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

1 week ago
  • Accepted values for userAttenuation, userRolloff and volumeThreshold are being updated (temporarily) to be more permissive
    • Now, NaN can be specified so that the respective default value for the zone/space is used
    • Documentation updated to indicate that in a future release that 0 (for userAttenuation and userRolloff) and null (for volumeThreshold) will no longer be used
  • Fix for setOtherUserGainForThisConnection

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics