Mapping a melody to a harmonic skin?

Dear colleagues, I hope you can help me with this matter: how to write an algorithm that is showing which positions in the harmonic skin the melody have. I do think it can be solved by using a kind of mapping, but I have not found a way to solve it.

I would like free to write melodies within the harmonic skin, that I can apply on other harmonic skins, and of course, make harmonies and block chords.

Best, Dagfinn

01-Full-score-Mapping-a-melody-to-a-harmonic-skin-.pdf (32.7 KB)

Dear Dagfinn,
I think you can simply use posn-match. First input is the reservoir of pitches as midicent, second is index order. You can replace the first input to apply the melody to a different scale. If it is short, you may get some ‘nil’, which you can use ‘remove’ ‘nil’ to get rid of.
For chords, you would need an omloop: add or subtract from the position (like Messiaens harmony) and do the posn-match within the loop.

Dear Ruben, thanks a lot. I have added a Patch and Screen Shot that I hope explains much better, what I want to achieve:

I would like to have the possibility to represent a melody in MIDI-cents within a harmonic skin, and then through «cybernetic magic», get a list of which positions they have within the harmonic skin.

The main reason for this is not of laziness, but being sure that pointers are correct. Also practical when importing MIDI- or Music-XML Files.

I’m still struggling to grasp the inner life of the OM Loop. But I’m on it. It would be great to work with chords also because then I can work with transformations within the harmonic skin. The Profile library doesn’t accept harmonic skins as far as I can see (and that’s a lot…)

Best, Dagfinn

Oratio-for-baroque-viola.omp (153 KB)

Hi Dagfinn. #'position will do what you want here, you give it an item (ie. a note value) and ask for its position in a sequence (your skin). Check screen-shot.

If you need your lambda-patch to handle lists of notes (chords) within the melody, you can check whether the current note is a list, and in that case do a recursive call on the #'skin-match function.

In general, the whole set of sequence functions in CL are extremely powerful: - if for instance you’ve got microtonal variations you want to match to a ‘closest class’ in your skin, you can use #'position-if with a suitable predicate.

Hello Anders, thanks a lot. I tested your algorithm now, and it is perfect! I would have never found that solution. And also thanks for the link, I do really lack a lot of basic knowledge on CL. Best, Dagfinn

Hi Anders,
unfortunately the screenshot isn’t there anymore. Would you be so kind to upload it again? Many thanks again.
Francesco Vitale

Hi Francesco.

Sorry, i don’t have a backup of the demo sent to the forum. Perhaps Dagfinn has a copy, or someone else on the forum can help.


Hello, I’m writing a short thesis on the subject that I shortly will share with the forum. I wanted to test the patches in “real life” first.

Best, Dagfinn