Bug fixed for unix error "readlink /proc/self/fd/0" on MacOS.
[Faustine.git] / interpreter / preprocessor / faust-0.9.47mr3 / documentation / faust-quick-reference-src / chapters / introduction.tex
1 \chapter{Introduction}
2
3 \faust (\textit{Functional Audio Stream}) is a functional programming language specifically designed for real-time signal processing and synthesis. \faust targets high-performance signal processing applications and audio plug-ins for a variety of platforms and standards.
4
5 \section{Design Principles}
6
7 Various principles have guided the design of \faust :
8
9 \begin{itemize}
10
11 \item \faust is a \textit{specification language}. It aims at providing an adequate notation to describe \textit{signal processors} from a mathematical point of view. \faust is, as much as possible, free from implementation details.
12
13 \item \faust programs are fully compiled, not interpreted. The compiler translates \faust programs into equivalent C++ programs taking care of generating the most efficient code. The result can generally compete with, and sometimes even outperform, C++ code written by seasoned programmers.
14
15 \item The generated code works at the sample level. It is therefore suited to implement low-level DSP functions like recursive filters. Moreover the code can be easily embedded. It is self-contained and doesn't depend of any DSP library or runtime system. It has a very deterministic behavior and a constant memory footprint.
16
17 \item The semantic of \faust is simple and well defined. This is not just of academic interest. It allows the \faust compiler to be \emph{semantically driven}. Instead of compiling a program literally, it compiles the mathematical function it denotes. This feature is useful for example to promote components reuse while preserving optimal performance.
18
19 \item \faust is a textual language but nevertheless block-diagram oriented. It actually combines two approaches: \textit{functional programming} and \textit{algebraic block-diagrams}. The key idea is to view block-diagram construction as function composition. For that purpose, \faust relies on a \emph{block-diagram algebra} of five composition operations (\lstinline': , ~ <: :>').
20
21 \item Thanks to the notion of \textit{architecture}, \faust programs can be easily deployed on a large variety of audio platforms and plugin formats without any change to the \faust code.
22
23 \end{itemize}
24
25 \section{Signal Processor Semantic}
26 A \faust program describes a \emph{signal processor}.
27 The role of a \textit{signal processor} is to transforms a group of (possibly empty) \emph{input signals} in order to produce a group of (possibly empty) \emph{output signals}.
28 Most audio equipments can be modeled as \emph{signal processors}.
29 They have audio inputs, audio outputs as well as control signals interfaced with sliders, knobs, vu-meters, etc.
30
31 More precisely :
32
33 \begin{itemize}
34
35 \item A \emph{signal} $s$ is a discrete function of time $s:\mathbb{N}\rightarrow\mathbb{R}$
36 \marginpar{\faust considers two type of signals: \emph{integer signals} ($s:\mathbb{N}\rightarrow\mathbb{Z}$) and \emph{floating point signals} ($s:\mathbb{N}\rightarrow\mathbb{Q}$). Exchanges with the outside world are, by convention, made using floating point signals. The full range is represented by sample values between -1.0 and +1.0.}.
37 The value of signal $s$ at time $t$ is written $s(t)$.
38 The set $\mathbb{S}=\mathbb{N}\rightarrow\mathbb{R}$ is the set of all possible signals.
39
40 \item A group of $n$ signals (a \emph{n}-tuple of signals) is written
41 $(s_{1},\ldots,s_{n})\in \mathbb{S}^{n}$.
42 The \emph{empty tuple}, single element of $\mathbb{S}^{0}$ is notated $()$.
43
44 \item A \emph{signal processors} $p$, is a function from
45 \emph{n}-tuples of signals to \emph{m}-tuples of signals
46 $p:\mathbb{S}^{n}\rightarrow\mathbb{S}^{m}$. The set $\mathbb{P}=\bigcup_{n,m}\mathbb{S}^{n}\rightarrow\mathbb{S}^{m}$ is the
47 set of all possible signal processors.
48
49 \end{itemize}
50
51 As an example, let's express the semantic of the \faust primitive \lstinline'+'. Like any \faust expression, it is a signal processor. Its signature is $\mathbb{S}^{2}\rightarrow\mathbb{S}$. It takes two input signals $X_0$ and $X_1$ and produce an output signal $Y$ such that $Y(t) = X_0(t)+X_1(t)$.
52
53 Numbers are signal processors too. For example the number $3$ has signature $\mathbb{S}^{0}\rightarrow\mathbb{S}$. It takes no input signals and produce an output signal $Y$ such that $Y(t) = 3$.
54
55