On 18/07/17 10:20, Yann Orlarey wrote:
Hi Philip,
Hi Yann!
Let's say that you want to control the frequency of an oscillator using the signal delivered by the amplitude follower. You can write:

    import("stdfaust.lib");
    process = an.amp_follower(0.1) : *(440) : +(440) : os.osc;


The amplitude follower delivers an amplitude signal between 0 and 1. This signal is then mapped between 440 and 880 Hz to control the frequency of the oscillator.
So far, so good. And thank you for this mapping trick, it's pretty neat.
This example can be refined to use the amplitude follower also to control the level of the oscillator:

    import("stdfaust.lib");
    process = an.amp_follower(0.1) <: (*(440) : +(440) : os.osc), _ : *;

Wow, neater and neater :) But wait, how are the frequency, and now the input level, identified/implied? I mean how do you look at the above expression and intuitively say "Oh, this is the frequency, and this must be the level"?
In order to understand these examples, please note that Faust expressions can combine different types of notations:

  * core notation: 2,3:foo,
  * applicative notation: foo(2,3),
  * partial application notation: 3:foo(2).
  * as well as infix notation: 10*(2+3).

Aaah, yes! Light! Thanks for that, really. I'm sure It's written everywhere, explained in so many ways, but I guess it needed to be hammered in my brain (the colouring, surely) :/ Thank you and sorry for being so wooden.
The expression an.amp_follower(0.1) is an example of partial application notation. The amplitude follower has two inputs: the first one is the release time and the second one is the signal to analyze.
But those two inputs are not mentioned in the amp_follower documentation <http://faust.grame.fr/library.html#amp_follower>! Well, I guess the "signal to analyse" is implied by the "_ :" part..?
This is equivalent to:

    0.1, _ : an.amp_follower

So now, the amp_follower takes two.. inputs..?
Using only core notation the first example could be rewritten as:

    import("stdfaust.lib");
    process = 0.1, _ : an.amp_follower, 440 : *, 440 : + : os.osc;

While using only infix and applicative notation, it could be rewritten as:

    import("stdfaust.lib");
    process(x) = os.osc(440 + 440*an.amp_follower(0.1,x));

I'm going to have to print this mail and put it above my monitor, I guess.
How do you choose between core, infix and partial application notations? It is largely a matter of taste. Personnaly, I like to combine core notation (for the overall structure) with partial application notation (for the slowly varying "parameters") as in the first two examples, and infix notation for mathematical expressions.
Ah, yes, a lot of Faust source code syntax I read make sense, now.
Cheers

Yann
Thank you very much, Yann. I'm going to study and practice your example, which look like a solid foundation for understanding the core of Faust object connexions and parameters. Wow, I find Faust incredible.


Philippe Coatmeur

PS - BTW I put together (it's still WIP, specifically in the domain of indenting (grammar, rules, that sort of things, it's like C syntax basically, right?)) an emacs major mode for editing Faust code <https://bitbucket.org/yassinphilip/emacs-faust-ide> after hearing Romain Michon in the intro/presentation/install <https://ccrma.stanford.edu/%7Ermichon/faustWorkshops/course2015/#intro> of his (quite superb, generous, clever, insightful, please thank him) wokshop repeating about FaustWorks "don't don't don't install, don't use it... just don't" which is I think a poor eulogy for what is at least a great proof of concept ; I was - as with basically all the pieces of the Faust ecosystem - quite baffled with it. For starters it works, and while the editor is very crude (no line # and no search was it for me) I think it's very neat and friendly.

For now, My Emacs IDE is doing everything FaustWorks does, and it's a thing, at least for me :) I want to interface it with Faust Live, I cloned the branch but I don't want to mess my install (can Faust and Faust 2 live together?) for now, but eventually I want to integrate it too.
-------------------------

Yann Orlarey
Directeur scientifique
www.grame.fr <http://www.grame.fr>



2017-07-17 16:30 GMT+02:00 Yassin Philip <xaccroch...@gmail.com <mailto:xaccroch...@gmail.com>>:

    An amplitude follower is just a detection/analysis tool, right?
    So you pass a signal through it, and it "follows the amplitude" of
    said signal, correct?

    How do I retrieve the information gathered by this amplitude
    follower to use it elsewhere? I think once I get this logic, I'll
    really be on my way.

    Phil

-- Yassin Philip New album NOW
    http://yassinphilip.bitbucket.io <http://yassinphilip.bitbucket.io>


    
------------------------------------------------------------------------------
    Check out the vibrant tech community on one of the world's most
    engaging tech sites, Slashdot.org! http://sdm.link/slashdot
    _______________________________________________
    Faudiostream-users mailing list
    Faudiostream-users@lists.sourceforge.net
    <mailto:Faudiostream-users@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/faudiostream-users
    <https://lists.sourceforge.net/lists/listinfo/faudiostream-users>



--
Yassin Philip      New album NOW
http://yassinphilip.bitbucket.io

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to