Csound Csound-dev Csound-tekno Search About

[Cs-dev] Faust opcodes

Date2013-06-13 16:06
FromMichael Gogins
Subject[Cs-dev] Faust opcodes
AttachmentsNone  None  
What does it take to build and run the Faust opcodes? Does it work with double-precision samples? How much of a compiler do you need installed on the Csound user's machine?

Thanks,
Mike

Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com

Date2013-06-13 18:37
FromVictor Lazzarini
SubjectRe: [Cs-dev] Faust opcodes
AttachmentsNone  None  
I will write a bit about these later, but responding to your question.

The dependencies are two:

1) LLVM - llvm.org
2) libfaust - this is from git faust2 branch.

With these you can build the opcodes and run them. In my machine both LLVM and libfaust are statically linked,
so the opcode lib contains all it's needed for running the opcodes. It does work with doubles (or floats).

Regards

Victor
On 13 Jun 2013, at 16:06, Michael Gogins wrote:

What does it take to build and run the Faust opcodes? Does it work with double-precision samples? How much of a compiler do you need installed on the Csound user's machine?

Thanks,
Mike

Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2013-06-13 18:39
FromMichael Gogins
SubjectRe: [Cs-dev] Faust opcodes
AttachmentsNone  None  
Way cool! Have you used Faust-generated code for anything yet, i.e. to make music?

Thanks,
Mike

Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Thu, Jun 13, 2013 at 1:37 PM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
I will write a bit about these later, but responding to your question.

The dependencies are two:

1) LLVM - llvm.org
2) libfaust - this is from git faust2 branch.

With these you can build the opcodes and run them. In my machine both LLVM and libfaust are statically linked,
so the opcode lib contains all it's needed for running the opcodes. It does work with doubles (or floats).

Regards

Victor
On 13 Jun 2013, at 16:06, Michael Gogins wrote:

What does it take to build and run the Faust opcodes? Does it work with double-precision samples? How much of a compiler do you need installed on the Csound user's machine?

Thanks,
Mike

Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel



Date2013-06-13 18:47
FromVictor Lazzarini
SubjectRe: [Cs-dev] Faust opcodes
AttachmentsNone  None  
I've just written the opcodes, so I have not had chance to do much but test it.

Here's a code example:


<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>

nchnls=2
0dbfs = 1

giPluck faustcompile {{
import("music.lib");

// Excitator
//--------

upfront(x) = (x-x') > 0.0;
decay(n,x) = x - (x>0.0)/n;
release(n) = + ~ decay(n);
trigger(n) = upfront : release(n) : >(0.0);

size = hslider("excitation", 128, 2, 512, 1);
// resonator
//-----------------

dur = hslider("duration", 128, 2, 512, 1);
att = hslider("attenuation", 0.1, 0, 1, 0.01);
average(x) = (x+x')/2;

resonator(d, a) = (+ : delay(4096, d-1.5)) ~ (average : *(1.0-a)) ;

process = noise * hslider("level", 0.5, 0, 1, 0.01)
: vgroup("excitator", *(button("play"): trigger(size)))
: vgroup("resonator", resonator(dur, att));
}}, "-vec -lv 1"

instr 1
i3, a1 faustaudio giPluck
k1 line p5, p3, p5*1.2
faustctl i3,"duration", sr/k1
faustctl i3,"attenuation", 0.01
faustctl i3,"play", 1
event_i "i",1, 0.1, 1, 1, 200+rnd(200)
outs a1,a1
endin

</CsInstruments>
<CsScore>

i1 0 4 1 200


e
</CsScore>
</CsoundSynthesizer>





On 13 Jun 2013, at 18:39, Michael Gogins wrote:

Way cool! Have you used Faust-generated code for anything yet, i.e. to make music?

Thanks,
Mike

Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Thu, Jun 13, 2013 at 1:37 PM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
I will write a bit about these later, but responding to your question.

The dependencies are two:

1) LLVM - llvm.org
2) libfaust - this is from git faust2 branch.

With these you can build the opcodes and run them. In my machine both LLVM and libfaust are statically linked,
so the opcode lib contains all it's needed for running the opcodes. It does work with doubles (or floats).

Regards

Victor
On 13 Jun 2013, at 16:06, Michael Gogins wrote:

What does it take to build and run the Faust opcodes? Does it work with double-precision samples? How much of a compiler do you need installed on the Csound user's machine?

Thanks,
Mike

Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2013-06-13 18:53
FromMichael Gogins
SubjectRe: [Cs-dev] Faust opcodes
AttachmentsNone  None  
Looks like a good, usable design.

Could LLVM be used in this same way to compile C or C++ code for an opcode? It looks like the infrastructure here takes care of dynamic loading and dynamic linking for the user.

Regards,
Mike

Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Thu, Jun 13, 2013 at 1:47 PM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
I've just written the opcodes, so I have not had chance to do much but test it.

Here's a code example:


<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>

nchnls=2
0dbfs = 1

giPluck faustcompile {{
import("music.lib");

// Excitator
//--------

upfront(x) = (x-x') > 0.0;
decay(n,x) = x - (x>0.0)/n;
release(n) = + ~ decay(n);
trigger(n) = upfront : release(n) : >(0.0);

size = hslider("excitation", 128, 2, 512, 1);
// resonator
//-----------------

dur = hslider("duration", 128, 2, 512, 1);
att = hslider("attenuation", 0.1, 0, 1, 0.01);
average(x) = (x+x')/2;

resonator(d, a) = (+ : delay(4096, d-1.5)) ~ (average : *(1.0-a)) ;

process = noise * hslider("level", 0.5, 0, 1, 0.01)
: vgroup("excitator", *(button("play"): trigger(size)))
: vgroup("resonator", resonator(dur, att));
}}, "-vec -lv 1"

instr 1
i3, a1 faustaudio giPluck
k1 line p5, p3, p5*1.2
faustctl i3,"duration", sr/k1
faustctl i3,"attenuation", 0.01
faustctl i3,"play", 1
event_i "i",1, 0.1, 1, 1, 200+rnd(200)
outs a1,a1
endin

</CsInstruments>
<CsScore>

i1 0 4 1 200


e
</CsScore>
</CsoundSynthesizer>





On 13 Jun 2013, at 18:39, Michael Gogins wrote:

Way cool! Have you used Faust-generated code for anything yet, i.e. to make music?

Thanks,
Mike

Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Thu, Jun 13, 2013 at 1:37 PM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
I will write a bit about these later, but responding to your question.

The dependencies are two:

1) LLVM - llvm.org
2) libfaust - this is from git faust2 branch.

With these you can build the opcodes and run them. In my machine both LLVM and libfaust are statically linked,
so the opcode lib contains all it's needed for running the opcodes. It does work with doubles (or floats).

Regards

Victor
On 13 Jun 2013, at 16:06, Michael Gogins wrote:

What does it take to build and run the Faust opcodes? Does it work with double-precision samples? How much of a compiler do you need installed on the Csound user's machine?

Thanks,
Mike

Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel



Date2013-06-13 19:08
FromVictor Lazzarini
SubjectRe: [Cs-dev] Faust opcodes
AttachmentsNone  None  
I guess it could. Without looking in detail at the internals (which I have not done), the description of what it happens is that LLVM compiles faust code into
binary executable that is then instantiated. This binary code has a simple C++ interface which is called by the host (ie. Csound) to 
instantiate and run it to produce samples. The API is very straightforward.

Victor
On 13 Jun 2013, at 18:53, Michael Gogins wrote:

Looks like a good, usable design.

Could LLVM be used in this same way to compile C or C++ code for an opcode? It looks like the infrastructure here takes care of dynamic loading and dynamic linking for the user.

Regards,
Mike

Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Thu, Jun 13, 2013 at 1:47 PM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
I've just written the opcodes, so I have not had chance to do much but test it.

Here's a code example:


<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>

nchnls=2
0dbfs = 1

giPluck faustcompile {{
import("music.lib");

// Excitator
//--------

upfront(x) = (x-x') > 0.0;
decay(n,x) = x - (x>0.0)/n;
release(n) = + ~ decay(n);
trigger(n) = upfront : release(n) : >(0.0);

size = hslider("excitation", 128, 2, 512, 1);
// resonator
//-----------------

dur = hslider("duration", 128, 2, 512, 1);
att = hslider("attenuation", 0.1, 0, 1, 0.01);
average(x) = (x+x')/2;

resonator(d, a) = (+ : delay(4096, d-1.5)) ~ (average : *(1.0-a)) ;

process = noise * hslider("level", 0.5, 0, 1, 0.01)
: vgroup("excitator", *(button("play"): trigger(size)))
: vgroup("resonator", resonator(dur, att));
}}, "-vec -lv 1"

instr 1
i3, a1 faustaudio giPluck
k1 line p5, p3, p5*1.2
faustctl i3,"duration", sr/k1
faustctl i3,"attenuation", 0.01
faustctl i3,"play", 1
event_i "i",1, 0.1, 1, 1, 200+rnd(200)
outs a1,a1
endin

</CsInstruments>
<CsScore>

i1 0 4 1 200


e
</CsScore>
</CsoundSynthesizer>





On 13 Jun 2013, at 18:39, Michael Gogins wrote:

Way cool! Have you used Faust-generated code for anything yet, i.e. to make music?

Thanks,
Mike

Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Thu, Jun 13, 2013 at 1:37 PM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
I will write a bit about these later, but responding to your question.

The dependencies are two:

1) LLVM - llvm.org
2) libfaust - this is from git faust2 branch.

With these you can build the opcodes and run them. In my machine both LLVM and libfaust are statically linked,
so the opcode lib contains all it's needed for running the opcodes. It does work with doubles (or floats).

Regards

Victor
On 13 Jun 2013, at 16:06, Michael Gogins wrote:

What does it take to build and run the Faust opcodes? Does it work with double-precision samples? How much of a compiler do you need installed on the Csound user's machine?

Thanks,
Mike

Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2013-06-13 19:52
FromVictor Lazzarini
SubjectRe: [Cs-dev] Faust opcodes
AttachmentsNone  None  
and here's a short video



On 13 Jun 2013, at 19:08, Victor Lazzarini wrote:

I guess it could. Without looking in detail at the internals (which I have not done), the description of what it happens is that LLVM compiles faust code into
binary executable that is then instantiated. This binary code has a simple C++ interface which is called by the host (ie. Csound) to 
instantiate and run it to produce samples. The API is very straightforward.

Victor
On 13 Jun 2013, at 18:53, Michael Gogins wrote:

Looks like a good, usable design.

Could LLVM be used in this same way to compile C or C++ code for an opcode? It looks like the infrastructure here takes care of dynamic loading and dynamic linking for the user.

Regards,
Mike

Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Thu, Jun 13, 2013 at 1:47 PM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
I've just written the opcodes, so I have not had chance to do much but test it.

Here's a code example:


<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>

nchnls=2
0dbfs = 1

giPluck faustcompile {{
import("music.lib");

// Excitator
//--------

upfront(x) = (x-x') > 0.0;
decay(n,x) = x - (x>0.0)/n;
release(n) = + ~ decay(n);
trigger(n) = upfront : release(n) : >(0.0);

size = hslider("excitation", 128, 2, 512, 1);
// resonator
//-----------------

dur = hslider("duration", 128, 2, 512, 1);
att = hslider("attenuation", 0.1, 0, 1, 0.01);
average(x) = (x+x')/2;

resonator(d, a) = (+ : delay(4096, d-1.5)) ~ (average : *(1.0-a)) ;

process = noise * hslider("level", 0.5, 0, 1, 0.01)
: vgroup("excitator", *(button("play"): trigger(size)))
: vgroup("resonator", resonator(dur, att));
}}, "-vec -lv 1"

instr 1
i3, a1 faustaudio giPluck
k1 line p5, p3, p5*1.2
faustctl i3,"duration", sr/k1
faustctl i3,"attenuation", 0.01
faustctl i3,"play", 1
event_i "i",1, 0.1, 1, 1, 200+rnd(200)
outs a1,a1
endin

</CsInstruments>
<CsScore>

i1 0 4 1 200


e
</CsScore>
</CsoundSynthesizer>





On 13 Jun 2013, at 18:39, Michael Gogins wrote:

Way cool! Have you used Faust-generated code for anything yet, i.e. to make music?

Thanks,
Mike

Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Thu, Jun 13, 2013 at 1:37 PM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
I will write a bit about these later, but responding to your question.

The dependencies are two:

1) LLVM - llvm.org
2) libfaust - this is from git faust2 branch.

With these you can build the opcodes and run them. In my machine both LLVM and libfaust are statically linked,
so the opcode lib contains all it's needed for running the opcodes. It does work with doubles (or floats).

Regards

Victor
On 13 Jun 2013, at 16:06, Michael Gogins wrote:

What does it take to build and run the Faust opcodes? Does it work with double-precision samples? How much of a compiler do you need installed on the Csound user's machine?

Thanks,
Mike

Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie



------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie