Audio Helm  1.0
Live audio synthesis, sequencing and sampling for Unity
AudioHelm.Utils Class Reference

Utility functions that are useful for audio/MIDI/music. More...

Static Public Member Functions

static bool IsBlackKey (int key)
 Checks if a given MIDI key is a black key. More...
 
static bool IsC (int key)
 Checks if a given MIDI key is a 'C' note. More...
 
static int GetOctave (int key)
 Gets the keyboard octave of a given key. More...
 
static float MidiChangeToRatio (int midi)
 Takes two notes midi semitones apart and returns the ratio of the frequencies. More...
 
static bool RangesOverlap (float start, float end, float rangeStart, float rangeEnd)
 Check if two float ranges overlap. More...
 
static void InitAudioSource (AudioSource audio)
 Sets up an AudioSource for playing to a Helm Native instance. More...
 
static T CopyComponent< T > (T original, GameObject destination)
 Copies all properties and fields of one Component to another GameObject. More...
 

Public Attributes

const int kMidiSize = 128
 
const int kNotesPerOctave = 12
 
const int kMaxChannels = 16
 
const float kBpmToSixteenths = 4.0f / 60.0f
 
const double kSecondsPerMinute = 60.0
 
const double kSixteenthsPerBeat = 4.0
 
const int kMinOctave = -2
 
const int kMiddleC = 60
 

Detailed Description

Utility functions that are useful for audio/MIDI/music.

Member Function Documentation

◆ CopyComponent< T >()

static T AudioHelm.Utils.CopyComponent< T > ( original,
GameObject  destination 
)
static

Copies all properties and fields of one Component to another GameObject.

Returns
The instantiated and copied Component.
Parameters
originalThe original Component to be copied.
destinationThe GameObject to put the copied Component on.
Template Parameters
TThe type of Component.
Type Constraints
T :Component 

◆ GetOctave()

static int AudioHelm.Utils.GetOctave ( int  key)
static

Gets the keyboard octave of a given key.

Returns
The octave of the given key.
Parameters
keyThe key to check the octave of.

◆ InitAudioSource()

static void AudioHelm.Utils.InitAudioSource ( AudioSource  audio)
static

Sets up an AudioSource for playing to a Helm Native instance.

Parameters
audioThe AudioSource to initialize.

◆ IsBlackKey()

static bool AudioHelm.Utils.IsBlackKey ( int  key)
static

Checks if a given MIDI key is a black key.

Returns
true, if the key is a black key, false otherwise.
Parameters
keyKey.

◆ IsC()

static bool AudioHelm.Utils.IsC ( int  key)
static

Checks if a given MIDI key is a 'C' note.

Returns
true, if the key is a black key, false otherwise.
Parameters
keyKey.

◆ MidiChangeToRatio()

static float AudioHelm.Utils.MidiChangeToRatio ( int  midi)
static

Takes two notes midi semitones apart and returns the ratio of the frequencies.

Returns
The ratio of the two notes.
Parameters
midiNumber of semitones changed.

◆ RangesOverlap()

static bool AudioHelm.Utils.RangesOverlap ( float  start,
float  end,
float  rangeStart,
float  rangeEnd 
)
static

Check if two float ranges overlap.

Returns
true, if the ranges overlap, false otherwise.
Parameters
startStart of range 1.
endEnd of Range 1.
rangeStartStart of range 2.
rangeEndEnd of range 2.

The documentation for this class was generated from the following file: