[LAD] xazz - yet *another* DSP library - or language? (was: Re: ttsoot - yet another DSP library :))

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: torbenh <torbenh@...>
Cc: <linux-audio-dev@...>
Date: Wednesday, February 17, 2010 - 10:33 am

On 17 Jan 2010, at 04:59, torbenh wrote:

> On Fri, Jan 15, 2010 at 10:49:21AM +0100, Stéphane Letz wrote:

torben, Stéphane, LAD:

This exchange got me wondering... how "Faust-like" could a language, embedded directly in C++ using template metaprograming techniques, be made to be?

Could it be made to accept e.g.:

(expr0:(expr1,expr2,expr3):expr4)

In place of e.g.:

Serial(Serial(expr0,Parallel(Parallel(expr1,expr2),expr3),expr4))?

Wondering turned to coding and I ended up with Xazz:

/*===========
begin sine.cpp
===========*/
#include
#include "xazz/base.hpp"
#include "xazz/math.hpp"
#include "xazz/jack.hpp"

int main( void )
{
XAZZ_IMPORT_BASE
XAZZ_IMPORT_MATH

#define _ XAZZ_CONST
const auto samplerate = _(44100.0f);

const auto osc440 = _(440.0f)
> (((twopi,samplerate) > div) > mul)
> ((add <= ( pi>lt, wire, (wire, twopi) > sub ) > select) & wire )
> sin_;
#undef _

xazz::Jack MyJack(osc440, "osc440");
while( true ) { sleep(10); }
return 0;
}
/*===========
end sine.cpp
===========*/

That's a Jack app that outputs a 440Hz sine wave.

Notes:

1. C++ obviously doesn't have the same operators as Faust so Xazz uses:
">" serial composition (Faust's ":")
"," parallel composition (Faust's ",")
"<=" split composition (Faust's "<:")
">=" join composition (Faust's ":>" )
"&" recursive composition (Faust's "~")
"wire" identity (Faust's "_")
"cut" cut (Faust's "!")

2. It still needs c++0x but not so close to the bleeding edge. g++ 4.4 required.

3. It looks like we're composing the Xazz program at runtime (with consequent loss of efficiency) but the "meat" of osc440 is what type it is, not what data it contains. The compiler works that out at compile time and -- thanks to c++0x auto -- we never have to write it down ourselves.

4. This is a V0.0 "proof of concept" release. Its LGPL.

5. Ummm.... thats it. Headers and a couple more examples here:

http://www.sjenkins.pwp.blueyonder.co.uk/xazz/xazz_0_0.tar.gz

Simon Jenkins
Bristol, UK

_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[LAD] ttsoot - yet another DSP library :), torbenh, (Fri Jan 15, 9:03 am)
Re: [LAD] ttsoot - yet another DSP library :), Stéphane Letz, (Fri Jan 15, 9:49 am)
Re: [LAD] ttsoot - yet another DSP library :), torbenh, (Sun Jan 17, 4:59 am)
[LAD] xazz - yet *another* DSP library - or language? (was: ..., Simon Jenkins, (Wed Feb 17, 10:33 am)
Re: [LAD] ttsoot - yet another DSP library :), Victor Lazzarini, (Fri Jan 15, 9:20 am)