# replace pitch/rhy-val -> acciaccatura - in OMN

## Recommended Posts

simple question, perhaps someone could help me.

i like to replace some ordinary notes (example) with an "acciaccatura"?

example:

from...

'((e c6 q. ab5 3e g5 f5 e5 q f5 -))

to...

'((acc c6) q. ab5 3e g5 f5 e5 q f5 -) ; = replace e c6 with (acc c6)

i think, its not complicated but i didn't found the OMN-solution.

andré

##### Share on other sites

Is this what you are looking for:

```(substitute-motif '((e c6)) '(((acc c6))) '(e c6 q. ab5 3e g5 f5 e5 q f5 -))
=> ((acc c6) q. ab5 3e g5 f5 e5 q f5 -)```

The SUBSTITUTE-MOTIF function is not documented but it is in the system.

I will document the function in the next few days.

Here are few more examples:

```(substitute-motif '((a b c) (d b)) '((1 2 3) (8 9)) '(d b s a b c e j g))
=> (8 9 S 1 2 3 E J G)

(substitute-motif '((a b c) (d b)) '((1 2 3) (8 9)) '(d b s a b c e j g) :otherwise 'x)
=> (8 9 x 1 2 3 x x x)

(substitute-motif '(q) '(1 2 3) '(d b s a b c e j g a b c q q q))
=> (D B S A B C E J G A B C 1 2 3 1 2 3 1 2 3)```

substitute-motif (old new list &key (test #'equal) otherwise)

##### Share on other sites

yes, that's the way it will works... only one little "problem"...

the pitch will be always different... so the search-pattern should be something like '(e ?) -> to '((acc ?) -> pitch sould be overtaken to (acc ?), i only want to replace the length-val to an acc..

##### Share on other sites

i will write a little function and post it at the forum later.

##### Share on other sites

`'(e c6 acc q. ab5 3e g5 f5 e5 q f5 -)`

equal

`((acc e c6) q. ab5 3e g5 f5 e5 q f5 -)`

Maybe this fact helps :-)

##### Share on other sites

Other solution:

```(setf omn '(s. fs5 mf s p s. ff t f4 p fs5 s. mf t f -s))

(make-omn
:length (omn :length omn)
:pitch (omn :pitch omn)
:velocity (omn :velocity omn)
:articulation (substitute-motif '(3/32) '(acc) (omn :length omn) :otherwise '-))

=> (s. fs5 acc s p s. ff acc t f4 p fs5 s. mf acc t f -s)```

## Join the conversation

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

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

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

×
×
• #### Browser

• Video Gallery

• #### Activity

• Lessons

• Clubs
×
• Create New...