torstenanders Posted July 11, 2020 Share Posted July 11, 2020 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 Quote Link to comment Share on other sites More sharing options...
opmo Posted July 11, 2020 Share Posted July 11, 2020 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)) JulioHerrlein 1 Quote Link to comment Share on other sites More sharing options...
torstenanders Posted July 11, 2020 Author Share Posted July 11, 2020 Brilliant, this is exactly the missing function I described And such a lightening-fast response too! Thank you very much indeed! Torsten Quote Link to comment Share on other sites More sharing options...
opmo Posted July 11, 2020 Share Posted July 11, 2020 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)) lviklund 1 Quote Link to comment Share on other sites More sharing options...
torstenanders Posted July 11, 2020 Author Share Posted July 11, 2020 Thanks a lot (just noticed the different behaviour)! Quote Link to comment Share on other sites More sharing options...
opmo Posted July 12, 2020 Share Posted July 12, 2020 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.