```
scalePattern = slow 16 "
```"

```
d9 $ midicmd "start" # s "midi"
```

```
do d9 $ midicmd "stop" # s "midi" hush
```

```
d3 $ note ((scaleP scalePattern $ (rotR 4) $ (+ slow 8 "x" <~> ((0.25 ~>) generateMelodicSeed)) -- $ slow 4 \n $ generateMelodicSeed ))#s "[pe-gtr:8,midi]" #gain 1.2 #orbit 2 #midichan 3
```

# Fourier Series

Fourier’s theorem states that any periodic function can be approximated perfectly by some weighted sum of harmonic sine and cosine waves. This sum is often infinite. (see: wikipedia)

Arbitrary signals can be analyzed to determine the weights for the Fourier series that approximates them. This kind of analysis can be used to transform a [[ Time Domain]] signal into a [[Frequency Domain]] signal. This transformation is the first step in a variety of [[Spectral Processing ]] algorithms.

In calculus this is represented by the [[ Fourier Transform]]. For DSP and digital audio a variety of [[Discrete Fourier Transform (DFT) ]] algorithms exist. Some of these algorithms can operate in real time.

Since Fourier’s theorem only holds for signals that are perfectly periodic (ie. signals that repeat exactly forever) these transform algorithms often slice an input signal into “windows”. Each window is assumed to repeat forever so that the frequencies present in each window can be derived by computing the Fourier transform. This “windowing” operation is a source of error and is an example of an
[[
orthogonal property
]]. The more you know about the signals what frequencies are present in a window (ie. a larger window size), the less you know about *when* those frequencies occurred in the time domain.

### Notes mentioning this note

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.