Jump to content
View in the app

A better way to browse. Learn more.

Opusmodus

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Hello 

 

i try to write a function who could directly apply to an omn list of that form :

 

(set melo1 '(s bb5 f c6 mf bb5 f q mf s c6) (s c6 g5 g5 mp q c5 s bb5 f) (h. g5 f e. mp bb4 ff bb5 mf g5 f) )

 

How may i proceed to access independently pitch , length , velocity or articulation without having to disassemble it . Is there an existing helping function already made on which i could assign a new custom written function .

 

Thanks

 

Patrick  

 

 

Yes

Search for the function OMN.

 

(setf notation
	   '(s g4 pp == cs5 c4 -- fs5 g4 mf ==== gs5 mp == a3 f))

(omn :length notation)
=> (1/16 1/8 1/16 1/16 -1/8 1/16 1/16 1/4 1/16 1/8 1/16)

 

  • Author

Thank you but what  i am looking for is to create a new function X which could apply his functionality directly in a omn function like 

 

( rnd-order '(h. g3 mp e. bb4 mf q. c5 ff e. bb5 mf)) automatically render all omn component , but if i write a function x it will not automatically understand in the list what is pitch or length etc...

 

I would like to find a way to have direct access without having to extract first length or pitch  and to recombine it in omn later 

 

Thanks

 

Patrick

 

 

 

you could work with omn-replace (from OM-library)? ...or some other code... have a look... greetings andré

;;; THREE SIMILAR FUNCTIONS FROM MY USER LIBRARY

;;; recognizes the parameter who has to be replaced
(defun omn-component-replace (omn-sequence replace-component)
  (make-omn :length (if (lengthp (car replace-component))
                     (append replace-component)
                     (omn :length omn-sequence))
            :pitch (if (or (pitchp (car replace-component)) (chordp (car replace-component)))
                     (append replace-component)
                     (omn :pitch omn-sequence))
            :velocity (if (velocityp (car replace-component))
                        (append replace-component)
                        (omn :velocity omn-sequence))
            :articulation (if (articulationp (car replace-component))
                            (append replace-component)
                            (omn :articulation omn-sequence))))

;;; the same with multiple inputs at once
(defun omn-component-replace2 (omn-sequence replace-component)
  (car (last (loop for i in replace-component
               collect (setf omn-sequence
                             (make-omn :length (if (lengthp (car i))
                                                 (append i)
                                                 (omn :length omn-sequence))
                                       :pitch (if (pitchp (car i))
                                                (append i)
                                                (omn :pitch omn-sequence))
                                       :velocity (if (velocityp (car i))
                                                   (append i)
                                                   (omn :velocity omn-sequence))
                                       :articulation (if (articulationp (car i))
                                                       (append i)
                                                       (omn :articulation omn-sequence))))))))


;;; replaces a single element
(defun omn-single-element-replace (omn-list old new)
  (let ((new-list (loop for i in (cond ((lengthp old)
                                        (omn :length (flatten omn-list)))
                                       ((pitchp old)
                                        (omn :pitch (flatten omn-list)))
                                       ((velocityp old)
                                        (omn :velocity (flatten omn-list)))
                                       ((articulationp old)
                                        (omn :articulation (flatten omn-list))))
                                        
                    when (equal i old) collect new
                    else collect i)))
    (omn-component-replace (flatten omn-list) new-list)))

;;;;;;;;;;;;;;;;;;

;;; EXAMPLES


(setf seq1 '(s gs3 ppp tasto q.t cs4 pppp tasto s f4 ppp tasto))

(omn-component-replace seq1 '(5/16 7/16 3/32))
=> (qs gs3 ppp tasto q.. cs4 pppp tasto s. f4 ppp tasto)




(omn-component-replace2 '(S C4 PPP TASTO Q.T D4 PPPP TASTO S E4 PPP TASTO) '((p) (ponte) (e2 b2 d2)))
=> (S E2 P PONTE Q.T B2 PONTE S D2 PONTE)



(omn-single-element-replace '(t gs4 pppp tasto a4 tasto bb4 tasto -t) 'bb4 'c4)
=> (t gs4 pppp tasto a4 tasto c4 tasto -)

(omn-single-element-replace '(t gs4 pppp tasto a4 tasto bb4 tasto -t) 'pppp 'ff)
=> (t gs4 ff tasto a4 tasto bb4 tasto -)

 

i'm interested to see YOUR code :-)

greetings

Below is a link another way to write functions that process OMN more easily by defining only a function processing the parameter you are interested in, and then turning that quasi-automatically into a function that supports arbitrary OMN expressions (including nested expressions, preserving the nesting, and rests).  

 

Best,

Torsten

  • Author

Thank you Torsten 

 

that's exactly what i was looking for , as i compose using Opusmodus first to generate several ideas which once in omn form  i like to process again or edit  afterwards with some home made functions and at the end manual edits . I will try it and come back to you if i have some questions .

 

Patrick

 

 

 

 

  • Author

Hi torsten 

 

when i evaluate 

 

(defun edit-omn (type notation fun &key (flat T)))

 

 

i gat this error message maybe i missed something 

 

;Compiler warnings for "/Users/patrickmimran/Opusmodus/AllPat_Comp/Patrick_2/OMN_Translator.opmo" :
;   In edit-omn: Unused lexical variable flat
;Compiler warnings for "/Users/patrickmimran/Opusmodus/AllPat_Comp/Patrick_2/OMN_Translator.opmo" :
;   In edit-omn: Unused lexical variable fun
;Compiler warnings for "/Users/patrickmimran/Opusmodus/AllPat_Comp/Patrick_2/OMN_Translator.opmo" :
;   In edit-omn: Unused lexical variable notation
;Compiler warnings for "/Users/patrickmimran/Opusmodus/AllPat_Comp/Patrick_2/OMN_Translator.opmo" :
;   In edit-omn: Unused lexical variable type

 

Looks like you tried to evaluate only the first line of a function definition without any body. The compiler therefore helpfully tells you that you are not using the arguments of this function.

 

What are you actually trying to do, evaluate the function edit-omn that I provided in my post linked above? Have you tried evaluating the content of the code whole box with both function definitions, remove-property and edit-omn.

 

I should perhaps add that how to use the function edit-omn is best understood by Lisp programmers who already know what higher order functions are, which is a somewhat advanced, but very powerful programming concept. In my original post I provided a link to a textbook chapter on functions. The idea will also be discussed in many other Common Lisp text books.

 

Best,

Torsten

  • Author

I did something which seems easier for me 

 

(defun my-omn (lis &optional (nbr 0) ) 

(nth nbr (disassemble-omn lis )))

 

from there i mapcar any functions   

 

Ex:  

 

(setf lenomn (my-omn pianomain  ))   ;pianomain is a omn list or lists 

 

(setf newlen (mapcar 'anyfunction lenomn ))

 

then   :   (omn-replace :pitch newlen pianomain )

 

Now if i would like to embed everything in one function with the options ? ( nbr 0 for length 3 for pitch 5 for velocity and 7 for articulation ) plus the omn options for :pitch :length :velocity and :art     with anyfuntion as an additional  argument

 

 That's what i would like to know how to do , now that i have the useful functions set , then i could concentrate everything in one function 

 

Thanks For any help   Patrick  

Create an account or sign in to comment


Copyright © 2014-2025 Opusmodus™ Ltd. All rights reserved.
Product features, specifications, system requirements and availability are subject to change without notice.
Opusmodus, the Opusmodus logo, and other Opusmodus trademarks are either registered trademarks or trademarks of Opusmodus Ltd.
All other trademarks contained herein are the property of their respective owners.

Powered by Invision Community

Important Information

Terms of Use Privacy Policy

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.