Wolfram 语言

时间序列处理

用时间序列生成音频信号

用一个规则取样的 TimeSeries 控制正弦波的频率.

In[1]:=
Click for copyable input
n = 50; frequencies = RandomReal[{100, 300}, n]; reg = TimeSeries[frequencies, {0, Automatic, .3}];
In[2]:=
Click for copyable input
AudioGenerator[{"Sin", reg}]
Out[2]=

用一个不规则取样的 TimeSeries 控制正弦波的频率.

In[3]:=
Click for copyable input
times = Accumulate[RandomReal[{0.1, .5}, n]]; irreg = TimeSeries[frequencies, {times}];
In[4]:=
Click for copyable input
AudioGenerator[{"Sin", irreg}]
Out[4]=

WhiteNoiseProcess 生成一个白噪声.

In[5]:=
Click for copyable input
sample = RandomFunction[WhiteNoiseProcess[1/3], {88200}]
Out[5]=

重新缩放样品到 2 秒长,并生成音频信号.

In[6]:=
Click for copyable input
AudioNormalize@ AudioGenerator[TimeSeriesRescale[sample, {0, 2, 1/44100}]]
Out[6]=
In[7]:=
Click for copyable input
AudioNormalize@ AudioGenerator[TimeSeriesRescale[sample, {0, 2, 1/44100}]]; AudioPlot[%]
Out[7]=

直接用 FractionalGaussianNoiseProcess 产生一个不同类型的噪音.

In[8]:=
Click for copyable input
AudioNormalize@AudioGenerator[FractionalGaussianNoiseProcess[1/3], 2]
Out[8]=
In[9]:=
Click for copyable input
AudioNormalize@AudioGenerator[FractionalGaussianNoiseProcess[1/3], 2]; AudioPlot[%]
Out[9]=

相关范例

de en es fr ja ko pt-br ru