Jump to content

Convert pitch to chord based on length


Recommended Posts

Hi, sorry I am missing something very basic. I would like to convert a particular pitch to a chord based on its duration. For example, if I have a omn-sequence, I would like to search for all half-notes and add to their current pitch some other pitches in order to form a chord.

 

I have looked at map functions, but I have not found a way of adding something to the already existing pitch instead of replacing it with something completely new.

 

Thanks!

Rodrigo

 

 

Link to comment
Share on other sites

Another possibility is to generate ONLY chords and "dechord" all events between some length values like this:

 

(setf omn (make-omn
           :pitch (chord-pitch-unique
                   (chordize-list 
                    (gen-divide 
                     4 
                     (rnd-sample 
                      256 
                     (make-scale 'd4 8 :alt '(2 1 3))
                     ))))
           :length (rnd-sample 24 '((h q q)(s s s s q e e)(3q = = q h)(h h)(q e e q)))
           ))


(setf omn2 (dictum '((:range (t e) :apply (dechord x))) omn))

S.

Link to comment
Share on other sites

  • 3 weeks later...
On 5/2/2022 at 8:30 PM, rcadiz said:

Dear Stephane, thanks! It worked perfectly!

 

Best,

Rodrigo

I have a strange problem related to this function. As I said before, your code works fine inside opusmodus, I can see the chords in the score and hear them with no problem at all. But when I export the score to xml all the added notes to form the chord are missing. 

 

For example, one of the chords I generated this way is the following. When I export this score to xml only the bb3 shows up. What could be wrong?

 

(setf mat2 '((h bb3d4bb4 mf arp-down -)))
(def-instrument-set test
                    :instruments
  (:group clefs
          :rec
          (:layout soprano-recorder-layout
                   :port nil
                   :channel 1
                   :sound 'gm
                   :program '(recorder)
                   :controllers nil
                   :pan (pan 30)
                   :volume 100)
          ))
(ps 'test
    :rec (list mat2)
    :tempo 40
    :time-signature '(4 4)
)


 

Link to comment
Share on other sites

1 minute ago, opmo said:

I don't see any problem here:

Screenshot 2022-05-18 at 16.35.42.png

 

 

Yes, but is that opusmodus? Or an external editor? I can see the same thing inside opusmodus, but I just checked that the exported xml file does not contains the extra notes (see the exported test.xml file). Thanks!

test.xml

Link to comment
Share on other sites

2 minutes ago, opmo said:

Your test.xml file is not the same as my.

 

sop-rec.xml 1.93 kB · 0 downloads

 

How to save musicxml file:

1. click on the musicxml panel (file)

2. In File menu select "Safe As..."

Ok, it works now. I was using menu File, Export Last Score to XML.... and if you do that, the notes are missing. 

 

Thanks!

Rodrigo

 

Link to comment
Share on other sites

Export Last Score to XML... is correct method.

Looks like there is a bug when arp-down is used.

The arp alone works fine.

 

arp-down etc... is customised attribute and is not a part of the musicxml standard.

 

Link to comment
Share on other sites

Just now, opmo said:

Export Last Score to XML... is correct method.

Looks like there is a bug when arp-down is used.

The arp alone works fine.

 

arp-down etc... is customised attribute and is not a part of the musicxml standard.

 

Ok, that explains what I was experiencing. Thanks! However, when I use arp-down with the "Save As..." method it works ok, but not with the "Export Last Score to XML...  " one.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

Terms of Use Privacy Policy