Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. ScriptProcessorNode

ScriptProcessorNode

Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see thecompatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

TheScriptProcessorNode interface allows the generation, processing, or analyzing of audio using JavaScript.

EventTarget AudioNode ScriptProcessorNode

Note:This feature was replaced byAudioWorklets and theAudioWorkletNode interface.

TheScriptProcessorNode interface is anAudioNode audio-processing module that is linked to two buffers, one containing the input audio data, one containing the processed output audio data. An event, implementing theAudioProcessingEvent interface, is sent to the object each time the input buffer contains new data, and the event handler terminates when it has filled the output buffer with data.

The ScriptProcessorNode stores the input in a buffer, send the audioprocess event. The EventHandler takes the input buffer and fill the output buffer which is sent to the output by the ScriptProcessorNode.

The size of the input and output buffer are defined at the creation time, when theBaseAudioContext.createScriptProcessor method is called (both are defined byBaseAudioContext.createScriptProcessor'sbufferSize parameter). The buffer size must be a power of 2 between256 and16384, that is256,512,1024,2048,4096,8192 or16384. Small numbers lower thelatency, but large number may be necessary to avoid audio breakup and glitches.

If the buffer size is not defined, which is recommended, the browser will pick one that its heuristic deems appropriate.

Number of inputs1
Number of outputs1
Channel count mode"max"
Channel count2 (not used in the default count mode)
Channel interpretation"speakers"

Instance properties

Inherits properties from its parent,AudioNode.

ScriptProcessorNode.bufferSizeRead onlyDeprecated

Returns an integer representing both the input and output buffer size. Its value can be a power of 2 value in the range25616384.

Instance methods

No specific methods; inherits methods from its parent,AudioNode.

Events

Listen to these events usingaddEventListener() or by assigning an event listener to theoneventname property of this interface:

audioprocessDeprecated

Fired when an input buffer of aScriptProcessorNode is ready to be processed.Also available via theonaudioprocess event handler property.

Examples

SeeBaseAudioContext.createScriptProcessor() for example code.

Specifications

Specification
Web Audio API
# dom-scriptprocessornode-buffersize

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp