Messages Search About

[Csnd] Using faust2csound

Date2022-09-12 16:51
FromAaron Krister Johnson
Subject[Csnd] Using faust2csound
Hi all,

I've been obsessively engaged in a kind of pet project to make an idealized "clavichord/harpsichord" generalized instrument using a pluck algorithm. I was feeling pretty frustrated with the tuning issues I was seeing for all the flavors of `pluck` (including `repluck`, `wgpluck`, `wgpluck2`). But I'm comfortable with and rather like the Csound ecosystem and opcodes in general otherwise, and it's a workflow I'm used to and quick at. So, I'm happy to report I was able to find an interesting workaround: create a plugin opcode from scratch using `faust2csound`.

I'm aware that there are some newer faust opcodes likely to do the same, but:

* I'm not dealt with them and am not aware of their performance
* My target platform of interest is ultimately the Bela-mini, and `belacsound` doesn't have those `faust` opcodes...

But I downloaded the latest `faust` and have been playing with it in general. It's a wonderful piece of software! There were a couple of broken things that I needed to attend to in the `faust2csound` script (thanks for the pointers here in old posts, Michael Gogins), but I was eventually able to deduce the correct compilation flags for Bela, `scp` the `<opcode_filename>.dsp.cpp` over to the Bela (and first, stop the `faust2csound` script from deleting it!) and actually make a plugin for a pluck instrument that I call `superpluck`. `superpluck` is made from an impulse or brief "colored noise" transient being fed into a feedback comb filter (faust's `fb_comb`), and most importantly, for my musical purposes, up and down the keyboard, every octave I tested was locked in tune (I don't mind occasionally having deliberate beating, but as a "tuning guy", I want to be in 100% control of that)

I'll happily share the code, etc. on request if any others are curious or would want to benefit. Coming soon: some recordings of Bach Well-tempered Clavier (book II) played live with a clav-like sound I crafted (the whole book is now comfortably in my fingers :D )

Interesting side-note: one thing making a difference in reliable performance of a live MIDI instrument on Bela is for instance choosing a white-noise based impulse using `rand`....it turns out `pinkish` comes with significant CPU cost, which makes sense. It appears it's cheaper to use `rand` and post-filter the noise. Then again, that all depends on the complexity of the filter...

A big thank you to Victor Lazzarini for his help, suggestions, and code elsewhere, and as it turns out, he had a big hand in the `faust2csound` solution that got me over this block. Also again to Michael Gogins for tips elsewhere that paved the way for an easier experience with those scripts.
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2022-09-13 00:17
FromMichael Gogins
SubjectRe: [Csnd] Using faust2csound
Thanks!



On Mon, Sep 12, 2022, 11:52 Aaron Krister Johnson <akjmicro@gmail.com> wrote:
Hi all,

I've been obsessively engaged in a kind of pet project to make an idealized "clavichord/harpsichord" generalized instrument using a pluck algorithm. I was feeling pretty frustrated with the tuning issues I was seeing for all the flavors of `pluck` (including `repluck`, `wgpluck`, `wgpluck2`). But I'm comfortable with and rather like the Csound ecosystem and opcodes in general otherwise, and it's a workflow I'm used to and quick at. So, I'm happy to report I was able to find an interesting workaround: create a plugin opcode from scratch using `faust2csound`.

I'm aware that there are some newer faust opcodes likely to do the same, but:

* I'm not dealt with them and am not aware of their performance
* My target platform of interest is ultimately the Bela-mini, and `belacsound` doesn't have those `faust` opcodes...

But I downloaded the latest `faust` and have been playing with it in general. It's a wonderful piece of software! There were a couple of broken things that I needed to attend to in the `faust2csound` script (thanks for the pointers here in old posts, Michael Gogins), but I was eventually able to deduce the correct compilation flags for Bela, `scp` the `<opcode_filename>.dsp.cpp` over to the Bela (and first, stop the `faust2csound` script from deleting it!) and actually make a plugin for a pluck instrument that I call `superpluck`. `superpluck` is made from an impulse or brief "colored noise" transient being fed into a feedback comb filter (faust's `fb_comb`), and most importantly, for my musical purposes, up and down the keyboard, every octave I tested was locked in tune (I don't mind occasionally having deliberate beating, but as a "tuning guy", I want to be in 100% control of that)

I'll happily share the code, etc. on request if any others are curious or would want to benefit. Coming soon: some recordings of Bach Well-tempered Clavier (book II) played live with a clav-like sound I crafted (the whole book is now comfortably in my fingers :D )

Interesting side-note: one thing making a difference in reliable performance of a live MIDI instrument on Bela is for instance choosing a white-noise based impulse using `rand`....it turns out `pinkish` comes with significant CPU cost, which makes sense. It appears it's cheaper to use `rand` and post-filter the noise. Then again, that all depends on the complexity of the filter...

A big thank you to Victor Lazzarini for his help, suggestions, and code elsewhere, and as it turns out, he had a big hand in the `faust2csound` solution that got me over this block. Also again to Michael Gogins for tips elsewhere that paved the way for an easier experience with those scripts.
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2022-09-13 00:44
FromMichael Gogins
SubjectRe: [Csnd] Using faust2csound
About sharing code, I suggest you create a GitHub repository for each of your code-related projects, or even just music-related projects. If you don't want to share the work, make tjhe repository private (this costs something but not much). If you want to share the work, it's free. 

If you want to share some but not all, or share some but only with certain people, use private repositories but then produce releases that then share on DropBox or a similar service with whoever you choose.

Best,
Mike

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


On Mon, Sep 12, 2022 at 7:17 PM Michael Gogins <michael.gogins@gmail.com> wrote:
Thanks!



On Mon, Sep 12, 2022, 11:52 Aaron Krister Johnson <akjmicro@gmail.com> wrote:
Hi all,

I've been obsessively engaged in a kind of pet project to make an idealized "clavichord/harpsichord" generalized instrument using a pluck algorithm. I was feeling pretty frustrated with the tuning issues I was seeing for all the flavors of `pluck` (including `repluck`, `wgpluck`, `wgpluck2`). But I'm comfortable with and rather like the Csound ecosystem and opcodes in general otherwise, and it's a workflow I'm used to and quick at. So, I'm happy to report I was able to find an interesting workaround: create a plugin opcode from scratch using `faust2csound`.

I'm aware that there are some newer faust opcodes likely to do the same, but:

* I'm not dealt with them and am not aware of their performance
* My target platform of interest is ultimately the Bela-mini, and `belacsound` doesn't have those `faust` opcodes...

But I downloaded the latest `faust` and have been playing with it in general. It's a wonderful piece of software! There were a couple of broken things that I needed to attend to in the `faust2csound` script (thanks for the pointers here in old posts, Michael Gogins), but I was eventually able to deduce the correct compilation flags for Bela, `scp` the `<opcode_filename>.dsp.cpp` over to the Bela (and first, stop the `faust2csound` script from deleting it!) and actually make a plugin for a pluck instrument that I call `superpluck`. `superpluck` is made from an impulse or brief "colored noise" transient being fed into a feedback comb filter (faust's `fb_comb`), and most importantly, for my musical purposes, up and down the keyboard, every octave I tested was locked in tune (I don't mind occasionally having deliberate beating, but as a "tuning guy", I want to be in 100% control of that)

I'll happily share the code, etc. on request if any others are curious or would want to benefit. Coming soon: some recordings of Bach Well-tempered Clavier (book II) played live with a clav-like sound I crafted (the whole book is now comfortably in my fingers :D )

Interesting side-note: one thing making a difference in reliable performance of a live MIDI instrument on Bela is for instance choosing a white-noise based impulse using `rand`....it turns out `pinkish` comes with significant CPU cost, which makes sense. It appears it's cheaper to use `rand` and post-filter the noise. Then again, that all depends on the complexity of the filter...

A big thank you to Victor Lazzarini for his help, suggestions, and code elsewhere, and as it turns out, he had a big hand in the `faust2csound` solution that got me over this block. Also again to Michael Gogins for tips elsewhere that paved the way for an easier experience with those scripts.
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here