元编程参考文档

生成

7 个节点

本页内容 7

噪声

函数

Random noise of a chosen colour.

签名
噪声 -> AudioBuffer
    颜色: Noise Color
    时长: 数字
    振幅: 数字
    种子: 整数
    采样率: 整数
AudioBuffer Noise(
    NoiseColor color = NoiseColor.White,
    double duration = 1,
    double amplitude = 0.5,
    int seed = 1,
    int sampleRate = 44100)

参数

名称类型默认值说明
颜色Noise Color白噪声White hisses, pink sounds like rain, brown rumbles.
时长数字1Length, in seconds.
振幅数字0.5Peak level, from 0 to 1.
种子整数1Which take of the noise.
采样率整数44100Samples per second.

返回

音频AudioBuffer

备注

The same seed gives the same noise every time, so a document sounds the same on every run; change the seed for a different take.

所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
生成
所属包
音频处理

音符频率

函数

The frequency of a note named the way a musician writes it: A4, C#5, Eb3.

签名
音符频率(音符: 文本) -> 数字
double NoteFrequency(string note = "A4")

参数

名称类型默认值说明
音符文本A4A letter A to G, an optional # or b, and an octave number.

返回

频率数字

备注

Equal temperament with A4 at 440 Hz; middle C is C4. A sharp is # and a flat is b.

所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
生成
所属包
音频处理

静音

函数

Nothing, for a length of time - a gap between sounds, or a bed to mix them onto.

签名
静音(时长: 数字, 声道数: 整数, 采样率: 整数) -> AudioBuffer
AudioBuffer Silence(
    double duration = 1,
    int channels = 1,
    int sampleRate = 44100)

参数

名称类型默认值说明
时长数字1Length, in seconds.
声道数整数1How many channels: 1 for mono, 2 for stereo.
采样率整数44100Samples per second.

返回

音频AudioBuffer
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
生成
所属包
音频处理

音效

函数

A synthesized game sound effect - a coin, a laser, an explosion, footsteps, rain - from the built-in recipe library.

签名
音效(名称: 文本, 种子: 整数) -> AudioBuffer
AudioBuffer SoundEffect(
    string name = "Pickup/Coin",
    int seed = 1)

参数

名称类型默认值说明
名称文本Pickup/CoinThe effect's name, such as Pickup/Coin, Weapon/Laser or Ambient/Rain.
种子整数1Which take of the effect.

返回

音频AudioBuffer

备注

Every effect is made from oscillators, noise and filters as it is rendered; nothing is a recording. Each seed is a slightly different take of the same effect, which is what stops a sound played a hundred times from sounding like one sample played a hundred times. AudioGenerators.SoundEffectNames lists every name.

所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
生成
所属包
音频处理

音效名称

函数

The name of every effect AudioGenerators.SoundEffect can make.

签名
音效名称() -> 文本数组
string[] SoundEffectNames()

返回

名称文本数组
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
生成
所属包
音频处理

扫频

函数

A tone whose pitch glides from one frequency to another, evenly in musical terms - each octave takes the same time.

签名
扫频 -> AudioBuffer
    起始频率: 数字
    结束频率: 数字
    时长: 数字
    振幅: 数字
    波形: Waveform
    采样率: 整数
AudioBuffer Sweep(
    double startFrequency = 100,
    double endFrequency = 8000,
    double duration = 3,
    double amplitude = 0.5,
    Waveform waveform = Waveform.Sine,
    int sampleRate = 44100)

参数

名称类型默认值说明
起始频率数字100Where the glide starts, in hertz.
结束频率数字8000Where it ends, in hertz.
时长数字3Length, in seconds.
振幅数字0.5Peak level, from 0 to 1.
波形Waveform正弦波The tone's shape.
采样率整数44100Samples per second.

返回

音频AudioBuffer

备注

A sweep is the standard test signal for a filter or an effect: every frequency passes through it once, so its spectrogram is a single rising line and anything the effect does to one part of the spectrum shows as a change in that line.

所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
生成
所属包
音频处理

音调

函数

A steady tone of one pitch.

签名
音调 -> AudioBuffer
    频率: 数字
    时长: 数字
    振幅: 数字
    波形: Waveform
    采样率: 整数
AudioBuffer Tone(
    double frequency = 440,
    double duration = 1,
    double amplitude = 0.5,
    Waveform waveform = Waveform.Sine,
    int sampleRate = 44100)

参数

名称类型默认值说明
频率数字440Pitch, in hertz. 440 is the A above middle C.
时长数字1Length, in seconds.
振幅数字0.5Peak level, from 0 (silent) to 1 (full scale).
波形Waveform正弦波Sine is pure; square, triangle and saw add harmonics and sound brighter.
采样率整数44100Samples per second.

返回

音频AudioBuffer
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
生成
所属包
音频处理