Skip 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.

gen-repeat w. omn lists

Featured Replies

Hello, newbie question:

 

I'd like to take an omn list and simply repeat each measure 3 times. If I start with the following code:

(setf r-transitions1
      '((e (e 1)(-e 3))
        (-e (e 3)(-e 1))))

(setf marked
      (gen-markov-from-transitions r-transitions1 :size 120))

;;conform to timesignature in omn format
(setf r1 (length-span (gen-repeat 20 '8/8) marked :omn t))

;;define the time signatures
(setf timesigs (get-time-signature r1))

;;stream of pitches
(setf pitches '(c4 eb4 f4 g4 bb4 c5 eb5))

(setf pitches (chord-interval-add '(12) pitches))

;;by spanning r1 onto pitches, pitches will repeat as needed
(setf pitches (span r1 pitches))

(setf rh (make-omn 
           :length r1
           :pitch pitches))

and then try something like:

(setf rrh (gen-repeat 3 rh))

;or

(setf rrh (gen-repeat '(3) rh))

neither gives me what I'm looking for.

However, I notice that if I evaluate

 

(setf rrh (gen-repeat 3 (list (first rh))))

then I get the correct result for the first measure.

 

Therefore, doing something like this gets me what I was looking for:

 

(setf rrh (gen-divide 8 (flatten
      (mapcar #'(lambda (n) (gen-repeat 3 (list n))) rh))))

 

But surely there's a better/simpler way to repeat bars in omn format.

 

If anyone has insights, I'd be most appreciative.

 

thanks, Michael

 

 

 

 

  • Author

As I've played around I hit on this, which works if the repetition is always the same number (it would obviously be nice to do this with cycles of numbers, etc)...and of course, I continue to be sure there's some much easier way to do this that I don't know about yet...

;;this helper function returns a list of lists one level deep
(defun remove-nested (lst)
  (if (endp lst) 'nil
    (append (car lst)
            (remove-nested (cdr lst)))))

;;x is number of repetitions per bar
(defun repeat-omn (lst x)
  (remove-nested 
    (mapcar #'(lambda (n) 
                (gen-repeat x (list n)))
            lst)))

(setf rrh (repeat-omn rh 3))

 

  • Author

Thank you so much, that's very useful!!!

 

cheers, Michael

(setf r-transitions1 '((e (e 1) (-e 3)) (-e (e 3) (-e 1))))
(setf marked (gen-markov-from-transitions r-transitions1 :size 120))
(setf r1 (length-span (gen-repeat 20 1) marked :omn t))
(setf pitches '(c4 eb4 f4 g4 bb4 c5 eb5))
(setf chords (chord-interval-add '(12) pitches))
(setf rh (make-omn :length r1 :pitch chords))
(setf rrh (omn-to-time-signature (gen-repeat '(3) rh) '(4 4)))

or

(setf rrh (assemble-seq (mapcar #'(lambda (x) (gen-repeat 3 (list x))) rh)))

 

  • Author

excellent, thank you so much. I've really loved beginning to learn this environment, and I appreciate the assistance.

 

cheers

Create an account or sign in to comment


Copyright © 2014-2026 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

Account

Navigation

Search

Search

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.