---
name: AudioStreamReader
last_updated: 2026-11-11T22:23:24Z
inherits:
  - Instance
  - Object
type: class
memory_category: Internal
tags:
  - NotBrowsable
summary: "Reads audio samples from a connected audio stream into Luau buffers for custom analysis."
---

# Class: AudioStreamReader

> Reads audio samples from a connected audio stream into Luau buffers for custom
> analysis.

## Description

[AudioStreamReader](/docs/reference/engine/classes/AudioStreamReader.md) reads audio samples from a connected audio stream
into Luau buffers, enabling custom analysis such as beat detection, pitch
detection, or spectral processing. It provides a single **Input** pin and does
not produce any output streams.

The reader maintains an internal ring buffer whose size is controlled by
[WindowSize](/docs/reference/engine/classes/AudioStreamReader.md). Incoming audio accumulates in
the buffer and can be consumed with [Read()](/docs/reference/engine/classes/AudioStreamReader.md) or
observed non-destructively with [Peek()](/docs/reference/engine/classes/AudioStreamReader.md).

Note that [AudioStreamReader](/docs/reference/engine/classes/AudioStreamReader.md) can only be used in Roblox Studio and
cannot be used in Team Create sessions.

## Properties

### Property: AudioStreamReader.Layout

```json
{
  "type": "AudioChannelLayout",
  "access": "ReadWrite",
  "security": {
    "read": "None",
    "write": "None"
  },
  "serialization": {
    "can_load": true,
    "can_save": true
  },
  "thread_safety": "ReadSafe",
  "category": "State",
  "capabilities": [
    "Audio"
  ]
}
```

The channel layout of the audio stream that the reader expects. This
determines how many buffers must be passed to
[Read()](/docs/reference/engine/classes/AudioStreamReader.md) and
[Peek()](/docs/reference/engine/classes/AudioStreamReader.md). For example, a
[Stereo](/docs/reference/engine/enums/AudioChannelLayout.md) layout requires two buffers per call.

### Property: AudioStreamReader.SampleFormat

```json
{
  "type": "AudioSampleFormat",
  "access": "ReadWrite",
  "security": {
    "read": "None",
    "write": "None"
  },
  "serialization": {
    "can_load": false,
    "can_save": true
  },
  "thread_safety": "ReadSafe",
  "category": "State",
  "capabilities": [
    "Audio"
  ]
}
```

The sample format of the audio data stored in the internal buffer. This
property is currently read-only and is always
[Float32](/docs/reference/engine/enums/AudioSampleFormat.md).

### Property: AudioStreamReader.SampleRate

```json
{
  "type": "int",
  "access": "ReadWrite",
  "security": {
    "read": "None",
    "write": "None"
  },
  "serialization": {
    "can_load": false,
    "can_save": true
  },
  "thread_safety": "ReadSafe",
  "category": "State",
  "capabilities": [
    "Audio"
  ]
}
```

The sample rate of the audio data, in Hertz. This property is currently
read-only and is always `48000`.

### Property: AudioStreamReader.WindowSize

```json
{
  "type": "AudioWindowSize",
  "access": "ReadWrite",
  "security": {
    "read": "None",
    "write": "None"
  },
  "serialization": {
    "can_load": true,
    "can_save": true
  },
  "thread_safety": "ReadSafe",
  "category": "State",
  "capabilities": [
    "Audio"
  ]
}
```

Controls the size of the internal ring buffer that accumulates audio
samples. Larger windows store more audio history, allowing larger reads,
but consume more memory. Smaller windows reduce latency but may overflow
sooner if reads are infrequent.

## Methods

### Method: AudioStreamReader:GetConnectedWires

**Signature:** `AudioStreamReader:GetConnectedWires(pin: string): List<Wire>`

Returns an array of [Wires](/docs/reference/engine/classes/Wire.md) that are connected to the specified
pin. [AudioStreamReader](/docs/reference/engine/classes/AudioStreamReader.md) has one **Input** pin.

*Security: None · Thread Safety: Unsafe · Capabilities: Audio*

**Parameters:**

| Name | Type | Default | Description |
|------|------|---------|-------------|
| `pin` | `string` |  | An input or output pin on this instance. |

**Returns:** `List<Wire>` — An array of [Wires](/docs/reference/engine/classes/Wire.md).

### Method: AudioStreamReader:GetInputPins

**Signature:** `AudioStreamReader:GetInputPins(): Array`

Gets the list of pins that [Wire](/docs/reference/engine/classes/Wire.md) can use in [Wire.TargetName](/docs/reference/engine/classes/Wire.md)
to connect to this instance via its [Wire.TargetInstance](/docs/reference/engine/classes/Wire.md) property.

For [AudioStreamReader](/docs/reference/engine/classes/AudioStreamReader.md), this is `Input` only.

*Security: None · Thread Safety: Unsafe · Capabilities: Audio*

**Returns:** `Array` — An array of strings representing valid pin names.

