Commit e881431b authored by Antonin Dudermel's avatar Antonin Dudermel
Browse files

begining of intro changed

parent 225a0831
......@@ -42,10 +42,28 @@ with simple primitives (such as \lstinline{+, *, sin}\dots) that are patched
together using a block-diagram algebra (\lstinline{:} for composition,
\lstinline{,} for parallel evaluation\dots). The example on
\figref{fig:plus-simple} describes a simple stereo-to-mono converter. The two
inputs signals are added, then the sum is divided by 2.
\doublefig{stereo to mono}{\label{fig:plus-simple}\smallcode{../code/plus.dsp}}
{blocks}{0.2}{../code/plus-block.png} {graph}{0.5}{../code/plus-sig-old.png}
inputs signals are added (primitive \lstinline{+}), then the sum is divided by 2
(written \lstinline{/(2)} in Faust). These two basic processors are composed with a
\lstinline{:}. Figure \ref{fig:plus-simple} also shows a graphical representation of the signal
processor described by the program made by the compiler.
As Faust is a compiled language, it first parses the program to get an abstract
tree representing a formula that implements the processor described in the
program, then it does optimizations of the formula, replacing it by a simpler
but semantically equivalent formula, by replacing for instance \lstinline{x * 0}
by \lstinline{0} or \lstinline{x + x} by \lstinline{2 * x}, etc\dots until it
gets to a normal form. The compiler then builds from this normal form a
\emph{signal graph}, an oriented graph on which each node is a processor, node
whose ordered incoming nodes are the inputs of the processor. The signal graph
of the stereo-to-mono converter is also represented in
\figref{fig:plus-simple}. Once the formula is fully reduced into a unique normal
form defined in Faust, it can be translated into a
C++/Rust/D/WebAssembly/LLVM\dots code implementing this formula.
\faustexfig{Stereo-to-Mono converter}{\label{fig:plus-simple}}
{0.4}{../code/plus-block.png}
{0.5}{../code/plus-sig-old.png}
{\(y(t) = \frac{1}{2} (x_0(t) + x_1(t))\)}{../code/plus.dsp}
% \begin{figure}
% \centering
......@@ -72,31 +90,30 @@ inputs signals are added, then the sum is divided by 2.
% {shared addition}{0.48}{../code/rewsum-lessgolf-block.png}
% {unshared one}{0.48}{../code/rewsum-alt-block.png}
Once the formula is fully reduced into a unique normal form defined in Faust, it
can be translated into a C++/Rust/D/WebAssembly/LLVM\dots code implementing this
formula. As a result, Faust is a compiled language, which is rather uncommon in
block-description. This approach enables Faust to target easily a broad number
of front- and backends, from ALSA GTK application written in C to automatic SVG
drawing of the blocks. There is still one limit for the backends: for the
moment, compiled Faust programs only use floating-point arithmetic, so a backend
for Faust needs a floating-point arithmetic unit, which is not always the case
in embedded systems.
A very important constructor in Faust block-diagram algebra is \lstinline{~}. It
allows to recursively define a signal \(s(t)\) using the signal \(s(t-1)\) \ie{}
\(s(t)\) delayed by one sample. If we want to implement the ramp signal
\(s(t) = t + 1\), we can use its recursive definition
\[\recSig{i}{s(i) = 0}{s(i) = 1 + s(i-1)}\]
which can be written in Faust as shown in \figref{fig:ramp}.
\faustexfig{Ramp}{\label{fig:ramp}}
{0.3}{../code/ramp-block.png}
{0.3}{../code/ramp-sig-old.png}
{\(s(t) = 1 + s(t-1)\)}{../code/ramp.dsp}
This constructor is very important for Faust expressiveness but it is at the
source of many problems, as it creates loops in the signal graph.
\subsection{The FAST\cite{fastproject} Project: Faust on FPGA}
\label{sec:fast-project}
Even if it is a compiled language, and thus among the fastest block-description
signal processing languages, from an audio-synthesis point of view, Faust
remains slow. Indeed, at 44 000 Hz of sample rate, the time order of magnitude
between two samples is around \(\SI{10}{\micro\second}\). Being able to compute
the output of a signal in less than one sample time can be critical in real-time
application such as active noise control or artificial reverberation. In Faust,
this delay is more around \(\SI{1}{\milli\second}\). It is however not Faust's
fault. Indeed, using sound on a computer requires a lot of unavoidable
bureaucracy that leads to communication and latency between different
components, as shown in \figref{fig:audio-computer}. Even if solutions
exists, such as low-latency kernels or memory caching, it is not sufficient to
reach the desired \(\SI{10}{\micro\second}\).
signal processing languages, Faust is not suited for applications on which the
latency is critical. This is due to the fact that Faust programs
On the contrary, when using a dedicated audio device called ASIC, for instance
in an active noise cancellation headphone, routing, synchronisation, data,
......
......@@ -221,13 +221,6 @@ Furthermore, as every signal has value zero before the time zero, we have to
consider the lattice of intervals containing zero, with \(\bot = [0]\). More
details can be found in annex \ref{sec:lattice-signals}.
\begin{figure}
\centering
\includegraphics[width=0.5\textwidth]{../code/ramp-block.png}
\caption{A Ramp}
\label{fig:ramp}
\smallcode{../code/ramp.dsp}
\end{figure}
To transpose interval arithmetic into signals, we need to attach to a signal
\(s(t)\) an interval \(S'(t)\) for each time \(t\), and we need to ensure that
......
......@@ -9,6 +9,8 @@
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
%\usepackage{xcolor}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage[final]{listings}
......@@ -63,17 +65,17 @@
% formula, address of the code
\begin{figure}
\centering
\smallcode{#8}
#7\\
\hspace{\stretch{1}}
\subfloat[block diagram]{
\includegraphics[width=#3\textwidth, valign=c]{#4}
}
\hspace{\stretch{1}}
\subfloat[signal graph]{
\includegraphics[width=#5 \textwidth, valign=c]{#6}
}\\
\subfloat[signal implemented]{ #7
}\\
\subfloat[faust code]{ \lstinputlisting{#8} }
}
\hspace{\stretch{1}}
\caption{#1}
#2 %used for labels and comments
\end{figure}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment