July 11, 20205 yr 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
July 11, 20205 yr 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))
July 11, 20205 yr Author Brilliant, this is exactly the missing function I described 🙂 And such a lightening-fast response too! Thank you very much indeed! Torsten
July 11, 20205 yr 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))
Create an account or sign in to comment