Jump to content

Adjust overall duration of a nested OMN sequence


Recommended Posts

Hi,

 

Is there perhaps a way to adjust the overall duration of a nested (barred) OMN sequence? In particular, is there a function to cut notes etc. at the beginning/end of a sequence, so that the result has a specified overall duration?

 

The first example just demonstrates what I would like to have.

(setf phrase '((1/2 c4 1/4 d4) (1/4 e4 1/2 c4)))

;; Edit phrase such that the result is exactly 5/4 long by preserving the nesting structure
(function-I-am-looking-for 5/4 phrase)
; => ((h c4 q d4) (q e4 c4)) 	; cut material at end
; => ((q c4 q d4) (q e4 h c4))  ; cut material at beginning

 

There already exist at least two functions that are close, but not quite what I need. 

;; Does not keep nesting structure
(length-span 5/4 phrase)
; => (h c4 q d4 e4 c4)
;; Adjusts individual sublists 
(length-adjust 5/4 phrase)
; => ((h c4 q d4 -h) (q e4 h c4 -))

Is there perhaps also a function that does what my example function-I-am-looking-for above does?

 

Thanks a lot!

 

Best,

Torsten

 

Link to post
Share on other sites

The function FIT-TO-SPAN reduces or expands the total length of the sequence to a given span. If the sequence length is lower than the span value, additional rest values will be added at the end of the sequence by default. With the extend keyword set too 's the rest values will be inserted at the beginning of the sequence.

(fit-to-span 5/4 phrase)
=> ((h c4 q d4) (q e4 c4))
Link to post
Share on other sites

I made small change to the function to preserve the bars if :extend 's (start).

The :extend 'e (end) works fine.

The fix will be part of the next release.

(setf phrase '((h c4 q d4) (q e4 h f4)))

(fit-to-span 5/4 phrase)
=> ((h c4 q d4) (q e4 f4))

(fit-to-span 5/4 phrase :extend 's)
=> ((q c4 d4) (q e4 h f4))

 

Link to post
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