Hi,

I’m looking closer at this strange behavior of ba.selectn().
I’d really like to know if this is expected behavior, 
because it looks like a bug to me.  (I’m seeing this in 
FaustLive version 2.5.17, as installed by MacPorts.)

Basically, if I have N inputs to selectn(), and I use a 
hslider with N possible values to select one of those inputs, 
the chosen input is not selected.  What happens instead 
is hard to characterize.  This code demonstrates the problem:


import("stdfaust.lib");
N=8;
process = par(i, N, (i : hbargraph("[%2i]val %i", 0, N)))           
  : ba.selectn(N, hslider("selector", 0, 0, N-1, 1) )
  : hbargraph("selected val", 0, N)
;


Interestingly, if I use a hslider with N+1 possible values,
everything seems to work as I’d expect. So that’s a workaround, 
although it requires the slider to have one meaningless value.

Can anyone else confirm this?  Is this expected behavior?
Or maybe I’m running a bad version of FaustLive?  Or I’m
missing some other obvious thing?

Much thanks,
-mykle-


> On Feb 27, 2018, at 4:36 AM, faudiostream-users-requ...@lists.sourceforge.net 
> wrote:
> 
> Send Faudiostream-users mailing list submissions to
>       faudiostream-users@lists.sourceforge.net
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>       https://lists.sourceforge.net/lists/listinfo/faudiostream-users
> or, via email, send a message with subject or body 'help' to
>       faudiostream-users-requ...@lists.sourceforge.net
> 
> You can reach the person managing the list at
>       faudiostream-users-ow...@lists.sourceforge.net
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Faudiostream-users digest..."
> Today's Topics:
> 
>   1. Re: compiler hangs on this program? (Mykle Hansen)
>   2. Re: FAUST Compiler for GPGPU? (l...@grame.fr)
> 
> From: Mykle Hansen <my...@mykle.com>
> Subject: Re: [Faudiostream-users] compiler hangs on this program?
> Date: February 26, 2018 at 3:59:32 PM PST
> To: Julius Smith <j...@ccrma.stanford.edu>
> Cc: Oleg Nesterov <o...@redhat.com>, faudiostream-users 
> <faudiostream-users@lists.sourceforge.net>
> 
> 
>> On Feb 23, 2018, at 12:17 PM, Julius Smith <j...@ccrma.stanford.edu> wrote:
>> 
>> Hi Mykle,
>> 
>> Yes, iFFT takes spectral-bin signals in parallel.  Right now they all
>> run at the full audio sampling rate, but later we should be able to
>> downsample as is typical.
> 
> Thanks.  Clearly I have wandered in over my head, math-wise.
> But after reading all weekend, I think I now (sort of) understand 
> the difference between the real and the complex FFT.  Or so I’d like
> to prove to myself, by making this algorithm work in Faust. =)
> 
> Nevertheless, I’m still struggling.  I expect this to work, and it doesn’t:
> 
> import("stdfaust.lib”);
> process = no.noise : an.rtocv(N) : an.fft(N) : par(f, N, (/(denom(f)^beta), _ 
> )) : an.ifft(N) : ba.selectn(N*2, 0)
> with {
>  N=8;
>  hN = N/2;
>  beta = hslider("beta", 1, 0, 3, 0.01);
>  // Convert par() index to appropriate coefficient for pos & neg freqs 
> produced by complex fft
>  // For instance: 0 1 2 3 4 5 6 7 -> 4 3 2 1 1 2 3 4
>  denom(f) = ba.if(f < hN, hN-f, f+1 - hN);
> };
> 
> 
> And while trying to debug that myself, I hit an even bigger snag
> with selectn().  The code below seems pretty straightforward,
> but it does not work at all like I expect, and I haven’t a clue why not:
> 
> 
> import("stdfaust.lib");
> process = par(i, N, (2*i, 2*i+1)) : par(i, 16, hbargraph("[%2i]value %i", 0, 
> 20)) 
>  : ba.selectn(16, pick) : hbargraph("selected value", 0, 20)
> with {
>  N=8;
>  pick = hslider(“pick a value", 0, 0, 15, 1);
> };
> 
> 
> (Possibly this is because selectn() expects an integer?
> The SVG shows me that the hslider is producing floats, 
> even though there’s not a decimal point in this program.)
> 
>> Note that for 1/f noise there is a spectral_tilt function in
>> filters.lib that will provide a 1/f filter for white noise as a
>> special case.  More generally it can provide 1/f^alpha over the entire
>> audio band, for any alpha, to any desired degree of accuracy.
>> Moreover, alpha can be safely modulated over time as that only moves
>> the zeros of the filter.
> 
> Thank you!  For any sort of practical use, I’m sure that would be ideal.
> At the moment I’m just researching the various different approaches to 
> synthesizing 1/f noise.  I expect this one to be the slowest.
> I wanted to see if I could code in Faust, as a learning exercise.  
> (Boy, am I learning …)
> 
> -mykle-
> 
> 
> 
> 
> 
> 
> 
> From: l...@grame.fr
> Subject: Re: [Faudiostream-users] FAUST Compiler for GPGPU?
> Date: February 27, 2018 at 12:35:59 AM PST
> To: Christoph Kuhr <christoph.k...@web.de>
> Cc: faudiostream-users@lists.sourceforge.net, Thomas Hofmann 
> <thomas.hofm...@hs-anhalt.de>
> 
> 
> 
>> Le 27 févr. 2018 à 09:13, Christoph Kuhr <christoph.k...@web.de> a écrit :
>> 
>> Hey,
>> 
>> we are trying to implement FAUST in our online environment untill CfP.
>> Chances are good that we could submit some proof of concept.
> 
> That would be great yes ! Is your «  online environment » visible somewhere?
> 
>> So, we will try to attend the IFC18. Even if it does not work out, I may be 
>> able to drop by.
>> 
>> However, I will be present at the LAC 2018.
>> 
>> 
>> BR,
>> Ck
>> 
> 
> OK.
> 
> Stéphane
> 
> 
> 
> ------------------------------------------------------------------------------
> 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


------------------------------------------------------------------------------
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