I'm wondering if there is a way in PureData to have some sort of timer that keeps track of the last time a button is pressed, and fades down the mains, until it is used again.

Here is my current system:

Imagine an installation in a children's museum. If a kid presses the button it triggers a sound. If they slide up a fader, it increases the volume on a looping audio track. But if they walk away and leave the fader up, after a period of time, say 1 minute, the mains fade down into a quiet waiting period. Then if some other kid pressed the button or moves the fader, the mains come back up while in use.

Any guesses on how to implement this? Thanks.

something like

[bang] <<< bang this while the interaction is ongoing
|\
|   \
|    [delay 60000] <<< wait 60 seconds from the last time it receives a bang
|    \
|      \   
| [0 5000( <<< fade out [1 500( /<<< brief fade in when interaction starts | / | / | / | / | / [line~] | [pd my sound generator] | / [*~] | [dac~]
a month later

Sorry it took me a bit to get back to this. But this works for me:

Thank you.

And here it is working with analog input too. Any suggestions on tweaks?

What does [sigmund~] do there? It seems way overkill for dealing what it is described in the comment ...

    giuliomoro I'm trying to figure out how to reset the timer whenever the fader is used. Is there a better way to do this? Also to turn back on the audio when the fader is in use, after it's been faded down.

    Also, I think I'm getting some crunchy audio. Am I making the processer think too hard or sending too much signal?