======= Signals ======= Signal primitives ----------------- MuzGen use different kind of signals for sound design. Constant ^^^^^^^^ The simplest signal is the **constant signal**. It returns the same frame everytime. It is used mostly as argument of commands. In MuzScript, every numbers are constant signals. .. code-block:: # constant signal 142 Sine ^^^^ The sine wave signal is the fundamental signal in sound theory. It takes the frequency of the signal as argument. Mathematically we can define our sine using the following formula: .. math:: amplitude * sin(2 * pi * frequency / samplerate * time) To generate a sine, we can use the ``sine`` command. .. code-block:: # sine signal with a frequency of 440 and an amplitude of 1 [sine 440] Noise ^^^^^ The noise command generate uniform random frames. .. code-block:: [noise] Signal operations ----------------- The signal operation commands allows us to combine signals in different ways. Add ^^^ The ``add`` command takes two signals as input and outputs their sum. .. code-block:: [add [sine 220] [sine 220]] Sub ^^^ The ``sub`` command takes two signals as input and outputs their difference. .. code-block:: [sub [sine 460] [sine 80]] Mul ^^^ The ``mul`` command takes two signals as input and output their product. .. code-block:: [mul 0.7 [sine 220]] Div ^^^ The ``div`` command takes two signals as input and output their ratio. .. code-block:: [div [sine 220] 2]