Using a value to trigger a sample
Hello,
I was hoping I could be helped with a Max/MSP patch.
I simply need something that will play samples triggered by a value (which is given by an Arduino board, but I have this part sorted).
I have had something working that a friend did for me (his knowledge is limited), but it didn't work properly. It was a sample set to play at a value, and every other value would give an error message of something like 'no sample' - this isn't important however. The problem was the sample would only play fully when the value rested on the set value for a period of time - I need the patch so that even if the numbers zoom up and past the value I choose the sample will play, and will not stop until it has finished.
I hope I've explained this well.
Cheers in advance for help and advice given,
Alan Joesbury
How are you playing the sample? Without seeing your patch, it is difficult to offer concrete advice.
In general, detecting the number that you want to trigger the sample should set things in motion, and the completion of the sample should stop things, but without seeing your patch no one can tell you how to accomplish this.
My patch as it stands is just parts taken from the Arduino2Max patch that can be found here:
http://www.arduino.cc/playground/Interfacing/MaxMSP#arduino2max
I have the top two pictures (as I'm using analog pins only) and that's it.
I've messed around a bit by sending the value from an analog pin to [KSLIDER], then this to [makenote 80 100] and this in turn to [noteout 1]
however, I don't want the piece to use the MIDI piano, I need it to trigger samples.
I hope this explanation helps.
If my patch would be needed to be looked at, would I just upload it to the internet via yousendit.com or is there a code or something that can be copied into a post?
Apologies but I'm completely new to everything Max/MSP.
How to post patches is covered in the Common Max Arcana thread:
https://cycling74.com/forums/common-max-arcana
There are numerous ways to achieve what you want in Max; without seeing your patch it's kind of difficult. Here's a simple solution, use the bangs to trigger your sample playback - you don't even say which object you're using for playing soundfiles. Copy all the text below and go File/New from Clipboard. As Chris suggests - read the sticky at the top of the MaxMSP forum page.
Apologies, I didn't think I'd need to post the patch as I thought nothing in my patch mattered as everything in it is unrelated to playing samples - it's just the value given from the points "ra0" and a couple of others that I need to trigger samples. I have no way of playing samples at the minute.
Here is the code for my patch (ignoring the messing about I did with KSLIDER as that isn't important).
For now I'll mess about with the patch you gave me to see if I can get that working how I'd like.
Cheers for the help so far.
Ok, just send the value you're getting at [r a0] to the patch I gave you; you might need to look at these objects if the data is in an unpredictable or unexpected range: [scale], [slide], [line], [speedlim]. Hopefully, you're also using the helpfiles for any object you're unfamiliar with.
ps, there are some excellent 'beginner' tutorial videos on youtube: "Baz Tutorials"
I've had a gander at a couple of them Baz tutorials.
I'll work with what I have and what you've given me, hopefully this'll sort me out.
Cheers for the help!
Also if anyones interested in what I'm doing it can be read about here:
http://alanjoesbury.blogspot.com/
And yes, you guessed it. It's a University project.