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

FAST rewritten

parent e881431b
......@@ -30,25 +30,27 @@
}
\newcommand{\computeraudio}{
\begin{tikzpicture}[every node/.style={draw, inner sep=6}]
\begin{scope}[local bounding box=hp]
\hp
\end{scope}
\begin{scope}[shift={(1,.4)}, local bounding box=mic]
\mic
\end{scope}
\fill (mic.south) circle (1pt);
\fill (hp.south) circle (1pt);
\node[draw] (SC) at ($(mic.south) + (2, -0.2)$) {Sound Card};
\node (K) at ($(SC.east) + (1.5, 0)$) {Kernel};
\node (P) at ($(K.east) + (1.5, 0)$) {CPU};
\node (M) at ($(P.east) + (1.5, 0)$) {RAM};
\draw[->-] (mic.south) -- ($(SC.west) + (0, 0.2)$);
\draw[->-] ($(SC.west) + (0, -0.2)$) -- (hp.south);
\lr{SC}{K}
\lr{K}{P}
\lr{P}{M}
\end{tikzpicture}
\begin{tikzpicture}[every node/.style={inner sep=6}]
\begin{scope}[local bounding box=hp]
\hp
\end{scope}
\begin{scope}[shift={(1,.4)}, local bounding box=mic]
\mic
\end{scope}
\fill (mic.south) circle (1pt);
\fill (hp.south) circle (1pt);
\node[draw] (SC) at ($(mic.south) + (2, -0.2)$) {Sound Card};
\node[draw] (K) at ($(SC.east) + (3, 0)$) {Kernel};
\node[draw] (P) at ($(K.east) + (1.5, 0)$) {OS};
\draw[->-] (mic.south) -- ($(SC.west) + (0, 0.2)$);
\draw[->-] ($(SC.west) + (0, -0.2)$) -- (hp.south);
\foreach \y in {1, ..., 8}{
\draw (SC.north east) rectangle ($(SC.south east) + (\y / 10, 0)$);
}
\draw ($(SC.north east) + (0.4, 0.2)$) node {\tiny buffer};
\lr{SC}{K}
\lr{K}{P}
\end{tikzpicture}
}
\newcommand{\asicaudio}{
......
......@@ -112,22 +112,37 @@ source of many problems, as it creates loops in the signal graph.
Even if it is a compiled language, and thus among the fastest block-description
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,
everything is located on the device. As there is no more delay due to the
execution environment, which leads to much faster processing within the
\(\SI{10}{\micro\second}\) order of magnitude. This has however an obvious
latency is critical. This is due to the fact that Faust programs are meant to be
executed on computers. When recording sound with a microphone, the soundcard of
the computer encodes sounds samples before indicating the OS that samples are
ready. Yet the Kernel can not afford to have an interruption from the soundcard
every sample (At \(\SI{44100}{\hertz}\), it means once every
\(\SI{23}{\micro\second}\)), so the soundcard buffers samples and uses one
interruption to send the whole buffer to the Kernel. Similarily, when the OS
wants to play sounds, it sends a chunk of samples to the soundcard, which
buffers them before playing them one after the other, through loudspeakers. With
a typical chunk size of 64 samples, this introduces a latency of at least
\(64/ 44100 = \SI{1}{\milli\second} \). For applications such as active noise
reduction, on which one must be able to catch a soundwave with destructive
interferences, with a sound speed of \(\SI{330}{\meter\per\second}\), this
latency represent a movement of the soundwave of
\(64 * 330 / 44100 =\SI{48}{\centi\meter}\) between the moment the first sample
is recorded and the moment the first sample is emitted.
On the contrary, when using an Application-Specific Integrated Circuit (ASIC)
dedicated to audio processing, for instance in an active noise cancellation
headphone, samples are processed one after the other, which leads to latency
within \(\SI{10}{\micro\second}\). This has however an obvious
drawback. Computers are general-purpose machines, whereas ASICs are
application-specific circuit, and circuit are not reprogrammable and very coslty
to produce. A tradeoff between those two worlds can be found in
Field-Programmable Gate Arrays (FPGA). An FPGA is an integrated circuit designed
to emulate arbitrary digital circuits using a circuit description written in
domain specific languages such as VHDL or Verilog. A more modern approach is to
use High-Level Synthesis (HLS) tools than can transform a subset of a C/C++ code
directly into a circuit.
domain specific languages such as VHDL or Verilog, but using those languages
requires high programming skills and very low-level considerations. A more
modern approach is to use High-Level Synthesis (HLS) tools than can transform a
subset of a C/C++ code directly into a circuit. But these tools are also not
very convenient, as they require massive use of pragmas to annotate code.
\begin{figure}
\centering
......@@ -135,7 +150,6 @@ directly into a circuit.
\caption{Executing Audio Programs on a Computer}
\label{fig:audio-computer}
\end{figure}
\begin{figure}
\centering
\asicaudio
......@@ -143,19 +157,11 @@ directly into a circuit.
\label{fig:audio-asic}
\end{figure}
However, all those techniques requires high programming skills, massive use of
pragmas, and very low level considerations, where most Faust users are more
musicians than programmers. The aim of the FAST project is to enpower Faust
programmers with a low-latency backend that could be used in real-time
So both of those techniques are not adapted for mainstream Faust users that are
more musicians than programmers. The aim of the FAST project is to enpower Faust
programmers with a low-latency backend on FPGA that could be used in real-time
applications, such as live artificial reverberation or active noise control.
\begin{figure}
\centering
\includegraphics[width=0.5\textwidth]{../pictures/zybo-2-small}
\caption{A Xilinx Zybo FPGA SOC}
\label{fig:zybo}
\end{figure}
\subsection{Implementing the Reals: Floating-Point VS Fixed-Point numbers}
\label{sec:floating-point-vs}
......
......@@ -7,23 +7,26 @@
\input{../f2defs.tex}
\begin{document}% maybe the use of anchor=south could have been useful
\begin{tikzpicture}
\fixpointpositions{0}{4}{-2}{-6};
\fixpointnumber{0}{4}{1}{-6}
\draw (-6, -5.05) -- (3, -5.05);
\fixpointnumber{0}{3}{1}{-4.5}
\fixpointnumber{0}{2}{1}{-3.5}
\fixpointnumber{0}{1}{1}{-2.5}
\definecolor{normalbitfillcolor}{rgb}{1,1,0.8}
\fixpointnumber{0}{0}{0}{-4.5}
\fixpointnumber{0}{0}{-1}{-3.5}
\fixpointnumber{0}{0}{-2}{-2.5}
\definecolor{normalbitfillcolor}{rgb}{.8,.8,1}
\draw (-6, -1.55) -- (3, -1.55);
\fixpointnumber{0}{1}{-1}{-1}
\fixpointnumber{0}{2}{-1}{0}
\draw (-5.5, -1) node{\(\times\)};
\draw (-5.5, -4.5) node{\(+\)};
\end{tikzpicture}
\begin{tikzpicture}[every node/.style={inner sep=6}]
\begin{scope}[local bounding box=hp]
\hp
\end{scope}
\begin{scope}[shift={(1,.4)}, local bounding box=mic]
\mic
\end{scope}
\fill (mic.south) circle (1pt);
\fill (hp.south) circle (1pt);
\node[draw] (SC) at ($(mic.south) + (2, -0.2)$) {Sound Card};
\node[draw] (K) at ($(SC.east) + (3, 0)$) {Kernel};
\node[draw] (P) at ($(K.east) + (1.5, 0)$) {OS};
\draw[->-] (mic.south) -- ($(SC.west) + (0, 0.2)$);
\draw[->-] ($(SC.west) + (0, -0.2)$) -- (hp.south);
\foreach \y in {1, ..., 8}{
\draw (SC.north east) rectangle ($(SC.south east) + (\y / 10, 0)$);
}
\draw ($(SC.north east) + (0.4, 0.2)$) node {\tiny buffer};
\lr{SC}{K}
\lr{K}{P}
\end{tikzpicture}
\end{document}%%% Local IspellDict: en
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