Vectral~ use as a fft noisegate release time?
I’m trying to build a FFT noisegate / expander similar to the tutorial#26, but I’d like to try to get rid of the watery sound by having some kind of attack/release control in the expander*. For example, if a bin amplitude drops below the threshold, I’d like it to take for instance 4 windows before its amplitude drops to the set value (eg. zero).
As I’ve understood it, vectral~ would be the object to use. However, I can’t quite wrap my head around how to use it. I’ve made an attempt, where I’ve tried to do something like that with vectral~, and it does seem to be doing something, but I’m not sure what it’s doing and whether it’s doing the right thing. At least its behaviour seems a little strange when changing the parameters in the main patch.
The 3 attached patchers should be placed in the same folder, noisegate-example is the main patch.
Any help is much appreciated.
* There is an older thread about the same topic, but it didn’t really solve the issue.
If I understand correctly what you’re looking for, this is what you need to put inside your pfft~.
now in3 does nothing (I didn’t really understand what it was for), in4 is the
gate’s attack and in5 the release.
Then, it would be cool to have the times and threshold expressed in some more intuitive measurement units…
----------begin_max5_patcher---------- 793.3oc6X1saaBCEG+ZxSgEZWMkUgMwIvtXR64XpJxk3z3UvNBb55VUyy9L1 PR5GXbJdztocCQ9iX9e9cN93i49IAgWItiVEB9L3afff6mDDn6ptifl1AgEj 6xxIU5oExo+Pb02CmZFRRuSp6d8ZoXmbO.1NxVhLaCie8xRZlz7BfIQWDMEf v35elaZndBtr4+vVoWK05+ITT6BsVvkbRAUOzWKYj71Q36JX7bpTKLzwNUBo s2nSVjJ1uzKBDcQTcuOLYR8ioCyv+3daV7bsoBQZaMN9Bb2VLL0KVLrCKtoa yLk+bK0nvvJ10b0K.bo+PBiCPVfxi7+wViBfImISfdgIgGzRE4V5pkJonT+R hTVxtZmzrgIPCE8zzXySv6K66eGTp44Lqnaw+JgSaE4RQFozAvfPNjZAN2Kj A85HyzgwnLQQAkKeFjTwljrarQnHMZzjYVrU9f8xlNOl5sKitjlSIUTKV8ri FM1dPQ76Mit6jqy52MCwNjbE9dO4ZfdZ0irrMDnVggdOoqBpXKP0jOwIlF8e l1l1lbCnjTrspPHja.L.yVXqlslcqPnUDetkIE6KB6OznJVlwWK12ahqE5m3 Ta0M5mRjlcl7fUmN9k94UwoBZUE4Z5y.UsR.e.1KmZx5YRwCSdYPgeSJHxqA N2pr6RRd+ANM0CAirtUJ9MYqzefRDUUGJEp5DcnDw4QNb4y+hKPzVJG00yAa HbtBL8CJH1gHH+TBQ7PIUGLSq3vbF+oehCsUW2+iAYkXWYV6KosDIvQCeEsR QQhjI3mLI0AR.zg4rgsZEkeZsfErUaEpTiMZnCupyRJxQIAGMIE6fhpuz0IS pWIgmoOyqIHLI8PqAp0TGzZ74IUjVpvXn9HniMFnRw9WoCMzyU3cF6FfKL.a g9iY.iwGZMTw9Hc3GG8hHs5vIm3owIilTguBolp+RQM2ILcvRMwgH.73FT5f hPithfNnnwKAMxAEoSPOtRp2yLVLt9sDW0z3gomffNzT56OWW5445ZNgOwjn xblPxvOs+IUczwdwnwMLatK4GhFfKU03gI+FTXEYtB -----------end_max5_patcher-----------
… just swap attack and release…
A couple of quick things:
@andrea – your [vectral~] is in the wrong place – you are smoothing the amplitudes of the input after gating (which will result in a kind of time smearing of the input – what you want to do is smooth the gate control signal (which could simply be the output of the [>~], although if you want control over the level when ducked you’ll need to do something a bit cleverer than that.
@ visa tapani and @ andrea. The spectral frame size (or vector size within a [pfft~]) is HALF of the FFT size – you want the second output to [fftinfo~] – not sure hpw that affects things (if at all) – but just to be clear that the patch doesn’t seem to work the way you think it does…
Here’s a corrected version of andrea’s patch – untested, but it should be right:
----------begin_max5_patcher---------- 783.3ocyX1saaCBEG+ZmmBj0tZpqBveuKlzdNlphnNjTVsMQ1jtrU09rOL3j 3lFuPV.TuwVbvP9e94y4vw44YAg2y2R6BAeE7CPPvyyBBTl5MDLLNHrlrsrh zodrvF5u32+yvazSInaEJyKWJ3aDuBP6loYSszPEUnVFbvJag5ok6vWvvcO5 RdingTSUS88VFoZ7Lcr+nlAguEdXuYM61Z7fw0DQ4CrlUyaokBsGgxgx0.hv 482x52..VZBbW+RdY1r9K2bcN9me8zdLZvp1j32qoZME1wV0H8PvcuGInB2i jrBEEhSTjI51D6iDVC.egP4z3H2N3.MMNvYpHjLMMfGBPFVRG4I5h4RwHWwb hPzxteiPmvDrGJAg8yLujWWSazHHTMgBmVBpeylwYYtONqPgTDTcqH1Eodq4 UBdIocBxfOCYt4eynTeUdBWXixS6h9NFRszJJoiZbYYThyS5PXkeiTgFIPm3 1xLRR4il60QN2qSsmSOcc2DqT2E4qPfH3G95tRnFaEnBcNTGeJ1GZltl7Hnk TutqlyEO.X.lMHrkZdJZZ.qg5PhLxI4vx9nYMK4SbjV7T.g0WB7T2NEnbeaU wopS8UDJo3p5wrl10QVQeGn5UG3SHaD3j37S5GBYzE8zE+Q41Mv4I4OVKoxh cIF477oArrqUQmjPI6OTvkcJ5jlDw9pOZco8T2UxYxubOxX.cl9oceOEEiN+ CAQmjUJoEVwZN9e8Psg81eK.63aZK24xC9A.u2AWP6jviHX7lQOiLyAb3b2G XKVPaF23YMawZtr57fDv4o8kHQYQpWxE6GLwaYaKUz+gTiGcFnZjEzJ7LZEe YX0BJBYfhP9SQEF.o9ua0iTJxDIUbYRRmAfw4pPs778itV9kYfXidSRy60ZI uh2NTvoO3Gt+BZTu1Gm1.iU9RTg9a.g6GcktD1T76wnTSRkKNCksrjfFJI+Q obCptj325colTvC52XoTSNV.5WNkaRNWlW4D1TIA8pjPlbVk+nThgk+8GjJr uhhzsOp+B7zCCNpK3YuL6ufr.tVw -----------end_max5_patcher-----------
Also, here’s a more efficient way implementation in which we don’t calculate the phases, and do the amplitude modification in cartesian form, so we also lose the [poltocar~]. That should save on CPU:
----------begin_max5_patcher---------- 796.3ocyXt0aaBCEG+YxmBKzdZJKxW.RXOLo84XpJxk3z5U.GANccqp6y97E RBIMjvTrsZd.jugOme7+b7I75jn36EuvZiAeE7CPTzqShhLco6HpqcTbE8kh RZqYZw0reIt+mwSsCIYuHMc+4+tqq5sUhsxRlzLeTWu1tj+dCytYws7Gpokw f65l.ek44nd1eIY2iZsnVVSqLKI96Mb076MRK+OlQP3YvC6Mud2Vi65bCUV7 Hu9gkMrBoc2IoIp0.vjT8MBYVppAbFDbmdIuMYh9xzaiHqWKUN8eAnyCF368 aLz+NNDYb7L8RAyMWcsi6Ro.JOXHwmZAdM.+eBkyiiEtAGngwAdNzHMrz.dP fzsjV5yrUKUFiZEKoRYC+9sRaJjn8PIJVOxxBQUEq1hfXy.Fb5Hn9MWpyl6c cFJ2fTDzbKO4lB81Q1SYRCqjQaYiNkCJ06BJD1HhPF2NE5E2Vo1nEOMdul3c uNycN8v4TRcRNETnj.D3G9bJJnl3DnB8NT6mg9CMS2PeBzPq1zVIDxGAb.2E D1QEFPtTgAZn1EHi7RLrpFQd8Zw.GjkLDP35Tfm614.k+KYHIybhlgPo42T8 SUr1V5Cr2AJs0A9DxEBmTueRemjwlzyl7GsvsBmmUaVCszgU.Q7d7TGV1UFj WBnJnMRwFwPfAeEvL8hHBGpZDso1y7WJmA+WojQCnKiJ+WSAAYqfN2Fqs3rr xXZwk75S+FGlGnt+iAXqXaSwNWtKp.b3L0UrVE7nRtnt2bRNZNOxWshU2uvy BQono68q1Jg6uf5cdcEe0FgJGdmglYyihw5ajLx9VCnEFqCkLBGR+cH.nK3Q mXq2nIo+O9iylfgylNh.C+dGETK5ZPxPxvZR3qXRjwGb.mkjo9MeZuvjKDgj PLwFn4DSxx78MBjWg7qWkzqrSSq.neve3hwvAUPSFaLlmS2qdq6nz85uq0Uc IxQJdG4QXXhQHSrGPmB225VcownjyuhK4XkLbjlT3jxKFQvUZXC2WLlnq4Ak R3wZRgCSoiLfMbVTt6sHh8zZ6GNH6PiSJdexaS9GprGhCA -----------end_max5_patcher-----------
of course you’re right, thank you – I definitely made it up too quickly!
I liked the reverb-like sound of the thing, though… I could use it someday ;)
for the record, I think it could get even more efficient if we remove also the cartopol~:
----------begin_max5_patcher---------- 893.3oc4XtrTaCCEFdsySglLcEMMit3qcQmoOGcXXDIJAU7kL1JTZYfm8JK4 DLfirfXqRIrHFonH+e97Q+GIe2DuoWVbKqZJ3qfe.77tah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D+ntMxjMtexeA3s.DrI -----------end_max5_patcher-----------
Yes – if you only calculate the square amplitudes (and then square the threshold you can lose the sqrt from the [cartopol~] calculation, which should be cheaper also!
Thanks a lot for your help Andrea and Alex! These solutions seem to work indeed. The only important thing I’m missing is control for the level of the bins that fall under the threshold (what ‘in 3′ did in the original patch). I’d like to also be able to invert the action of the effect and boost the quieter bins. In the original design this was simple to do, but I’m not quite sure how to implement it in this design.
I’m still having some trouble wrapping my head around how vectral~works… Since the inputs to vectral~ are now either 0 or 1 from the >~ comparison, is the output then a value between 0 and 1 smoothed according to the rampsmooth time? In what kind of units is the attack/release time actually given? If the attack is set to 2, does it mean that it takes 2 (or 3) window sizes for it to reach the target value? Ie. if the >~ goes from 0 to 1 for a certain bin, on that window for that bin vectral will output 0.3333, for that bin in the next window it will be 0.666 and in the next 1?
Also, the input index of vectral puzzles me slightly. In all the implementations I’ve seen, FFT bin index is connected to both. In what kind of cases would you have a different signal for input and output index?
Sorry for the dumb questions!
You can view it this way:
The output of >~ is the gain. So, it will be 1 if the amplitude of the bin is above the threshold, or 0 if it’s below. This gain is smoothed by vectral~ and applied to the amplitude of the bin. Knowing this, it’s not difficult to change these levels (you can use e.g. a selector~ and two sig~).
About vectral~, you can imagine it as a sort of a bank of rampsmooth~s taking turns. The 1st rampsmooth~ operates on the 1st sample of the vector, the 2nd rampsmooth~ on the 2nd sample and so on. The smoothing time is expressed in frames – it makes sense because for each bin every step of the smoothing happens once per vector. Keep in mind that to convert frames < -> ms you have to take overlap into account.
Let i and j be the indexes at a given moment: then the j-th sample of the incoming bin gets smoothed and sent out as the i-th one. Most of the times you don’t want this, so usually the two indexes are the same.
Hope this helps!