元编程参考文档

频谱

8 个节点

本页内容 8

绘制短时频谱

函数

Draws a spectrogram: time across, frequency up, and how strong each frequency is at each moment as brightness.

签名
绘制短时频谱 -> Pixel Image
    频谱: Audio Spectrogram
    宽度: 整数
    高度: 整数
PixelImage DrawTransform(
    AudioSpectrogram spectrogram,
    int width = 800,
    int height = 300)

参数

名称类型默认值说明
频谱Audio Spectrogram—The transform.
宽度整数800Pixels across.
高度整数300Pixels up.

返回

图像Pixel Image

备注

Several channels are drawn as their average. Levels run from -100 dB, black, to 0 dB, white, through the same colours as Draw Spectrogram, so a band taken out shows as a dark stripe.

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

逆变换

函数

Puts a clip back together from its frequencies: the inverse short-time Fourier transform.

签名
逆变换(频谱: Audio Spectrogram) -> AudioBuffer
AudioBuffer Inverse(AudioSpectrogram spectrogram)

参数

名称类型默认值说明
频谱Audio Spectrogram—The transform, changed or not.

返回

音频AudioBuffer

备注

Each frame is turned back into samples, windowed again and overlap-added, and the sum divided by how much window covers each sample. A spectrogram nothing has changed comes back as the clip it was taken from, to within float rounding.

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

保留频段

函数

Keeps only the frequencies from Low up to High.

签名
保留频段 -> Audio Spectrogram
    频谱: Audio Spectrogram
    下限: 数字
    上限: 数字
AudioSpectrogram KeepBand(
    AudioSpectrogram spectrogram,
    double low = 300,
    double high = 3000)

参数

名称类型默认值说明
频谱Audio Spectrogram—The transform.
下限数字300The band's lower edge, in hertz.
上限数字3000The band's upper edge, in hertz; above half the sample rate means everything from the lower edge up.

返回

频谱Audio Spectrogram

备注

A frequency is kept when its bin's centre lies in the band, low end included and high end not, and the rest are set to nothing. Keep Band and Remove Band with the same edges are exact complements: the two inverses add up to the clip.

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

去除频段

函数

Takes out the frequencies from Low up to High and keeps the rest.

签名
去除频段 -> Audio Spectrogram
    频谱: Audio Spectrogram
    下限: 数字
    上限: 数字
AudioSpectrogram RemoveBand(
    AudioSpectrogram spectrogram,
    double low = 300,
    double high = 3000)

参数

名称类型默认值说明
频谱Audio Spectrogram—The transform.
下限数字300The band's lower edge, in hertz.
上限数字3000The band's upper edge, in hertz.

返回

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

分离谐波与打击

函数

Divides a clip into what holds steady - notes, chords, sustained voices - and what is brief and broad - drums, clicks, consonants.

签名
分离谐波与打击 -> (谐波: AudioBuffer, 打击: AudioBuffer)
    音频: AudioBuffer
    中值窗: 整数
    幂次: 数字
    帧长: 整数
    帧移: 整数
void SeparateHarmonicPercussive(
    AudioBuffer audio,
    out AudioBuffer harmonic,
    out AudioBuffer percussive,
    int kernel = 31,
    double power = 2,
    int frameSize = 2048,
    int hop = 512)

参数

名称类型默认值说明
音频AudioBuffer—The clip.
中值窗整数31How many frames, and frequencies, each median spans; odd. Wider separates more firmly and smears more.
幂次数字2How firmly each frequency is given to one side: 1 shares in proportion, 2 is librosa's default, higher approaches all or nothing.
帧长整数2048Samples per frame, as Short-Time Transform takes it.
帧移整数512Samples between frames, as Short-Time Transform takes it.

返回

谐波AudioBuffer
打击AudioBuffer

备注

Fitzgerald's median-filtering method, as librosa's decompose.hpss computes it: across time the steady parts stand out, across frequency the sharp ones do, and each frequency at each moment is shared between the two in proportion. The shares add to one everywhere, so the two parts mixed together are the clip.

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

拆分频段

函数

Divides a clip into frequency bands - lows, mids, highs, or as many as the edges make - which add back up to the clip.

签名
拆分频段 -> AudioBuffer 数组
    音频: AudioBuffer
    分界: 数字数组
    帧长: 整数
    帧移: 整数
AudioBuffer[] SplitIntoBands(
    AudioBuffer audio,
    double[] edges,
    int frameSize = 2048,
    int hop = 512)

参数

名称类型默认值说明
音频AudioBuffer—The clip.
分界数字数组—Where one band ends and the next begins, in hertz, rising.
帧长整数2048Samples per frame, as Short-Time Transform takes it.
帧移整数512Samples between frames, as Short-Time Transform takes it.

返回

频段AudioBuffer 数组

备注

Edges at 250 and 4000 Hz give three clips: everything below 250 Hz, 250 to 4000 Hz, and everything above. Every frequency lands in exactly one band, so Mix All of the bands is the clip again.

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

最强频率

函数

The frequencies a clip holds most of - its constituents, strongest first, each with its level and the note nearest it.

签名
最强频率(音频: AudioBuffer, 数量: 整数) -> Table
Table StrongestFrequencies(AudioBuffer audio, int count = 10)

参数

名称类型默认值说明
音频AudioBuffer—The clip.
数量整数10How many to list.

返回

频率Table

备注

Peaks of the clip's averaged spectrum, each placed between bins by fitting a parabola to it and its neighbours. A peak within a semitone of a stronger one is the same constituent's skirt and is left out.

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

短时傅里叶变换

函数

Takes a clip apart into its frequencies over time: the short-time Fourier transform.

签名
短时傅里叶变换 -> Audio Spectrogram
    音频: AudioBuffer
    帧长: 整数
    帧移: 整数
AudioSpectrogram Transform(
    AudioBuffer audio,
    int frameSize = 2048,
    int hop = 512)

参数

名称类型默认值说明
音频AudioBuffer—The clip.
帧长整数2048Samples per frame, a power of two from 64 to 32768: larger tells close frequencies apart, smaller places changes more exactly in time.
帧移整数512Samples from one frame to the next, at most a quarter of the frame so the frames overlap enough to rebuild the clip.

返回

频谱Audio Spectrogram

备注

Each channel is cut into Hann-windowed frames of Frame Size samples, one every Hop, and each frame becomes the amplitude and phase of every frequency in it. The clip is padded with half a frame of silence at each end, as librosa and SciPy do, so its first and last moments come back too.

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