### Method: AudioStreamReader:GetOutputPins

**Signature:** `AudioStreamReader:GetOutputPins(): Array`

Gets the list of pins that [Wire](/docs/reference/engine/classes/Wire.md) can use in [Wire.SourceName](/docs/reference/engine/classes/Wire.md)
to connect to this instance via its [Wire.SourceInstance](/docs/reference/engine/classes/Wire.md) property.

For [AudioStreamReader](/docs/reference/engine/classes/AudioStreamReader.md), there are none.

*Security: None · Thread Safety: Unsafe · Capabilities: Audio*

**Returns:** `Array` — An array of strings representing valid pin names.

### Method: AudioStreamReader:Peek

**Signature:** `AudioStreamReader:Peek(into: Array): int`

Reads audio samples from the internal buffer without consuming them.
Unlike [Read()](/docs/reference/engine/classes/AudioStreamReader.md), peeked samples remain in the
buffer and will be returned again on subsequent calls. This is useful for
overlapping analysis windows. The number of buffers in the array must
match the number of channels specified by
[Layout](/docs/reference/engine/classes/AudioStreamReader.md). Returns the number of frames
actually written, which may be less than the buffer length if insufficient
data is available.

*Security: None · Thread Safety: Safe · Capabilities: Audio*

**Parameters:**

| Name | Type | Default | Description |
|------|------|---------|-------------|
| `into` | `Array` |  | An array of buffers, one per channel, to write samples into. |

**Returns:** `int` — The number of frames written into the buffers.

### Method: AudioStreamReader:Read

**Signature:** `AudioStreamReader:Read(into: Array): int`

Reads audio samples from the internal buffer and removes them, advancing
the read position. The number of buffers in the array must match the
number of channels specified by [Layout](/docs/reference/engine/classes/AudioStreamReader.md).
Returns the number of frames actually written, which may be less than the
buffer length if insufficient data is available.

*Security: None · Thread Safety: Safe · Capabilities: Audio*

**Parameters:**

| Name | Type | Default | Description |
|------|------|---------|-------------|
| `into` | `Array` |  | An array of buffers, one per channel, to write samples into. |

**Returns:** `int` — The number of frames written into the buffers.

## Events

### Event: AudioStreamReader.WiringChanged

**Signature:** `AudioStreamReader.WiringChanged(connected: boolean, pin: string, wire: Wire, instance: Instance)`

Event that fires after a [Wire](/docs/reference/engine/classes/Wire.md) becomes connected or disconnected,
and that [Wire](/docs/reference/engine/classes/Wire.md) is now or was previously connected to a pin on the
[AudioStreamReader](/docs/reference/engine/classes/AudioStreamReader.md) and to some other wirable instance.

*Security: None · Capabilities: Audio*

**Parameters:**

| Name | Type | Description |
|------|------|-------------|
| `connected` | `boolean` | Whether the instance got connected or disconnected. |
| `pin` | `string` | The pin on the [AudioStreamReader](/docs/reference/engine/classes/AudioStreamReader.md) that the [Wire](/docs/reference/engine/classes/Wire.md) targets. |
| `wire` | `Wire` | The [Wire](/docs/reference/engine/classes/Wire.md) between the [AudioStreamReader](/docs/reference/engine/classes/AudioStreamReader.md) and the other instance. |
| `instance` | `Instance` | The other instance that is or was connected through the [Wire](/docs/reference/engine/classes/Wire.md). |

## Inherited Members

### From [Instance](/docs/reference/engine/classes/Instance.md)

