Administrateur

  • Profile picture of Karim
  • Profile picture of Jean

OpenMusic

Groupe Public active 2 days et 12 hours ago

User group for OpenMusic and computer-aided composition. Visit the Forum for discussions.

Hobby gematria – a question on mapping

Auteur 5 Utilisateurs souscrits |
Profile photo of Dagfinn Koch
DagfinnKoch

Hello, I’m trying to find a straightforward solution to the following problem: Mapping letters to numbers.

For example this short part of a poem by Enzensberger:

«Der Künstler entsagt.»
Das war früher.
«Der unglückliche Künstler.»
Ein Anachronismus.
Er hat sich gestritten,
hat uns mißtraut.

The first sentence would be: 4 5 18 11 21 14 19 20 12 5 18 5 14 20 19 1 7 20
In addition grouped as “words” 4 5 18 – 11 21 14 19 20 12 5 18 – 5 14 20 19 1 7 20

Is the solution to use “if” in combination with a kind of table? And/Or can BPFs be useful.

I think this actually is basic LISP, but I’m a bit lost, and a bit lazy. :-)

But hope you can help me out.

Best, Dagfinn

The poem by Enzensberger is really relevant for our group. :-)

Das unglückliche Ohr

«Der Künstler entsagt.»
Das war früher.
«Der unglückliche Künstler.»
Ein Anachronismus.
Er hat sich gestritten,
hat uns mißtraut.
Er ist unbrauchbar, stört.
Nicht als wäre er schwerhörig,
wie Beethoven,
taub von Donner gewisser Sonaten.
Ganz im Gegenteil.
Er hört zu gut.
Er hört Stimmen.
Sie wimmeln in seinem Kopf,
bringen Hiobsbotschaften.
Die Wahrheit, eine Montage,
Jahrsehntlang überall Kork,
im Regieraum nur ein Assistent
an zweihundert Reglern.

Hinder dem Schalldichten Glas
offene Münder. Dezibel, Filter.
Es ging um Bruchteile von Sekunden.
Ein splitterndes Geräusch,
dann Leerband, weißes Rauschen.
Das war früher.
Heute brütet er von sich hin,
im leeren Studio,
ein unglückliches Ohr,
während die Kunst sich austobt
auf Auktionen und Festivals.
Die Vergangenheit,
ein unmerkliches Knacken
im Kopfhörer,
ganz dicht am Trommelfell.

Attachments:
  1. Skjermbilde-2018-05-23-kl.-11.21.38

    Skjermbilde-2018-05-23-kl.-11.21.38.png

  2. Skjermbilde-2018-05-23-kl.-11.21.38

    Skjermbilde-2018-05-23-kl.-11.21.38.png

Mai 23, 2018 à 10:25 #26584
Profile photo of anders
anders

Hi Dagfinn! Indeed, you are incredibly lazy! Have a look at “character construction and selection” in the CL refs: https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node138.html.

Check this snippet, you’ll immediately see what’s missing to get the output you want. No?

