Hi! I come with a problem that unfortunately needs some explaining
I’ve been exploring contour-segment theory, a field that analyzes melodic contours by focusing on the relative highness or lowness of pitches over time, rather than their exact intervals or pitch classes.
I managed to make a patch that generates these “c-segs” and its transformations (i realized this specific thing was already possible with BPF tools but it was fun to patch).
I also managed to patch a COM-matrix, that is a comparison matrix that checks each point in a contour against all others and outputs:
- 1 if the point is higher
- -1 if it’s lower,
- 0 if they’re equal.
The thing i’m having problems is, I want to program a patch that would generate a random but valid melody that corresponds to a given COM-matrix
The first thing that came to mind to achieve this was using constraint programming. I tried to make something with OMCS, writing a constraint that computes the COM-matrix of a partial solution and checks it against a given target matrix. This did not work (it always returned nil) as i later learned that OMCS applies the constraint to each candidate as it builds the solution up, and the com-matrix being a global property, the constraint could never be met. So insisting on this route would mean I’d need to use the entire set of permutations of X pitch values as the search domain, and that would be absurd
So, is this possible to achieve with some other strategy? Or is it not feasible?
Here’s the patch:
CSEG.omp (73.5 KB)
Thanks for your time, as always!