How can I stop retriggering the same sound with split values?

willraj's icon

HI there,

I hope someone might be able to help me, I don't think this can be too difficult, but am quite new to maxmsp.

Basically my problem is I am using an accelerometer to read in values. With a split object I am isolating a small range of values(eg.. split 460 480) to trigger a sound sample on a particular axis. Typically, when the value(analogue input) reaches between 460 and 480 the sample will start playing. However, if the value stays in this range it will keep retriggering the sample which I don't want. I only want it to trigger the once and play all the way through, before it can be triggered again by the split value.

Here is a patch that shows where I am at..
Does anyone know how I could achieve this?

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

bkshepard's icon

Would something like this work for you?

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

willraj's icon

Thanks a lot Brian,
That sorts my prob out. That (change) is a useful object to me.

willraj

willraj's icon

Hi,
sorry i jumped to a positive conclusion a bit quick there. It did sort out my problem of retriggering the sample(within split value range). However, now the problem is completing the sample playing from beginning to end when the value moves outside of the split value range it cuts the sample short.

Any further suggestions would be very much appreciated.

bkshepard's icon

Try this, then

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

Luke Hall's icon

If you want the sample to play to the end then you need to use the right-most outlet of your [sfplay~] to send a 0 to the [change] object instead of the far outlet of [split].

lh

bkshepard's icon

Like so...

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

Luke Hall's icon

Except if you want to trigger the soundfile again after its played through the first time you'll need to connect the "0" to the [change] object and not just through to the [sfplay~].

lh

willraj's icon

thanks for the suggestions guys. I tried them out, but couldn't seem to get them to work. I have got it to do what i want by changing the 0 going into change object to a 2. So it is not a stop command for sfplay.

Seems a bit silly I know...the suggestion of sending a 0 from the right outlet of sfplay seemed logical to me but perhaps i did it wrong..

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

Luke Hall's icon

Try this. I think it does what you're looking for.

lh

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

willraj's icon

thanks for your help, I didn't know about Triggers.

Luke Hall's icon

In this case it is working the same as banging a message box but you'll find that as your patches get a bit more involved it will become one of your most used objects (this is true for my patching at least). I try to always use [trigger] instead of relying on max's right to left, bottom to top ordering just in case I come back to a patch later, change it round a bit and in the process end up breaking it. Anyway, happy to help.

lh