元编程参考文档

格式

8 个节点

本页内容 8

改变速度

函数

Plays a clip faster or slower, the way a tape or a record does - pitch and tempo change together.

签名
改变速度(音频: AudioBuffer, 系数: 数字) -> AudioBuffer
AudioBuffer ChangeSpeed(AudioBuffer audio, double factor = 1.5)

参数

名称类型默认值说明
音频AudioBuffer—The clip to change.
系数数字1.5How much faster: above 1 speeds up, below 1 slows down.

返回

音频AudioBuffer

备注

A factor of 2 is twice as fast and an octave higher; 0.5 is half speed and an octave lower.

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

由样本生成

函数

A one-channel clip made from an array of numbers from -1 to 1, one per sample.

签名
由样本生成(样本: 数字数组, 采样率: 整数) -> AudioBuffer
AudioBuffer FromSamples(
    double[] samples,
    int sampleRate = 44100)

参数

名称类型默认值说明
样本数字数组—The samples, in order.
采样率整数44100How many of them make a second.

返回

音频AudioBuffer

备注

Values beyond -1 and 1 are clipped when the clip is stored.

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

声像

函数

Places a clip between the left and right speakers.

签名
声像(音频: AudioBuffer, 位置: 数字) -> AudioBuffer
AudioBuffer Pan(AudioBuffer audio, double position = 0)

参数

名称类型默认值说明
音频AudioBuffer—The clip to place.
位置数字0-1 is fully left, 0 the centre, 1 fully right.

返回

音频AudioBuffer

备注

A mono clip is panned at constant power - at the centre each side is 3 dB down, so it sounds as loud wherever it is placed. A stereo clip is balanced instead: the side it moves away from is turned down and the near side is left alone, so at the centre it passes through unchanged.

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

重采样

函数

Converts a clip to another sample rate without changing how it sounds.

签名
重采样(音频: AudioBuffer, 采样率: 整数) -> AudioBuffer
AudioBuffer Resample(AudioBuffer audio, int sampleRate = 48000)

参数

名称类型默认值说明
音频AudioBuffer—The clip to convert.
采样率整数48000The new number of samples per second.

返回

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

转为单声道

函数

Mixes every channel of a clip down to one.

签名
转为单声道(音频: AudioBuffer) -> AudioBuffer
AudioBuffer ToMono(AudioBuffer audio)

参数

名称类型默认值说明
音频AudioBuffer—The clip to mix down.

返回

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

转为样本

函数

One channel of a clip as an array of numbers from -1 to 1, one per sample - for arithmetic the toolbox has no node for.

签名
转为样本(音频: AudioBuffer, 声道: 整数) -> 数字数组
double[] ToSamples(AudioBuffer audio, int channel = 0)

参数

名称类型默认值说明
音频AudioBuffer—The clip to read.
声道整数0Which channel, counting from 0; 0 is the left of a stereo clip.

返回

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

转为标准格式

函数

Converts a clip to the platform's standard 44.1 kHz stereo segment, which some other toolboxes ask for.

签名
转为标准格式(音频: AudioBuffer) -> StandardAudioSegment
StandardAudioSegment ToStandard(AudioBuffer audio)

参数

名称类型默认值说明
音频AudioBuffer—The clip to convert.

返回

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

转为立体声

函数

Gives a clip two channels: a mono clip is heard equally on both sides, and a clip with more than two keeps its first two.

签名
转为立体声(音频: AudioBuffer) -> AudioBuffer
AudioBuffer ToStereo(AudioBuffer audio)

参数

名称类型默认值说明
音频AudioBuffer—The clip to convert.

返回

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