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.

How to replace length with rest?

Featured Replies

I have a OMN. I want to replace one of the lengths with rest, randomly. Is there a function to do this?

 

Suppose I have a list of lengths either in the form '(1/4 1/4 1/4 1/4) or '(q q q q), is it correct to replace one of the elements randomly with '- to mean rest?

 

Regards,

Rangarajan

you could do it like this on "pure-LISP-level"

(setf lengths '(1/4 2/8 3/8 4/4))

(loop for i in lengths
  with repl = (random (length lengths))
  for cnt = 0 then (incf cnt)
  when (= cnt repl) collect (* i -1)  else collect i)

 

best wishes

andré

  • Author

Andre,

Nice code, Thank you.

 

I am looking for a function that works on a OMN, not just a list of lengths. 

 

Also, lengths can be represented in the format '(q q e e q s) instead of the corresponding numeric fractions. In such cases, the loop will not work (you can't multiply 'q by -1).

 

Regards,

Rangarajan

okay, i understand... i'm "not working" with '(q e q...), i'm always working with NUMBERS (with pitches too). it's easier to write/handle the values, easier to do my own specific code (and multipy, add... whatever) - only on "def-score" i'm changing the representation by generating OMN...

 

regards,

andré

  • Author

Thanks, Will check this function.

 

-Rangarajan

The OMN decode and encode functions (not documented):

(omn-encode '(s q e = = - -))
=> (1/16 1/4 1/8 1/8 1/8 -1/8 -1/8)

(omn-encode '(c4 = = =))
=> (c4 c4 c4 c4)

(omn-decode '(1/16 1/4 1/8 1/8 1/8 -1/8 -1/8))
=> (s q e = = - -)

 

What we need is a documentation of predicates etc... functions used in Opusmodus for developers and programmers.

I hope we can add this part to our system with version 2.0

  • Author

Thanks. Definitely useful.

 

-Rangarajan

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.