Utility functions that are useful for audio/MIDI/music.
More...
|
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...
|
|
|
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 |
|
Utility functions that are useful for audio/MIDI/music.
◆ CopyComponent< T >()
static T AudioHelm.Utils.CopyComponent< T > |
( |
T |
original, |
|
|
GameObject |
destination |
|
) |
| |
|
static |
Copies all properties and fields of one Component to another GameObject.
- Returns
- The instantiated and copied Component.
- Parameters
-
original | The original Component to be copied. |
destination | The GameObject to put the copied Component on. |
- Template Parameters
-
◆ 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
-
key | The 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
-
audio | The 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
-
◆ 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
-
◆ 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
-
midi | Number 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
-
start | Start of range 1. |
end | End of Range 1. |
rangeStart | Start of range 2. |
rangeEnd | End of range 2. |
The documentation for this class was generated from the following file:
- AudioHelm/Scripts/Utils.cs