Q-Audio 2.3 review

Q-Audio is a digital audio interface for Q

 License: GPL (GNU General Public License) File size: 0K Developer: Albert Graef Q-Audio is a digital audio interface for Q. Q-Audio project contains three modules which together provide the basic functionality needed to write digital audio applications.

The audio module implements a (nearly) real-time audio interface on top of the PortAudio library. The sndfile module allows you to access sound files in various formats using libsndfile.

The wave module provides basic operations for creating and manipulating wave data, including operations to convert sample rates, to calculate Fourier transforms, and to display wave data in a GGI visual.

Q is a functional programming language based on term rewriting. Thus, a Q program or "script" is simply a collection of equations which are used to evaluate expressions in a symbolic fashion. The equations establish algebraic identities and are interpreted as rewriting rules in order to reduce expressions to "normal forms". For instance, here is how you define a function sqr which squares its argument by multiplying it with itself:
sqr X = X*X;

Note that, as in Prolog, capitalized identifiers are used to indicate the variables in an equation, which are bound to the actual values when an equation is applied. Equations may also include a condition part, as in the following definition of the factorial function:
fact N = N*fact (N-1) if N>0;
= 1 otherwise;

Functions on structured arguments are defined by "pattern matching". E.g., the product of a list (denoted in Prolog-like syntax) can be computed with these two equations:
prod [] = 1;
prod [X|Xs] = X*prod Xs;

With this definition, the factorial can now also be defined as follows (the notation [1..N], as in Haskell, denotes an arithmetic sequence):
fact N = prod [1..N];

As you can see, the definitions are really just like mathematical equations. The syntax is superficially similar to other modern functional languages like Miranda and Haskell, except that Q is "free-format", i.e., it does not use layout to indicate syntactical structure (thus the semicolon is used to terminate an equation).
Due to its term rewriting heritage, Q goes well beyond most other functional languages in that it also allows you to perform computations with symbolic expressions. For instance, with the definition of the sqr function from above, you will find that sqr (X+1) evaluates to (X+1)*(X+1). This might first look like an arcane feature, but it is actually quite useful, because you can try your definitions with symbolic inputs, too.

What's New in This Release:
src/wave.c: minor fixes for compatibility with latest gcc versions

Q-Audio 2.3 search tags