Class
AudioAnalyzer
Takes measurements from audio streams that are connected to it via one or more
Wires.
AudioAnalyzer takes measurements from audio streams that are wired to
it through Wire. It provides a single Input pin but does not
produce any output streams. Note that all audio processing is disabled on the
server in order to conserve resources; Properties and methods of
AudioAnalyzer return empty or zero results when used from server
scripts.
Properties 4#
PeakLevelfloat | The loudest volume observed during the last audio buffer.ReadSafeReadOnlyNotReplicated |
RmsLevelfloat | The root-mean-square average volume observed during the last audio buffer.ReadSafeReadOnlyNotReplicated |
SpectrumEnabledboolean | Enables usage of GetSpectrum.ReadSafe |
WindowSizeAudioWindowSize | Controls the resolution and timeliness of
GetSpectrum.ReadSafe |
PeakLevel: float#
ReadOnlyNotReplicatedReadSafe
The loudest volume observed during the last audio buffer. This property
changes more often than the framerate and does not fire changed events. On
the server, this property is always 0.
RmsLevel: float#
ReadOnlyNotReplicatedReadSafe
The root-mean-square average volume observed during the last audio buffer.
This property is generally more stable than
PeakLevel but it may not capture momentary
volume spikes. This property changes more often than the framerate and
does not fire changed events. On the server, this property is always 0.
SpectrumEnabled: boolean#
ReadSafe
Enables usage of GetSpectrum(). If
false, GetSpectrum() returns an empty
array, but the CPU overhead of the AudioAnalyzer is dramatically
reduced. This means that if you are only analyzing the volume of an
audio stream, you can disable this property to improve performance.
WindowSize: AudioWindowSize#
ReadSafe
Controls the size of arrays returned by
GetSpectrum(). Larger windows contain
more data (so more-accurate frequency responses) but change less often.
Methods 4#
| GetConnectedWires | Returns an array of Wires that are connected to the specified
pin. |
| GetInputPins | Gets the list of pins that Wire can use in Wire.TargetName
to connect to this instance via its Wire.TargetInstance property. |
| GetOutputPins | Gets the list of pins that Wire can use in Wire.SourceName
to connect to this instance via its Wire.SourceInstance property. |
| GetSpectrum | Returns the frequency spectrum of the last audio buffer.CustomLuaState |
GetConnectedWires(pin: string): List<Wire>#
Returns an array of Wires that are connected to the specified
pin. AudioAnalyzer has one "Input" pin.
| Name | Type | Default | Description |
|---|---|---|---|
pin | string | An input or output pin on this instance |
Returns
List<Wire>— An array ofWires
GetInputPins(): Array#
Gets the list of pins that Wire can use in Wire.TargetName
to connect to this instance via its Wire.TargetInstance property.
For AudioAnalyzer, this is Input only.
Returns
Array— An array of strings representing valid pin names.
GetOutputPins(): Array#
Gets the list of pins that Wire can use in Wire.SourceName
to connect to this instance via its Wire.SourceInstance property.
For AudioAnalyzer, there are none.
Returns
Array— An array of strings representing valid pin names.
GetSpectrum(): Array#
CustomLuaState
Returns the frequency spectrum of the last audio buffer, as an array of
numbers. The elements of the array are root-mean-square volume levels,
evenly spaced from 0 hertz to 24,000 hertz. If any of the analyzer's
inputs come from an AudioDeviceInput, or this method is used from
a server script, it returns an empty array.
Returns
Array— A table of numbers representing the amplitude levels of various frequencies of audio within the last buffer, or an empty table if a spectrum cannot be obtained.
Events 1#
| WiringChanged | Fires when another instance is connected to or disconnected from the
AudioAnalyzer via a Wire. |
WiringChanged(connected: boolean, pin: string, wire: Wire, instance: Instance)#
Event that fires after a Wire becomes connected or disconnected,
and that Wire is now or was previously connected to a pin on the
AudioAnalyzer and to some other wirable instance.
| Name | Type | Default | Description |
|---|---|---|---|
connected | boolean | Whether the instance got connected or disconnected. | |
pin | string | The pin on the AudioAnalyzer that the Wire targets. | |
wire | Wire | The Wire between the AudioAnalyzer and the other
instance. | |
instance | Instance | The other instance that is or was connected through the Wire. |
Inherited members#
Inherited from Instance 58
Properties (10)
Archivable, archivable, Capabilities, IsInSandbox, Name, Parent, PredictionMode, RobloxLocked, Sandboxed, UniqueId
Methods (39)
AddTag, children, ClearAllChildren, Clone, clone, Destroy, destroy, FindFirstAncestor, FindFirstAncestorOfClass, FindFirstAncestorWhichIsA, FindFirstChild, findFirstChild, FindFirstChildOfClass, FindFirstChildWhichIsA, FindFirstDescendant, GetActor, GetAttribute, GetAttributeChangedSignal, GetAttributes, GetChildren, getChildren, GetDebugId, GetDescendants, GetFullName, GetStyled, GetStyledPropertyChangedSignal, GetTags, HasTag, IsAncestorOf, IsDescendantOf, isDescendantOf, IsPropertyModified, QueryDescendants, Remove, remove, RemoveTag, ResetPropertyToDefault, SetAttribute, WaitForChild