hurray, this actually worked. I was able to calculate the parabola and it's maxima out of the three known (highest) values. Here's a screen shot of the parabola abstraction and a video of the main patch at work.
Still a lot of glitching that's fine for now:
Here's a zip too, if somebody is interested: draft_04.zip
I'm working on calculating and implementing the y value too. Probably by using filter and parabola in the same way and feeding the resulting value in at the top of the x value calculation... I hope it works out this way.
Looking ahead: @whale-av, do you have an idea for how to make this work as a multi-touch device? Do you think it's possible to just let the filter throw out several of those peak-lists at once for several touch-events? ...without confusing a moving finger with a 2nd finger moving close to the first one etc. Once again a hint would be really great! Thank you, all the best,
sorry for the late reply, somehow the it was not possible to post for some time.
@whale-av, ah, now i understand! So the data size needs to be set to the number of pressure values that i'm sending in to the filter. Makes sense and it seems to work much better now. Still there is indeed a calculation problem in [example] that i now understand. By ignoring the lowest input of the three neightbouring crossings most scenarios cant be handled correctly.
crossing A / note 61 = pressure 75
crossing B / note 62 = pressure 95
crossing C / note 63 = pressure 76
The highest pressure obviously lies almost exactly at B and in the middle between A and C. The calculated note should be approx. 62.05...
[example] though will calculate that B and C have the smallest difference, leave out A, and output the note 62.2.
So it is indeed needed to calculate all three values together if i want to have the correct peak of pressure. I thought and googled a bit and figured, that it would probably be the best if the three known values are used for a quadratic equation that can help determine a parabola and thus the apex of the pressure applied. I think it will the patch more simple too. Will try to do it with [expr] the next days and give an update as soon as possible.
@whale-av thank you very much again for all those efforts. So after fighting around with the needed libraries for [comport] etc. i was able to merge the patches together. The basics seem to work pretty decent, for some reason though the MIDI note value jumps only from X.5 to X.5 or X.49..
So again unfortunately there are steps in the pitch modulation. Couldn't figure out why it happens up to now. Will take a look tomorrow again.
Other than that I was asking myself to which data size I would need to change the filter_x. You wrote before, I would need to change it to 1024 probably. Is that correct?
Also was wondering if my threshold ([pd thres]) is sitting in the right place or if maybe this is causing the problem. See the current patch attached. draft_02.zip and a video below. Again thank you very much. You already helped me a lot!!
@whale-av @bocanegra Thank you both so much! I spend the past 5 hours going through your patches trying to understand everything. I think I got what's going on now (seems to work amazingly!!) and will start to install the needed libraries and merge base4.pd and my comport patch. I'll give an update as soon as possible!
@whale-av, thank you so much! This is truly amazing!! I must say i'll need some time to understand everything that's going on there (especially didn't know the [text] objects, they don't seem to exist in pd-extended) but i see how this is already solving a lot of problems for midi environments (and probably also for multitouch)!
As i said, I don't grasp everything yet, still i'm asking myself if the following issue is addressed with your patch:
Let's say my finger applies the highest pressure somewhere between column A, B and C. - Could your patch determine the exact location and pressure applied between those 3 columns?
crosspoint A1 = 75 pressure
crosspoint B1 = 91 pressure
crosspoint C1 = 83 pressure
Clearly the highest pressure measured is at B1. But also the three values together indicate, that the actual point the highest pressure is applied lies "a bit further" from B1, in the direction of C1.
This is what i think needs to be calculated in order to get a continuous pitch modulation, without steps (midi not 82, 83 etc.)
I hope this gets my point across..? Sorry if you addressed this already, it may well be that I misunderstood something.
Again, thanks a lot and best wishes,
I am trying to build a pressure sensitive multi-touch pad to use as a kind of keyboard.
For the hardware I build a copper/velostat matrix similar to this one here.
So far I managed to get the pressure value of every row-/column- crossing into PD and sort them. See the patch (screenshot below or link).
My problem is, that I just can't wrap my head around how to calculate a singular float out of the discreet input values of the matrix.
For example: I would like to play and adjust the pitch of a tone by moving my finger along the x-axis of the matrix. So what I need is a float, representing the x-axis location of the peak pressure of my finger.
(Y-axis and pressure values itself will also be needed later on - but i guess one thing after the other...)
I guess the discreet values need to somehow be quantized/merged into one but as I said, I lack the skills of imagining how this needs to be done - be it in PD or written code.
I would be eternally thankful if you could point me into the right direction here.
Thank you already and all the best!