ipytone.AudioBuffer#

class ipytone.AudioBuffer(**kwargs: Any)#

Bases: ToneObject

Audio buffer loaded from an URL or an array.

Parameters:
  • url_or_array (str or array-like or array widget) – Buffer file (URL) or data.

  • sync_array (bool, optional) – If True, the array trait will be synchronized as soon as the audio buffer is loaded in the front-end (default: False). It is ignored if an array is already given as buffer data or if the duration of the buffer exceeds 10 seconds.

  • reverse (bool, optional) – If True, the audio buffer is reversed (default: False).

__init__(url_or_array, sync_array=False, reverse=False, **kwargs)#

Public constructor

Methods

dispose()

Dispose and disconnect this node.

Attributes

array

A trait type representing a Union type.

buffer_url

Buffer loaded from this URL (None if an array is used)

disposed

Returns True if the node was disposed (i.e., disconnected and web audio node freed for garbage collection).

duration

Buffer duration in seconds (0 if not loaded)

length

Buffer size in samples (0 if not loaded)

loaded

True if the audio buffer is loaded

log

A trait whose value must be an instance of a specified class.

n_channels

Number of discrete audio channels (0 if not loaded)

reverse

True if the buffer is reversed

sample_rate

Buffer sample rate (0 if not loaded)

buffer_url#

Buffer loaded from this URL (None if an array is used)

dispose()#

Dispose and disconnect this node.

property disposed#

Returns True if the node was disposed (i.e., disconnected and web audio node freed for garbage collection).

duration#

Buffer duration in seconds (0 if not loaded)

length#

Buffer size in samples (0 if not loaded)

loaded#

True if the audio buffer is loaded

n_channels#

Number of discrete audio channels (0 if not loaded)

reverse#

True if the buffer is reversed

sample_rate#

Buffer sample rate (0 if not loaded)