Skip to content

A simple package for audio extensions and utilities for Unity (UPM)

License

Notifications You must be signed in to change notification settings

RageAgainstThePixel/com.utilities.audio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

com.utilities.audio

Discord openupm openupm

A simple package for audio extensions and utilities in the Unity Game Engine.

Installing

Requires Unity 2021.3 LTS or higher.

The recommended installation method is though the unity package manager and OpenUPM.

Via Unity Package Manager and OpenUPM

  • Open your Unity project settings
  • Select the Package Manager scoped-registries
  • Add the OpenUPM package registry:
    • Name: OpenUPM
    • URL: https://package.openupm.com
    • Scope(s):
      • com.utilities
  • Open the Unity Package Manager window
  • Change the Registry from Unity to My Registries
  • Add the Utilities.Audio package

Via Unity Package Manager and Git url

  • Open your Unity Package Manager
  • Add package from git url: https://github.com/RageAgainstThePixel/com.utilities.audio.git#upm

    Note: this repo has dependencies on other repositories! You are responsible for adding these on your own.

Documentation

On its own this package doesn't do too much but provide base functionality for recording audio in the Unity Editor and during runtime. Instead, use the encoder packages to fully utilize this package and its contents.

Table of Contents

Encoder Packages

Recording Manager

This class is meant to be used anywhere you want to be able to record audio. You will need to have one of the encoder packages to be able to record and encode to the specific format.

A perfect example implementation on how to use this is in the AbstractRecordingBehaviour class.

Recording Behaviour

A basic AbstractRecordingBehaviour is included in this package to make it very simple to add recording to any GameObject in the scene. This class is really meant to be a good baseline example of how to use the RecordingManager. This abstract class is implemented in each of the encoder packages for simplicity and ease of use.

Audio Clip Extensions

Provides extensions to encode AudioClips to PCM encoded bytes. Supports 8, 16, 24, and 32 bit sample sizes.

Encode PCM

// Encodes the <see cref="AudioClip"/> to raw PCM bytes.
var pcmBytes = audioClip.EncodeToPCM();

Decode PCM

// Decodes the raw PCM byte data and sets it to the audioClip.
audioClip.DecodeFromPCM(pcmBytes);