< Back to IRCAM Forum

2D curves to melody converter - my 1st OM patch

Hi there!
I was always curious about OM but only last week I was able to effectively ‘break the initial barrier’ and go for it, motivated by an idea. I was surprised on how easy OM is, in terms, and how many good tools I had at disposal to execute my idea.

This is a translator that takes lines from a BFC-LIB (In the example, I added Munch’s painting ‘The Scream’ as bg, because it all started with a composition about this painting).
It then translates directions and distances to notes and durations, translating in some way a drawing contour to a melody. I think the result is, at least, fun.

I am kinda starting to understand some of the Lisp logic, but I’m far from being fluent. As a former ‘programming kid’ I still think about Loops, for-to, if-then, but I start to understand it’s better to find a way to process a list than to make a loop.

There are some things I couldn’t figure out yet. I am sharing this video in hope that some experienced members could give me some hints.

And thank you Carlos Agon, Gérard Assayag and Jean Bresson for this awesome tool. I had no idea how powerful it was before I really tried.

Emilio Le Roux

“this is a translator…” ???
??
Video
??

If you need hints, maybe it’s better that u send us concrete problematics.
[ I don’t see any attachments here ?]

And to start with a hint …
“it’s better to find a way to process a list than to make a loop…”
a loop macro , (mapcar or maplist, etc…), IS a way to “process” a list. I think here, you are mixing up fundamentals…
One advise , if you want to go further up the road, try to learn some basic Lisp stuff. It’s easy, fun and very useful for these matters.
Start per se, in reading : https://www.cs.cmu.edu/~dst/LispBook/book.pdf
it’s note the best but i am sure you’ll find a lot Internet resources about this language .

Have fun
Best
K

I’m really sorry, as I am new to the forum and I’m just trying to figure out why the link was deleted. Maybe if I post it without the ‘link’ tag…

Ok! Now I can start with the specific problems :slight_smile:

Thanks again Karim for your quick answer and the book. I’m already learning about lisp, slowly but steady.
Please be tolerant with my ignorance about mixing concepts. I was referring to my old programming thinking, in which you code a loop, instead of using mapcar and maplist and other functions, visually.

For instance, it took me a while to solve how to substract each number of a list from the previous number. I would know how to do that in C, in basic or in pascal, but not in OM. Suddendly it occured to me that it would be easier just to rotate the list and substract it from itself using OM-. I know it IS a loop, but not the kind of loop I am used to. It will take some time to get used to the visual environment.

Now, I don’t know how to manipulate rational numbers. Say, what if I want a list of rational numbers (112314/3240 2389/103 68857/423) to become numbers with a common denominator that I can then round? i.e. (??? 112314/3240 2389/103 68857/423) ==> (1109/32 742/32 5209/32)

My second question is about rotation degrees. The Cartesian to Polar conversor gave me a list of angles from -180 to 180.

But what if, instead of this, I want it to go as low as -90 and as high as 270. In other words, I want that any angle below -90 in the list is converted to its positive equivalent (-91 should become 269 for instance).

This list:
(-90 90 135 179 -135)

should become
(-90 90 135 179 225)

No problem,

Here’s a tip : go through the om tutorials first (most particulary the omloop part). You’ll have no trouble figuring out lisp since you know C basic and pascal. Lisp is much easier…

Best
K

Here is for your 2nd question (c.f attachment)

Concerning the first problem, i don’t know exactly since 103 is a prime num , how can you end up to have a common denom 32 ?

angles.png

…sorry, for the patch you should evaluate the second output…
om// serves as a modulo funciton.

Please don’t hesitate to post questions if needed.

Best
K

That was brilliant. I tested it right away. Although it only puts every negative value to its positive equivalent, so the -90 on the list also turns into 270. Anyway it made me read a lot about euclidean division.

For the first question, my purpose is to find the closest value possible with a specific denominator.

In the example, 2389/103 would be equivalent to 742.21359/32 thus rounded to 742/32. The ratio is approximately the same. I think I could come around something with the floor function. But I wonder if there’s a simpler way in Lisp.

I am already reading the book you posted. It seems very good.

Got it… unless there’s an even simpler way.

Clipboard01.png

Dear Karim, thank you for your help. I’ve solved the other question just by translating the graphic to a chord-seq, then optionally using the OMQuantify function with customizable parameters to produce a human-playable score. Works like a charm now.