--- title: BaseAudioContext.createConstantSource() slug: Web/API/BaseAudioContext/createConstantSource translation_of: Web/API/BaseAudioContext/createConstantSource ---

{{APIRef("Web Audio API")}}

 createConstantSource() 是 {{domxref("BaseAudioContext")}} 接口的一个方法, 用于生成一个 {{domxref("ConstantSourceNode")}} 对象, 该对象是一个输出单信道(one-channel)音频信号的音频源,这些音频信号都拥有一个恒定的样本值。

Syntax

var constantSourceNode = AudioContext.createConstantSource()

Parameters

None.

Returns

A {{domxref('ConstantSourceNode')}} instance.

Specifications

Specification Status Comment
{{SpecName('Web Audio API','#dom-baseaudiocontext-createconstantsource','createConstantSource()')}} {{Spec2('Web Audio API')}} Initial definition.

Browser Compatibility

{{CompatibilityTable}}
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support {{CompatChrome(56.0)}} {{CompatVersionUnknown}} {{CompatUnknown}} {{CompatOpera(43)}} {{CompatUnknown}}
Implemented on AudioContext {{CompatChrome(10.0)}}{{property_prefix("webkit")}} {{CompatVersionUnknown}} {{CompatNo}} 15.0{{property_prefix("webkit")}}
22 (unprefixed)
6.0{{property_prefix("webkit")}}
Feature Android Android Webview Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support {{CompatNo}} {{CompatChrome(56.0)}} {{CompatVersionUnknown}} {{CompatUnknown}} {{CompatOperaMobile(43)}} {{CompatUnknown}} {{CompatChrome(56.0)}}
Implemented on AudioContext {{CompatUnknown}} {{CompatVersionUnknown}} 26.0 {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} 33.0