-
sleepsignal
Hello all,
I'm pulling data from four ultrasonic sensors into PD. The sensors are managed by Arduino.
Everything is working so far, and I've made some midi controllers from the sensor data for use in ableton live.
Basically, Arduino is sending an array of sensor data to PD which is then parsed and split up into Midi CC sends. Arduino is already sending the range constrained within midi controller numbers 0-127.
I'd like to enhance the behavior a little. When someone walks into the sensor from the side, it jumps up suddenly to reflect what ever distance they are from the sensor, and when they leave the beam (out of the side of the beam), it drops back almost instantly to 0. THis is normal of course, but I'd like to accommodate for this in PD. I'd like to gradually ramp the midi controller up and down to eliminate these abrupt changes... it would be nice if the maxmum speed it could go from 0-127 was a second or so.
I'm really at a loss as to how to smooth something like this out, when it is always changing. Ramping up to 127, or down to 0 gradually would be relatively easy... but ramping up gradually to 50, then down to 30, then up to 127, or back down as people move in and out... that's beyond me. The number to which they should ramp will be dynamically changing, and it would likely change even before it reaches the last initial target. Basically in animation, this behavior would be called easing.
I may not be able to get this working, but right now I'm not even sure how to get started fiddling with something like this.
So, my question is, where should I look to get started? A low pass filter or some other type of envelope?
I've attached a stripped-down sketch that shows the main section, basically pretty simple... four sliders (just visual indicators in this case) and four midiCC sends.
Any tips to point me in the right direction would be much appreciated. Maybe this is too complicated?
Thanks!
http://www.pdpatchrepo.info/hurleur/programmController_v10.pd
-
sleepsignal
Hello all,
I've not had much luck figuring out how to execute the basic concept of 'do/while' in PD.
Basically, I want to create a MIDI CC oscillator that cycles up and down between 0-127 (ping-pong) while a particular condition is met. The condition is a number that I'm sending over serial from Arduino that signifies a composition level, (level 1, 2, 3, 4, 5, etc). This number is then routed using a Route object into different branches which bang and send out MIDI CC data.
So far, everything is working in terms of routing and the general program works. What I don't get is how to 'cycle' something in PD. Here's what this particular section looks like, but it uses a bang right now, so only is working manually:
(route 1 2 3 4, etc)
(1 is the number that routes to the following bang)BANG
TOGGLE
(route 1 0)
/ \
(0, 127 6000) (127, 0 6000)
/ /
(line)
/
(ctlout 5 15)So, basically, I want this MIDI 'Oscillator' to ping-pong back and forth while the condition is met that the program is on 'level 1'.
I've been having success learning PD on my own, but am stuck on this part, and would really appreciate it if anyone can point me towards a concept or hint that might send me in the right direction.
Thanks in advance!
EDIT: I neglected to post the patch before.
http://www.pdpatchrepo.info/hurleur/programmController_v01.pd
-
sleepsignal
@Gromit said:
[mapping/smooth] ?
Hmm... interesting. [smooth] might just do it. Will try it out today and see how it works. I just tested with sliders, and it seems to iron out spikes, which is mostly what I'm dealing with.
Looking at the 'guts' of smooth, I don't actually understand how it works at all... yet.
Thanks Gromit.
-
-
sleepsignal
@Gromit said:
or maybe like this ...
That's really cool, Gromit, thanks a lot. It looks like a little machine. It will take a me a bit of time to dissect this, but I can see that it will provide a new level of interactivity, especially when I can change the speed based on sensor data.
-
sleepsignal
@moog1 said:
Is this the sort of behaviour you were looking for?
That's exactly it! Thank you so much, I think I can expand on that through out some other parts of the program, too.
-
sleepsignal
Hello all,
I attached a reduced, simplified and cmmented sketch which only contains the area I'm working on. It seems I am missing some fundamental part or logic behind PD which can execute the classic 'do/while' - ie; executing a block of code only when a particular condition is met.
Any advice is greatly appreciated!
Thanks.
-
sleepsignal
Thanks sinewave. I'll look into the trigger object. I'm working on the far left most branch. Although the random sections aren't hooked up yet, I'm still able to test out that section by clicking the bang, or forcing the random number to happen. There are some untied strings and sections that I am ignoring right now.
I think I have made some progress by using the metronome object to re-trigger the bang at a particular interval to make the action repeat. Now I just have to figure out how to start and stop the metronome.
Good point on the random going from 0-4! That would have been a stumbling block as I started testing out the full program later.
I will clean up and repost today my progress.
Thanks for your suggestions.