# Wolfram Mathematica

## Use Time Series to Generate Audio

Control the frequency of the sine wave with a regularly sampled TimeSeries.

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

Control the frequency of the sine wave with an irregularly sampled TimeSeries.

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

Generate a white noise with WhiteNoiseProcess.

In[5]:=
`sample = RandomFunction[WhiteNoiseProcess[1/3], {88200}]`
Out[5]=

Rescale the sample to the length of 2 seconds and generate audio.

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

Generate a different type of noise directly with FractionalGaussianNoiseProcess.

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