Delay an audio fade?
I have created a patch that takes two parameters: an audio signal and a threshold value (in dB). A screenshot of this patch is attached. Currently, it outputs audio when the signal is above the threshold level and no audio when the signal is below (a very basic gate).
What I want to do is trigger a fade of the audio 1) after a certain time has passed since the threshold was broken and 2) over a certain amount of time. For example, the audio would fall below the threshold, thus breaking the threshold, and trigger the timer that will fire the fade. If the signal goes back above the threshold, the timer would be reset.
I don’t know what objects I should use to do this. What would you recommend? Should I be using `gate~` at all?
P.S.: I posted under Max4Live because I am working in Max under Live. This isn’t really M4L specific, though.
you did not ask this, but are you sure that you want to use [>~ 12] on a music signal to do something to its power?^^
it should be better to measure the power of the incoming signal first before doing that, otherwise [>~] won´t do anything. oh, and i would eventually convert the db/A value to linear 0.-1.
now to your gate, this seems the right method. note that it takes floating point. you could put a slide~ before it for some fade in fade out or something like that.
I don’t understand why it wouldn’t work. According to the documentation the left inlet can be a signal and the right an int or float to compare against. So the impression I get is that the object converts the incoming signal into a value (e.g. dB) that can be compared to the value in the right inlet. Is this not the case?
How would I go about convert the dB/A value to a 0…1. value?
In answer to your question,
>> How would I go about convert the dB/A value to a 0…1. value?
dbtoa or dbtoa~ (or, in the other direction, atodb or atodb~).
In answer to what I understand to be your original question, here are two example patches.
This first one doesn’t incorporate any delay, but does use smoothing to create a ramp on and off instead of an instantaneous switch on and off. I find this is quite adequate as a general-purpose ducker in live performance.
----------begin_max5_patcher---------- 717.3ocyW10aaCBEF9ZmeEH2aVmxx.7WoSZSZ+NlllH1zFZsAKaRW1pZ+sOy A67QqsiSZRVtwIbLAdee.NbxSibbmoVxKcQeA8CjiySibbfPl.N0scbyXKiS YkP2biUYYbo1cr8cZ9RMDOYQ7C7DDaQhP07xaURsjkwgN78BAKs4M4Lc7bg7 teUvi01o2e5DZvXDIJbBdLZJ07jhmfQ+r92HRfwQM69OQvqlhh6lYBW0wMlz RwegIkPWEVtHSHS4ZvEj0AUKzMQwlfOOZj4w3AhCI+2UB5MzHu58uzD0NE5+ jysN0sTbmrhEqb1dwIBvGR..Heu9vTf66lIjCfI1e9tsfcklFz7r0U5H28XA rNZydTyf7AKruFs0Fzi2J8GOsKyzolO77mDzyogv8YcldzVm6fHErr7xLkRO +EzUTzUdmF.4AG.HXe.P3vdyW3sODx6TSnu80JxPNkXYJFfCo+8Mz+O6a55J jC+tCqoovVAebu6DHWJ2bzEEzyK3kyUoIGDIHjMPQXun3lKcRvzZV7CHsHiO FIjnxpDKoUUqT2uTgjGqVXyySODXQwP1U3QDbSpmW6rJ5RmUE7TNqjeBgkmM SqkXj9fU3kBrfwryzrqSv1ZFE7FIS5sDE+VqPA2d5x1pP41TESeMpykvyqyo akFsWm6cjbdWGzOuFutVqgXb56031q3+bs+Wmx+buIenFlbbL70us7aX1fzS u5ugB50DeauWpVTD23t5Mgn0ZNgWpERlVnjazGS8eHxpNMWjjvka5fLQRtRH 00ZfVkZqpvoahfpnlBnwzX8zHJYyR4IcmYZnx2enxm1i7OdxgLHbFtCbdD0C cn7AeVzyfjC87gmgJG7kibB2gbd0YQeh4nXDsN8T82OAmDekvZW8AmMVFLDV Fcfxwl0kkm+HunrdLAkTc2x8pBSyvwPSgz1DFwpxLeTzz+oiLi1yi9Wkeupo -----------end_max5_patcher-----------
This second one waits a certain amount of time before it begins the release ramp, and if the input signal goes back above the threshold during that time it cancels the release. (The default amplitude threshold is -40 dB.)
----------begin_max5_patcher---------- 1288.3oc0ZttiZiCEG+yvSgEeZmUTVaGmKfTqTeNVsZkGhGvs4lxkoS2p1m8 MwNAxLPbLIlzLRiHXm.4b9ki+eN9v7ikKV8X7KrrUfcf+FrXwOVtXgXppIVT OdwpP5K6CnYhKa093vPVT9p0xykydIWL+efgvMOzL8SwQ4QzPl3TeNkSCZNS BMe+Qdzg+MksOWdisb71.WCHP4Ab0qX3FH3ep+Lbew2S7ie4CX7oaQ5gGqlt 7BacSy3+m3lhvmlNpHjGEvxE1O57jwE4MyBql7mKWV8x5wBB6QxAqsBBXYqh CH24OGFIFbcD.vSIFHydLTZPnwABGX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acfSUy1lJ6QS5flDqg3M+LGsDpP5q LfIakZAh1qignSitCJCBOvpOOv417.BT3AVPGg1lk6oQ2KO.qi31DESnidBw axV.W004dsG6IzdzvblNqAqCcDHbZhdvZXNtSGczEN2PgOdaaDEj+RYMCtCR CHcp6ACGTgaVVh8OH8Fwf6gC3YhB2dqCTWqY8Oe61SCtGNfiIdBXP6QG0m2X z2U6Aqq8LrzuvWk98tDhhzMDcZDPQ5HnOhRxfupjr9IpbuvzjjmYoY0Vgv3K 2x+WhSqF5rVLjGIGJrgUorm4MWu2xpuset7+AuvR5fC -----------end_max5_patcher-----------
Thank you. I will dig into these tonight when I get home.
the left value can be compared against the right value, of course.
but what do you exspect when comparing the music with a db/A value?
db/A values should be compared against db/A values i think.
@Christopher Dobrian, thank you for the patches. They are very clear. I’m going to spend some time studying them to learn how they work. I do believe they answer my question.
Good. Glad to hear it.