WebAudio

This domain allows inspection of Web Audio API. https://webaudio.github.io/web-audio-api/

This CDP domain is experimental.

Types

Generally, you do not need to instantiate CDP types yourself. Instead, the API creates objects for you as return values from commands, and then you can use those objects as arguments to other commands.

class cdp.web_audio.ContextId

Context’s UUID in string

class cdp.web_audio.ContextType

Enum of BaseAudioContext types

OFFLINE = 'offline'
REALTIME = 'realtime'
class cdp.web_audio.ContextState

Enum of AudioContextState from the spec

CLOSED = 'closed'
RUNNING = 'running'
SUSPENDED = 'suspended'
class cdp.web_audio.ContextRealtimeData(current_time, render_capacity, callback_interval_mean, callback_interval_variance)

Fields in AudioContext that change in real-time.

callback_interval_mean = None

A running mean of callback interval.

callback_interval_variance = None

A running variance of callback interval.

current_time = None

The current context time in second in BaseAudioContext.

render_capacity = None

The time spent on rendering graph divided by render qunatum duration, and multiplied by 100. 100 means the audio renderer reached the full capacity and glitch may occur.

class cdp.web_audio.BaseAudioContext(context_id, context_type, context_state, callback_buffer_size, max_output_channel_count, sample_rate, realtime_data=None)

Protocol object for BaseAudioContext

callback_buffer_size = None

Platform-dependent callback buffer size.

max_output_channel_count = None

Number of output channels supported by audio hardware in use.

realtime_data = None
sample_rate = None

Context sample rate.

Commands

Each command is a generator function. The return type Generator[x, y, z] indicates that the generator yields arguments of type x, it must be resumed with an argument of type y, and it returns type z. In this library, types x and y are the same for all commands, and z is the return type you should pay attention to. For more information, see Getting Started: Commands.

cdp.web_audio.disable()

Disables the WebAudio domain.

Return type:Generator[Dict[str, Any], Dict[str, Any], None]
cdp.web_audio.enable()

Enables the WebAudio domain and starts sending context lifetime events.

Return type:Generator[Dict[str, Any], Dict[str, Any], None]
cdp.web_audio.get_realtime_data(context_id)

Fetch the realtime data from the registered contexts.

Parameters:context_id (ContextId) –
Return type:Generator[Dict[str, Any], Dict[str, Any], ContextRealtimeData]
Returns:

Events

Generally, you do not need to instantiate CDP events yourself. Instead, the API creates events for you and then you use the event’s attributes.

class cdp.web_audio.ContextCreated(context)

Notifies that a new BaseAudioContext has been created.

class cdp.web_audio.ContextDestroyed(context_id)

Notifies that existing BaseAudioContext has been destroyed.

class cdp.web_audio.ContextChanged(context)

Notifies that existing BaseAudioContext has changed some properties (id stays the same)..