Scriptnode - Bias



  • How can I implement a bias offset in scriptnode like the one in the shapefx module? I'm not entirely sure what biasing actually does to the signal in a digital domain tbh



  • @clumsybear I think by using math.add before a node...? It's working for my LFOs...



  • @ustk ah, that seems to be working
    thanks



  • ok, I have two issues with the way I implemented this in scriptnode.

    The first is that math.add results in a constant peak in the low end at around -1dbFS. I'm trying it to use it as a bias for the math.tanh to get odd harmonics out of the tanh function.
    Using the BiasL/R in the shapefx works without the constant peak.

    The other one is that the math.tanh node acts as a gain module atm. would it make more sense to put it in a container with a gain node so I can leave the tanh module at a constant value?

    HiseSnippet 1678.3oc2Y0saaaCElJNLoNcKqsHXq6NghdQJPVfcZW6.1FhyetvnwIFwto8tNFI5XBKQpIQmD2hArK1KytoO.6l0Ggg8Frmf0c+.1NjR1hJQMwwcMoq9lFRdH02467KYaDJbnQQhPjUwV8CnHqOB2rOW1YsNDFGUacj0r3mPNfF0gDPCe1RnU6GPhhntHKqBOTIiUwIQ5eud4UIdDtCMcJDZWAygtIymISmsQkGw77pRbosX9FReuJ0bD70Ddhd.dJfKgBHNcI6S2hnDaBLxZpMbYRQXSIQRiPVStpvseyNhC4wxuKKhsmGUMnLpIbPwSWU34pPrZVzZcXdtMFn2QHjEtQJKTHlElCWm4xFNeJabM8B1o6vjOrl3zfW4yFdkxCdVFvaxX3ccbSmPVfLcEE1tJtFWRCaS.SfIrhkEY8J7ZBP.tbQeRWZ0PXvvML+cKUZA6xkJcmutcOtijI31B9VBIca972YlWLSwY9gYrO9Rsam6ZpOSnvyiFl6xJqd3osw44872iFtf8ADudzgBBpeV9cpQiech0ZCAE7Zblb6.Zx3S2AAkPafsXhDDBhJ0VhYSrDM8XtzPDCNjowOhK1qLRCdyXAzHu4kN9le8xnGWachjn7GRfC.QHjTxTLg05zCf.sXuih30oQckh.Md8CDbE3sl8LQ7Qlnse5fGTIR1WwqSoED4ybc8nMDQLkcy.k+ZjjFzj8bMxewbu7g+wy+ok8MSRfP9jiL0qndsayNRGc2l44GIArUyGB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7NwV78+ruEoEK3+dbM+E7rrETt75KqItopStuCRm.ULJMfi4YmyuNZFGcNQ47bdUb810pAM7ZbsuPECjsAbGa0eGw9.qLYFJmLI3UD2FRNzYIBkmhbcMcilouATCZfON5360gNK526F1Cc1Vg9Pm81RVHRXcCQMyV5lPdFCx+nu5xwNpkfVs0XatSQdZEl8JiXO1aaQmBYZ44DpHp44lgt1ycZUkcYujNQoJDwMx2lj7onOjnJsUMgj7G4YgsbKNGaw9srFMbVVCLm0tmjiEwS9o3XxvQtGxwA7DNzXUE7J7sLxomJd8Fvz3Sh7eTSrspkSodmFsptldqF5Z3UVx0HZMrOj50gdWA1fXnEsrvutFLYerFD461jYp0WW3lJZH24qRWu0iirfO7xhCRe8UATxMMdte5giSeyjC8m9lmrYnH3wHflte3UseLFMEkLz2PhdDghm5cNRIH9Vib3rOAXU70o6bLVCvulQbMQ.3aHIgsNdFj7I39j6Xzm7Gi9T3Xzm4NF8Y9iQeV3Xzmqcf8A66bw1V5Mo1+nBprL87MNASL0b+e.5.YDZC
    

    It needs to be attacked with crazy gain stages, which makes sense, I think, regarding the electronic of an amp.
    But for lower input, there are still weird things happening.



  • Using the BiasL/R in the shapefx works without the constant peak.

    This is because there's a high pass in the shape FX that filters out the DC signal. So either you find a way of calculating the offset introduced by the gain staging and invert it, or run the signal through a high pass.

    The other one is that the math.tanh node acts as a gain module atm. would it make more sense to put it in a container with a gain node so I can leave the tanh module at a constant value?

    Yes, definitely. As soon as you intend to change the gain as a parameter, use the gain module to remove zipper noises. The value in the tanh node is just for the internal gain staging.



  • @Christoph-Hart the high pass method works for the Bias, makes sense. I have a nice harmonic structure without any artefacts.



  • @ustk interesting approach
    let my ask you, why do you have math.add before and after all the tanh modules?
    also, what's the purpose of all the parallel tanh wraps, as you call them in the snippet you posted?



  • @clumsybear Well, I just tested different signal chains... I found that it is usable, and gives a different result. I have no idea if it is good to do that or not, but it works... The idea was to make several gain stages.
    The chain nodes (wraps) are not really in parallel as I just use them to test and compare different ideas. They are toggled via a knob so it's quick to implement new ideas. They are all different tests, never working at the same time (you can put a clear at the end to kill the signal). It's easier than creating another DSP, going back and forth...



  • nice workaround 🙂



  • After testing, everything seems to work as expected. The only thing I would like to try is setting the high pass filter a bit below 20Hz.

    @Christoph-Hart Is there a way to do this, or is 20Hz the lowest we can go with all the filters?



  • I think I‘ve hardcoded 20Hz as lower limit inside the filters. The problem is that the coefficients get really weird as you approach 0Hz.



  • @clumsybear This is Script FX Biquad Filter. Below 20Hz, it is unstable. Also in about 4Hz, it is shaking 🙂

    alt text



  • Interesting @orange

    I have a feeling that the purpose of why I'm trying to bias the signal before hitting the tanh module makes the whole process obsolete.

    The purpose was to generate even harmonics, which works. the problem is that the filter set at 20Hz cancels/filters out even harmonics. Is there another way to generate even harmonics?



  • @clumsybear You can bypass filters in the Shape FX module with: ShapeFX.setAttribute(ShapeFX.BypassFilters, true);

    There is no bypass button in the unit's GUI but there is a parameter for that.

    HiseSnippet 1096.3oc2W0saaTDEdV6rU0NTDAEj3xUkabkBQ1l1BRHTci+oXQbrU1PK2UMY2isGk0yrZ1YcwBw87.vCFR7Bvi.uAvY10N6LoFKigDUUmax7cNmc+N+O6HoH.RRDRhSkKVDCDmOv0eAWMs8TJiS52g37gtCnIJP5kCcxhXZRBDRbbJ+BMfSk8HY+9ymcBMhxCfBHB4kBV.bJaFSUfNp02whh5QCgKXyLz9ws5GH3sEQhTjOkcqShoAWQm.mQ0pUxk3butgLkP5qnJHg3r2IhvE9SEugmq+KYIrKi.8gFDe7AkC2SDEpYr9+IsmxhBGsxuSHDG2QEQgx4QgCcGvBYWiWDM9nLAdEVXFObJsI50XGomiA81KmdG35GHYwpBIZtsuaeNlnFSwTfIsx0kT5ybbaKPM3pimQuB5IwCWaQsmVu9QdOod8G80Onp9OLUjn7lSkdc56eg223kUWb7DP0c7XHPU6gZ7GtRc8giS.0yUJI6xTETKCImG8XQ3qI4HOkLEzVLNkGnXBtmfelPAC40dT0epZkp+bUuaJZ730JS6IRQTDHWqXckkbSFVimN6RPdD5gQHmVoHFhsyg6uc4vf7.qghBdeNSMLFVdtHKqkk60qjVmbsyZBU3ilnYt1ZTq.5sKhHKS73+8886PUTcc0RLTuXPpXZu0oCLGaXyqxp31ARtRIhwV12pDDaDDgoQTkc2gdjvRAX31pLTWpwSXpEliL9WzxTessLMVm2tkz8.2QLUvz0y2RqguXT61luKG.8.27trBxtmaue3NdZyAqpC7mRiA70q4w8b0M1VLocpbd9.5SXzjSgwJyPlF6b1joVfeKBLBe.lS+OU7FKne42agoFiED2u0v43XD5r3HFehYYj8lHB4bHL0dQzySUhI2XeU1do973TkIZGIatkoCX+n0VNyQZV0xksSHk2tDxZpGNWjpPOb.Emkhua2yRm4iKEC.rbfygH7g65TR2Vmett9rlD9.OL6veg+VJrg9ryRgMVIzrl6v7779tuhNGxFymko+jryiExYdu.3fT27zXCW.3211K.Du0W.XXfBovERJOIVj.MLex2PVSSYc.UJ2V8bHKsztWOz8ZXVhsBroI3HJ25ggma9OVh7GOqKmhIZe.8lvgIAnypicl0JiRiRfWwBUSaXZXAbSS3aVYsks51CiMz+cjKA8++D8+6Kf14lVqImUVwQeFNrB5xmCQ3V1LN9w3Z0wzzH0JT6dpABtHdpfyBrGngiBlLArJhVqCgW.Cu0bAxgsNGh.ZRQeVzu15TFGnR6oq2VwhMku9T2b55oGD389wEGJ+dzEGtM5PwYkuCjouKVwdW7NlQCjhWGj+I.5Vu6mgf9MO6qlqfe9Nd1qAI6CcP6bqebcxLb.9qCBzUGeNFeVuMM2Aa9hcvlGuC17jcvlmtC17k6fMe0FsQu6TeazY40+HvntYeRliS98FxZEH+M14Qj.A
    


  • @orange oh nice catch....



  • cool @orange , didn't know about that. it could come in handy as a workaround to the scriptnode signal flow. But I guess I'd have to deal with the same peak in the low end which is produced by biasing the signal in the first place.

    I was actually talking about generating even harmonics in another way then biasing the signal before hitting a hyperbolic transfer function.
    Like, tanh produces odd harmonics
    What produces even harmonics?



  • Finally found a way to produce them even harmonics.

    • Apply transfer function with positive bias offset to signal A
    • Apply transfer function with negative bias offset to signal B
    • Flip the phase of one signal
    • Add the fundamental
    • Mix signals back together

    I want to create this in scriptnode. how can the math.add node act as a positive/negative bias.



  • Right click on the knob to change the range:

    https://docs.hise.audio/scriptnode/manual/glossary.html#parameter



  • @Christoph-Hart alright, thanks.
    Is there a way to flip the phase of a chain in scriptnode?


Log in to reply
 

10
Online

552
Users

2.1k
Topics

16.2k
Posts