Distance Sensor, Arduino, Max and routing a range of input to a tone

    Feb 19 2010 | 5:57 pm
    Can anyone give me some suggestions on how to do the following:
    I'm using an ultrasonic distance sensor hooked up through Arduino. I want to capture the distance data in Max and route a range to specific tones.
    for example 1)if something is 600-800cm play a 90hz sine wave 2)if something is 300-600cm play a 900hz sine wave 3)if something is 0-300cm play a 60hz sine wave
    I have the cycle~ and frequency part down..i just need to know the best way to route the ranges
    I've tried using split~ and routing ranges into 3 different cycle~ and audio out objects but when 1) moves past the threshold and plays 2) the 1)just gets stuck at the peak and continues to play. I'd like the transition b/w ranges to be smooth

    • Feb 19 2010 | 8:43 pm
      using three separate [cycle~] objects is the problem; can you just use one, and use the ranges to trigger discrete frequency values, like this:
      if you need something with a little more, um, finesse, then say the word Brendan
    • Feb 19 2010 | 8:57 pm
      actually, i like this version better; smooth transitions between frequencies; no doubt someone will suggest something a little more elegant:
    • Feb 19 2010 | 8:59 pm
      I'm not sure what to do with this. How do I open this patcher in Max? I'm just learning MaxMSP btw.
    • Feb 19 2010 | 9:01 pm
      nevermind...I just figured it out. Open from clipboard. Wow I had no idea you could do that. Thanks for doing that...i'll hook it up and get back to you
    • Feb 19 2010 | 9:07 pm
      well, if you're programming the Arduino and piping data to MaxMSP, that's pretty hardcore dood; let me know how you get on
    • Feb 20 2010 | 7:04 am
      I'd stick to one cycle~ and splits and smooth the frequency transition, another option to do smooth switching is a matrix~...
    • Feb 20 2010 | 9:25 am
      @stefan, I was right
      "no doubt someone will suggest something a little more elegant"
      [matrix~], nice
    • Feb 22 2010 | 12:14 am
      THanks for the help guys..Brendan your second code was working pretty smoothly. Stephan yours def gave it a clean ramp. This is for a school project ...i'll try to post a vid for you guys to see when i'm done. Again, this was extremely helpful!!
    • Jan 11 2016 | 12:58 am
      Hi there.
      How did you get the range into Max?
      I strugeling with this.