output sound every x interval with some randomness

R_Gol's icon

I have a counter that runs in 1 sec intervals.

I have a bank of 10 different sound

(this should be changes dynamically because the numbers of sounds will be change from time to time) so it should be a drop folder to select the actual file quantities and names.

I would like that as long the counter is running a sound will be outputted every x intervals with some randomness for each time that is chose between two values.

the sound should be heard for 1 second or 2 at most (choose by user)

for example system is set to output a sound every 5 seconds with a randomness between1 to 2.5 sec

so if counter is running and first sound was generate after 5 seconds, the next sound (as long counter is running) will be generate after time that can be either 4 sec to max of 7.5 sec.

the chosen sound to be generate should be either random (every time a different sound is chose) or in sequence.

I have this starter patch:

how can I add the randomness of output interval?

how can I add to choose either random sound or sound in sequence?

Max Patch
Copy patch and select New From Clipboard in Max.

Thanks

TFL's icon

I would use a separate delay and add a random value between -1 and 2.5 to the base duration of 5.

Max Patch
Copy patch and select New From Clipboard in Max.

What you don't say is if the mean delay between each sound must remain 5 secs or not. Like after 1 minute, should the next bang happen exactly between 1'04" and 1'07"05"? Or would it depend on the accumulations of the randomness of previous bangs?

In my patch I simply retrigger a random delay of 5 sec with a variation of -1 +2.5, and the next delay is triggered immediately after the previous one is done, so the randomness accumulates.

About polyphony, check poly~.

R_Gol's icon

How can I fade out the sound before next one starts?

R_Gol's icon

This is where I got so far. Seems right to me but a bit messy?

Max Patch
Copy patch and select New From Clipboard in Max.

TFL's icon

If you consider that you'll never have more than 2 sounds playing together, then you'll need two [sfplay~], and you'll have to load your sound into one, then the other one alternatively, so you can fade out the previous sound while the new one starting.

Source Audio's icon
Max Patch
Copy patch and select New From Clipboard in Max.

R_Gol's icon

How to make the random to have the option for both direction?

so if base is 5000 ms between events -1 and 1 will make next event between 4000 and 6000 ?

another question - how to random the sequence of sound rather each time pkay the next one?

Thanks

Source Audio's icon

I am out for the rest of the day.

Maybe in meantime you will find answer by yourself.

Source Audio's icon

to toggle between 5000 + (random 1000)

and 5000 - (random 1000)

do you really need help with that ?

2nd question :

You allready had random selection from

the menu in patch you posted.

What is preventing you from using that ?

R_Gol's icon

What is preventing you from using that ?

True. I managed both..

R_Gol's icon

I would like to add a background noise (for the moment just a pink noise) that will work constantly apart of when a sound of the sound bank is entered - in this case the background noise should be compressed and reduced almost completely (simillar to ducking in a radio show)

This what I came with:

Max Patch
Copy patch and select New From Clipboard in Max.

Source Audio's icon

no need to look into that patch.

I guess you want some sort of ducking gate ?

for that you really need to measure playback level.

Only reacting to playback start/end won't do, because

there could be some silences during playback, right ?

R_Gol's icon

Only reacting to playback start/end won't do, because

there could be some silences during playback, right ?

True - could be silence during playback - or more of a fluctuating in loudness

Source Audio's icon

duck-me-do-o-ho-ho


R_Gol's icon

I have issue with this patch:

when mouse is pressed it will output sound without waiting to the mean intervals between sounds.

so if mouse is presesed it will output sound straight away and only if mouse continue to be pressed it will output next sound in the random interval. I would like that when change from o to 1 the sound will not outputted right away rather will be in the chosen random interval

Max Patch
Copy patch and select New From Clipboard in Max.

[Edit patch]

Source Audio's icon

Sorry, I don't understand what you are talking about.

if you want to delay mouse state = 1, and pass 0 immediatelly,

this could work:

set delay time as needed