(mapcar #'(lambda (c) (char-code c)) (coerce "a bold composer: dagfinn" 'list))

Mai 23, 2018 à 11:36 #26587
Profile photo of Dagfinn Koch
DagfinnKoch

Thanks a lot, Anders! I will now try to find out what you actually say. I’ve found some of the elements… Now I have to try it out. I do understand the lambda concept (I hope)

And thanks for the Patterns library you gave me a while back!

(As a Norwegian I’m used to getting everything served on a platinum plate, you know. LOL)

Attachments:
  1. Skjermbilde-2018-05-23-kl.-13.14.47

    Skjermbilde-2018-05-23-kl.-13.14.47.png

  2. Skjermbilde-2018-05-23-kl.-13.14.47

    Skjermbilde-2018-05-23-kl.-13.14.47.png

Mai 23, 2018 à 12:21 #26588
Profile photo of Dagfinn Koch
DagfinnKoch

I think I understand the idea, but to execute it is the matter now. I’m I on the right track when checking character conversion?

I found a link to a book I actually have a hard copy of.

http://www.lispmachine.net/books/common_lisp_the_language.pdf

Mai 23, 2018 à 12:42 #26591
Profile photo of anders
anders

Conversions, yes, there are two of them going on here:

  1. from a string “abc” to a list of characters ‘(#\a #\b #\c)
  2. from a list of characters ‘(#\a #\b #\c) to a list of numbers ‘(97 98 99)

The first one can be done by ‘coerce’-ing your string to a list, ie. (coerce “abc” ‘list).
The second by looping through your list of characters and collecting each characters ‘char-code, either using loop or mapcar.

The char-code of e.g. #\a is typically 97, #\b 98 and so on, so you’ll have to subtract something from your output to start from 0 or 1.

If you want a patch please tell me.

Mai 23, 2018 à 12:53 #26592
Profile photo of Karim
Karim

Dear Dagfinn,

A while ago i have done a small library that you can find here :
https://forge.ircam.fr/p/omlibraries/downloads/172/

You can use the string->ascii method and ascii->string in order to rtanslate characters (strings) into digit and vice versa.

Have Fun

Best
K

Attachments:
  1. Screenshot_2018-05-23_15-16-59

    Screenshot_2018-05-23_15-16-59.png

  2. Screenshot_2018-05-23_15-16-59

    Screenshot_2018-05-23_15-16-59.png

Mai 23, 2018 à 14:17 #26593
Profile photo of Dagfinn Koch
DagfinnKoch

Hello Anders, thanks a lot! Now I do understand the concept, it was some basic knowledge in the nature of ascii that wasn’t present… If you can provide a patch that would be great!

Best, Dagfinn

Mai 23, 2018 à 16:15 #26598
Profile photo of Dagfinn Koch
DagfinnKoch

Dear Karim, thanks a lot for the library. I test it now. Very cool! And it is not a way to undermine Anders’ pedagogic approach which I also appreciate. *smiling*

I’m working on a large piece for viola, brass band (sic) and live electronics (partly Antescofo with necessary back up.)

Three great poems were written and selected by Enzensberger. He wrote the text to Henzes’ second violin concerto, so I do have that in mind. And checking which patterns I can find in the poems.

Best, Dagfinn

Mai 23, 2018 à 16:20 #26599
Profile photo of anders
anders

Here’s a patch.

Attachments:
  1. Utvalg_001

    Utvalg_001.png

Mai 23, 2018 à 21:19 #26600
Profile photo of Dagfinn Koch
DagfinnKoch

Hello Anders, thanks a lot! I’ve tested the patch now. This is good.

I’m afraid I wouldn’t manage to find the solution myself. So a Common LISP course at the University for me, as you suggested to learn the basics is a must.

(Perhaps time to grab some beer in Oslo?)

Best, Dagfinn

Mai 24, 2018 à 06:12 #26603
Profile photo of michalszostalo
michalszostalo

Hi, dagfinn, there is also a solution that doesn’t require any knowledge of lisp at all: In the OMTristan library, there is a patch called ll-replace, that should do exactly what you need. I think OMRuben has something equivalent, too?

Mai 28, 2018 à 00:26 #26614
Profile photo of Dagfinn Koch
DagfinnKoch

Hi Michael, thanks a lot! I checked OMRuben List Tools, but couldn’t find something equivalent to OMTristan. I tried to activate OMTristan 3.3 running Open Music 6.13 (2017-12-19) but get the attached message when applying the library. (Actually, the OMIannis library doesn’t load either.) See screenshots.

Attachments:
  1. Skjermbilde-2018-05-28-kl.-08.55.42

    Skjermbilde-2018-05-28-kl.-08.55.42.png

  2. Skjermbilde-2018-05-28-kl.-08.55.42

    Skjermbilde-2018-05-28-kl.-08.55.42.png

  3. Skjermbilde-2018-05-28-kl.-08.53.55

    Skjermbilde-2018-05-28-kl.-08.53.55.png

  4. Skjermbilde-2018-05-28-kl.-08.53.55

    Skjermbilde-2018-05-28-kl.-08.53.55.png

Mai 28, 2018 à 07:59 #26616
Profile photo of michalszostalo
michalszostalo

Yes, you have to download OMTristan 3.4, it’s I’ve never heard of OMIannis, sounds pretty interesting.

Mai 28, 2018 à 14:14 #26621
Profile photo of michalszostalo
michalszostalo

And you’re right, there doesn’t seem to be an exactly equivalent function in OMRuben, but then again, you’ve IRLRuben working for you, so there’s that.

Mai 28, 2018 à 14:21 #26622
Profile photo of michalszostalo
michalszostalo

Mai 28, 2018 à 14:25 #26623
Profile photo of Dagfinn Koch
DagfinnKoch

Hi Michael, thanks a lot for your answer! I will download OMTristan 3.4. Best, Dagfinn

Mai 31, 2018 à 09:20 #26635
Profile photo of michalszostalo
michalszostalo

Hi Dagfinn, no problem. I actually tried out ll-replace (I hadn’t found a reason to use it before) and discovered that it only accepts a single argument, so you would have to chain 26 of them together (or more, if you’re counting umlauts :D). So Anders’ (sorry I mistook Anders for Ruben in a previous post – must have been an internal string-to-chars error) and Karim’s methods are probably more efficient.

Mai 31, 2018 à 15:42 #26641
Profile photo of nagymusic
nagymusic

Karim,
I had a chance to try the OMlempeltext library, using the string=>ascii function (OM 6.13 on Linux). I noticed that neither my patch (see attached) or the tutorial patch reacts well when the text is enclosed in the quotation marks. I also tried removing the quotes, but the Listener still produced this error message:

Error while evaluating the box STRING->ASCII: “text” is not a designator for an object of type character.

The only way that I was able to get it work was to space the given text wide and without the quotes: t e x t
I welcome your thoughts on this.

Also, would it be possible to know what ascii table is this conversion derived from? I briefly consulted this table: http://www.asciitable.com, but couldn’t figure out the details, including whether the characters other than letters are also taken into consideration.

Lastly, might it be possible to group the text in a textfile into sub-lists (subgroups), similar to groups of letters that form words in a sentence?

Thank you!
Zvony

Attachments:
  1. ascii.omp
  2. ascii.omp
Juin 1, 2018 à 21:23 #26658
Profile photo of Karim
Karim

Dear Zvony,

omlempeltext is an old library. It is still operational, but… the tutorial (my bad) is not updated alas !!!
This is due that the textfile object, which in my opinion (and not only mine…) is not that great !.

In order to use text in this object and with omlempeltext and string->ascii :

1) put it between double quotes as it is
2) VERY IMPORTANT, use the textfile fourth input in mode ‘value. (this is the great change from om 5.x and 6.x)
So in order to use the tutorial, (sorry for that), create new textfile objects, (yes if you try putting the ‘value option with these old textfile objects this won’t work), and copy paste your text and embed it between double quotes without forgetting the ‘value mode.

Now it is important not to put spaces. A space result in a 32 ascii decimal code. It will determine a space between words.
For a complete decimal code conversion table see here :

https://www.asciitable.com/

Will post further a patch on how to group words, remove punctuation etc…

Best
K

Juin 2, 2018 à 00:28 #26664
Profile photo of nagymusic
nagymusic

Karim,
Many thanks for your quick reply and clarification. It’s all working much better now! Look forward to experimenting and learning more later.

Best,
Zvony

Juin 3, 2018 à 01:30 #26680

Vous devez être connecté pour répondre à ce sujet.

Log in now