- **Property `Archivable`** (`boolean`): Determines if an Instance and its descendants can be cloned using
- **Property `archivable`** (`boolean`):  *(deprecated, hidden)*
- **Property `Capabilities`** (`SecurityCapabilities`): The set of capabilities allowed to be used for scripts inside this
- **Property `IsInSandbox`** (`boolean`): Indicates whether the instance is inside a sandboxed container.
- **Property `Name`** (`string`): A non-unique identifier of the Instance.
- **Property `Parent`** (`Instance`): Determines the hierarchical parent of the Instance.
- **Property `PredictionMode`** (`PredictionMode`): Reflects the client-side prediction mode applied to the instance under
- **Property `RobloxLocked`** (`boolean`): A deprecated property that used to protect CoreGui objects. *(hidden)*
- **Property `Sandboxed`** (`boolean`): When enabled, the instance can only access abilities in its `Capabilities`
- **Property `UniqueId`** (`UniqueId`): A unique identifier for the instance.
- **Method `AddTag(tag: string): ()`**: Applies a tag to the instance.
- **Method `children(): Instances`**: Returns an array of the object's children. *(deprecated)*
- **Method `ClearAllChildren(): ()`**: This method destroys all of an instance's children.
- **Method `Clone(): Instance`**: Create a copy of an instance and all its descendants, ignoring instances
- **Method `clone(): Instance`**:  *(deprecated)*
- **Method `Destroy(): ()`**: Sets the Instance.Parent property to `nil`, locks the
- **Method `destroy(): ()`**:  *(deprecated)*
- **Method `FindFirstAncestor(name: string): Instance?`**: Returns the first ancestor of the Instance whose
- **Method `FindFirstAncestorOfClass(className: string): Instance?`**: Returns the first ancestor of the Instance whose
- **Method `FindFirstAncestorWhichIsA(className: string): Instance?`**: Returns the first ancestor of the Instance for whom
- **Method `FindFirstChild(name: string, recursive?: boolean): Instance?`**: Returns the first child of the Instance found with the given name.
- **Method `findFirstChild(name: string, recursive?: boolean): Instance`**:  *(deprecated)*
- **Method `FindFirstChildOfClass(className: string): Instance?`**: Returns the first child of the Instance whose
- **Method `FindFirstChildWhichIsA(className: string, recursive?: boolean): Instance?`**: Returns the first child of the Instance for whom
- **Method `FindFirstDescendant(name: string): Instance?`**: Returns the first descendant found with the given Instance.Name.
- **Method `GetActor(): Actor?`**: Returns the Actor associated with the Instance, if any.
- **Method `GetAttribute(attribute: string): Variant`**: Returns the value which has been assigned to the given attribute name.
- **Method `GetAttributeChangedSignal(attribute: string): RBXScriptSignal`**: Returns an event that fires when the given attribute changes.
- **Method `GetAttributes(): Dictionary`**: Returns a dictionary of the instance's attributes.
- **Method `GetChildren(): Instances`**: Returns an array containing all of the instance's children.
- **Method `getChildren(): Instances`**:  *(deprecated)*
- **Method `GetDebugId(scopeLength?: int): string`**: Returns a coded string of the debug ID used internally by Roblox.
- **Method `GetDescendants(): Instances`**: Returns an array containing all of the descendants of the instance.
- **Method `GetFullName(): string`**: Returns a string describing the instance's ancestry.
- **Method `GetStyled(name: string, selector: string?): Variant`**: Returns the styled or explicitly modified value of the specified property,
- **Method `GetStyledPropertyChangedSignal(property: string): RBXScriptSignal`**: Returns an event that fires when the given style property changes on the
- **Method `GetTags(): Array`**: Gets an array of all tags applied to the instance.
- **Method `HasTag(tag: string): boolean`**: Check whether the instance has a given tag.
- **Method `IsAncestorOf(descendant: Instance): boolean`**: Returns true if an Instance is an ancestor of the given
- **Method `IsDescendantOf(ancestor: Instance): boolean`**: Returns `true` if an Instance is a descendant of the given
- **Method `isDescendantOf(ancestor: Instance): boolean`**:  *(deprecated)*
- **Method `IsPropertyModified(property: string): boolean`**: Returns `true` if the value stored in the specified property is not equal
- **Method `QueryDescendants(selector: string): Instances`**: Returns an array containing all descendants of the instance that match the
- **Method `Remove(): ()`**: Sets the object's `Parent` to `nil`, and does the same for all its *(deprecated)*
- **Method `remove(): ()`**:  *(deprecated)*
- **Method `RemoveTag(tag: string): ()`**: Removes a tag from the instance.
- **Method `ResetPropertyToDefault(property: string): ()`**: Resets a property to its default value.
- **Method `SetAttribute(attribute: string, value: Variant): ()`**: Sets the attribute with the given name to the given value.
- **Method `WaitForChild(childName: string, timeOut: double): Instance`**: Returns the child of the Instance with the given name. If the
- **Event `AncestryChanged`**: Fires when the Instance.Parent property of this object or one of
- **Event `AttributeChanged`**: Fires whenever an attribute is changed on the Instance.
- **Event `ChildAdded`**: Fires after an object is parented to this Instance.
- **Event `childAdded`**:  *(deprecated)*
- **Event `ChildRemoved`**: Fires after a child is removed from this Instance.
- **Event `DescendantAdded`**: Fires after a descendant is added to the Instance.
- **Event `DescendantRemoving`**: Fires immediately before a descendant of the Instance is removed.
- **Event `Destroying`**: Fires immediately before (or is deferred until after) the instance is
- **Event `StyledPropertiesChanged`**: Fires whenever any style property is changed on the instance, including

### From [Object](/docs/reference/engine/classes/Object.md)

- **Property `ClassName`** (`string`): A read-only string representing the class this Object belongs to.
- **Property `className`** (`string`):  *(deprecated)*
- **Method `GetPropertyChangedSignal(property: string): RBXScriptSignal`**: Get an event that fires when a given property of the object changes.
- **Method `IsA(className: string): boolean`**: Returns true if an object's class matches or inherits from a given class.
- **Method `isA(className: string): boolean`**:  *(deprecated)*
- **Event `Changed`**: Fires immediately after a property of the object changes, with some