Selecting highest (or average) in a range of numbers over a set period.

Oct 7, 2010 at 2:30am

Selecting highest (or average) in a range of numbers over a set period.

I have a MSP patch reading Db from a single mic. This is running alongside a counter that plays a simple four note tune every four seconds (1st note on the first second, 2nd note on the second second etc). The counter stops and resets after a few minutes.

Then I have 6 presets for different synths from which the simple tune can be played.

I want the Db level to determine which synth is selected. The louder the mic input, the more chaotic the synth sound selected.

Essentially, the result should be a patch that allows a theater performer with a microphone to have the “score” react to the performer’s volume. i.e quiet speaking triggers soft melodic music, shouting triggers distorted disharmonious sounds.

I currently have a series of gates with “if” statements. The gates only open when the 4 second tune has finished one cycle (4 seconds) then, the Db that I happen to be inputting at that exact moment triggers the corresponding synth and closes the gate for another four seconds.

Problem is:

If the opening of the gate happens to correspond with a breath between two loud shouts, the first Db reading taken will be low and so the gate series will select an inappropriate synth from the presets.

So:

Can anyone recomend a way in which to average a series of numbers flickering in a number object over a period of time (say four seconds)?

or…

Perhaps I would be better off taking the highest number from the four second period and using that for the selection and if so, how?

Cheers,

ND

#52628
Oct 7, 2010 at 6:18am

You probably need to clean up the audio from the mic first before analysing it.
maybe bandpass it between 150 hz and 1500 hz to isolate the voiced part of the signal.
Then do some dynamic processing, an expander, or gate (or both) to attenuate the low amplitude background and exaggerate the dynamic range of the voice.
Then devise an amplitude follower, maybe using [average~].
Then maybe employ some hysteresis function, so the switching is reliable.
All of this is do-able in max.

Hope it makes sense,
T

#189219
Oct 7, 2010 at 9:25am

here are some tidy examples of envelope followers which may also help:

http://cycling74.com/forums/topic.php?id=28761

Brendan

#189220

You must be logged in to reply to this topic.