Friture is mostly written in the programming language called Python.
Additionally, Friture uses the following libraries:
Where performance is critical, some operations are specifically written in Cython, a programming language that provides C-extensions for Python. Meanwhile, some critical graphical operations are accelerated with OpenGL (Python bindings: PyOpenGL).
Here are some technical details about the design of Friture:
Initially, the program was based on multiple processes: one gets the data from the soundcard, sends to the second for processing, which in turn sends to the third for display. Ultimately this scheme looked too complex and introduced too many synchronization issues.
A first rewrite was done to base the program on a single timer which periodically checks for audio data from the soundcard. Now there is one critical parameter : the period of that timer. It must obey to several time constraints:
The current scheme is based on multiple timers, with distinct period constraints. A first timer has a period of 20 ms (50 Hz) for smooth display update of the levels, scope and 1D spectrum widgets. The other timers have a period that is fixed by the display constraints of their associated widget. Currently, the rolling spectrogram widget uses such a custom timer. Its period is the time associated to one column of the rolling spectrogram. All timers first fetch the available data from the audio input, then pass the data to a circular audio buffer, and finally update their associated widget with the data contained in this audio buffer.
To optimize the source code of Friture and make it suitable for run-time audio analysis with a computer of average power, profiling is essential. It has helped a lot writing efficient pieces like the rolling spectrogram, whose logic almost never appears in the profiles now. Learn more about the profiles.