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.

alternate-omns

Featured Replies

Below is a function that might be interesting for others as well. When I starting writing this function it was much more complicated, but it got more simple by and by 🙂 A formatted version as an RTF file of the documentation is attached, below is a plain text version.

 

For completeness I also attached the documentation of the function circle-repeat, used by the function below. Unfortunately, the file names are destroyed by the software of this forum, sorry.

 

Best,

Torsten

 

alternate-omns ids omns

 

Arguments and Values

 

ids       a list of integers, indicating the position of OMN expressions in omns.
omns     a list of OMN expressions (can also be plain lengths, or pitches etc.) between which to switch.

 

Description

This function alternates between sublists of multiple OMN expressions.

This function can be useful, e.g., to switch between different musical characteristics. Each characteristic (e.g., gesture) and its development can be specified by a combination of parameters (rhythm, pitches, dynamics, and playing techniques) in a sequence of OMN expressions. The output of the function switches between these characteristics as specified in the first argument to the function. The following example demonstrates this.
 

(alternate-omns
 (gen-eval 10 '(rnd-pick '(0 1)))
 (list
  (make-omn
   :length (length-rest-series (rnd-sample 7 '(7 8 9))
            (length-divide 3 2
                           (rnd-sample 7 '((q q q) (h e e) (h.) (h q)))))
   :pitch '(d4 e4 f4 g4)
   :velocity '(pp))
  (make-omn
   :length '(s s s s)
   :pitch (gen-rotate :right '(c5 d5 f5 a5 g5 e5) :type :seq)
   :velocity '(ff)
   :span :pitch)))


Alternatively, one can switch between plain sequences of OMN lengths, or pitches etc.

(alternate-omns
  '(0 0 1 0 1 0 1 1 0 0 1 1 1)
  (list
    (gen-rotate :left '(-1/20 1/20 1/20 1/20 1/20) :type :seq)
   '((q e e))))

 

Examples

Remember that resulting OMN expressions can be “re-barred”.

(omn-to-time-signature
 (alternate-omns
  '(0 0 1 0 1 0 1 1 0 0 1 1 1)
  (list
   (make-omn
    :length (gen-rotate :left '(-1/20 1/20 1/20 1/20 1/20) :type :seq)
    :pitch '(d4 e4 f4 g4)
    :velocity '(ff))
   (make-omn
    :length '(q e e)
    :pitch (gen-rotate :left '(c5 e5 f5) :type :seq)
    :velocity '(pp pp)
    :attribute '(ten stacc stacc)
    :span :pitch)))
 '(4 4))

 

Implementation

(defun alternate-omns (ids omns)
  "This function alternates between sublists of multiple omn expressions. It can be useful, e.g., to switch between different musical characteristics.

Args:
ids: a list of integers, indicating the position of OMN expressions in omns.
omns: a list of OMN expressions (can also be plain lengths, or pitches etc.) between which to switch."
  (let ((omn-no (length omns)))
    (assert (every #'(lambda (x) (and (integerp x) (< x omn-no))) ids)
            (ids) "alternate-omns: must be a list of integers between 0 and (1- (length omns)): ~A" ids)
    (let ((hash (make-hash-table)))
      (loop 
        for i from 0 to (1- omn-no)
        for my-omn in omns
        ;; span (circular repeat if necessary) omn sublists to number of occurences in specs
        ;; and fill hash table with that as side effect
        do (setf (gethash i hash) (circle-repeat my-omn (count i ids))))    
      (alternate-omns-aux ids hash))))

(defun alternate-omns-aux (ids hash)
  (loop 
    for id in ids
    collect (pop (gethash id hash))))

(defun circle-repeat (pattern n)
  "Circle through elements in pattern (a list) until n elements are collected.
  NOTE: only supports flat list so far."  
  (let ((l (length pattern)))
    (loop 
      for i from 0 to (- n 1)
      collect (nth (mod i l) 
                   pattern))))

 

TXT.rtf

TXT.rtf

  • 2 weeks later...

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.