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

Applying length-augmentation (or any function) to a list by name

Featured Replies

Hello,

 

This seems like a simple issue but I think there's some underlying lisp concept I'm missing. I'm trying to apply length-augmentation to a list rather than explicit lengths and getting an error.

 

So to begin with I import a plainchant MIDI file:

(setf source "/Users/tomtolleson/OpusModus/Scores/The Bifurcated Fruit of a Mirror/MIDI/dominabi.mid")

 

I define the lengths from the source as "sourcelengths"

(setf sourcelengths (midi-to-omn source :type :length))

 

This all works properly.

 

Now, if I apply length-augmentation to a series of lengths explicitly (from the documentation):

(length-augmentation 2 '(1/8 1/8 1/8 1/8 -1/8 1/8 1/8 -1/8))

 

That works properly.

 

However if I try to apply length-augmentation to 

(length-augmentation 2 '(sourcelengths))

 

or

 

(length-augmentation 2 (sourcelengths))

 

I receive an error. What is the correct format for applying length-augmentation (or any other function) to a list by name rather than by explication?

Thanks!

 

THT

  • Author

Thank you for the response. That's still throwing an error.

 

Even when I'm using it as 

 

(setf lengths (length-augmentation 2 sourcelengths))

 

or

 

(setf lengths (length-augmentation 2 (sourcelengths)))

 

or

 

(setf lengths (length-augmentation 2 '(sourcelengths)))

 

Ah, just realized the source of the problem is my original variable "sourcelengths"

 

When that's evaluated it's

 

(((1/16 -3/16 1/16 -3/16 1/4 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/4 1/16 -3/16) (-1/4 1/4 1/16 -3/16 1/4) (3/16 -3/16 1/16 -3/16 1/4 1/8) (1/8 1/16 -3/16 1/16 -3/16 1/4 1/8) (1/8 1/4 1/4 1/4 1/8) (1/8 1/2 1/4 1/8) (1/8 1/4 1/4 1/16 -1/4 -1/16) (-1/8 1/16 -3/16 1/16 -3/16 1/4 1/8) (1/8 1/16 -3/16 7/16 -3/16) (-1/8 1/4 1/4 1/4 1/8) (1/8 1/4 1/16 -3/16 1/4 1/16 -1/16) (-1/8 1/16 -3/16 1/4 1/4 1/16 -1/16) (-1/8 1/4 1/4 1/4 1/8) (1/8 7/16 -3/16 1/4) (1/16 -3/16 1/16 -3/16 1/16 -3/16 1/16 -3/16) (1/16 -3/16 7/16 -1/16 1/4) (1/4 1/4 1/4 1/4) (1/16 -3/16 1/16 -3/16 1/16 -3/16 1/4) (1/16 -3/16 1/2 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/4 1/4) (1/4 1/2 1/4) (3/16 -1/2 -1/16 1/16 -3/16) (1/16 -3/16 1/4 1/16 -3/16 1/4) (1/16 -3/16 1/16 -3/16 1/4 1/16 -3/16) (1/4 1/2 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/4 1/4) (1/2 1/4 1/4) (1/4 1/4 1/2) (1/4 1/4 1/4 1/4) (1/2 1/4 1/4) (1/4 1/2 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/4 1/4) (1/2 1/4 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/2) (7/16 -3/16 1/16 -3/16 1/8) (1/8 1/16 -3/16 1/4 1/4 1/16 -1/16) (-1/8 1/4 1/16 -3/16 3/8) (1/8 1/16 -3/16 1/4 1/4 1/8) (1/8 1/2 1/4 1/8) (1/8 1/4 1/4 1/4 1/8) (3/8 1/4 1/4 1/8) (1/8 1/2 3/8) (1/16 -1/4 -1/16 1/4 1/4 1/8) (1/8 1/4 1/16 -3/16 3/8) (1/16 -1/16 1/4 1/4 1/4 1/8) (1/8 1/2 3/8) (1/8 1/4 1/4 1/4 1/16 -1/16) (-1/8 1/4 1/4 1/4 1/8) (5/16 -3/16 1/4 1/4) (1/4 1/16 -3/16 1/16 -3/16 1/4) (1/4 1/4 1/2) (7/16 -1/16 1/4 1/4) (1/4 1/4 1/4 1/4) (1/16 -3/16 1/2 1/4) (1/4 1/4 1/4 1/4) (1/4 1/2 1/4) (1/4 1/4 1/2) (1/4 1/4 1/2) (1/4 1/4 1/4 1/4) (1/4 1/4 1/4 1/4) (1/4 1/2 1/4) (3/16 -1/2 -1/16 1/16 -3/16) (1/16 -3/16 1/4 1/4 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/16 -7/16) (1/4 1/16 -3/16 7/16 -1/16) (-1/8 1/16 -3/16 1/4 1/4 1/16 -1/16) (-1/8 1/16 -3/16 1/4 1/4 1/8) (1/8 1/4 1/4 1/4 1/8) (3/8 1/4 1/4 1/8) (1/8 1/4 1/16 -7/16 1/16 -1/16) (-1/8 1/16 -3/16 1/4 1/4 1/16 -1/16) (-1/8 7/16 -1/4 -1/16 1/8) (1/8 1/4 1/4 1/4 1/8) (1/8 1/16 -3/16 1/4 1/16 -3/16 1/16 -1/16) (-1/8 1/4 1/4 1/16 -3/16 1/8) (1/8 1/4 1/4 1/4 1/8) (5/16 -3/16 1/4 1/16 -3/16) (1/16 -3/16 1/16 -3/16 1/16 -3/16 1/16 -3/16) (7/16 -1/16 1/4 1/4) (1/4 1/4 1/4 1/16 -3/16) (1/16 -3/16 1/16 -3/16 1/4 1/16 -3/16) (1/2 1/4 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/2) (1/4 1/4 1/4 1/4) (1/2 7/16)))

 

Applying Length augmentation to that will cause a problem no matter how I do it. I'll need to solve that issue first. Thanks!

It should be 

 

(setf sourcelengths '((1/16 -3/16 1/16 -3/16 1/4 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/4 1/16 -3/16) (-1/4 1/4 1/16 -3/16 1/4) (3/16 -3/16 1/16 -3/16 1/4 1/8) (1/8 1/16 -3/16 1/16 -3/16 1/4 1/8) (1/8 1/4 1/4 1/4 1/8) (1/8 1/2 1/4 1/8) (1/8 1/4 1/4 1/16 -1/4 -1/16) (-1/8 1/16 -3/16 1/16 -3/16 1/4 1/8) (1/8 1/16 -3/16 7/16 -3/16) (-1/8 1/4 1/4 1/4 1/8) (1/8 1/4 1/16 -3/16 1/4 1/16 -1/16) (-1/8 1/16 -3/16 1/4 1/4 1/16 -1/16) (-1/8 1/4 1/4 1/4 1/8) (1/8 7/16 -3/16 1/4) (1/16 -3/16 1/16 -3/16 1/16 -3/16 1/16 -3/16) (1/16 -3/16 7/16 -1/16 1/4) (1/4 1/4 1/4 1/4) (1/16 -3/16 1/16 -3/16 1/16 -3/16 1/4) (1/16 -3/16 1/2 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/4 1/4) (1/4 1/2 1/4) (3/16 -1/2 -1/16 1/16 -3/16) (1/16 -3/16 1/4 1/16 -3/16 1/4) (1/16 -3/16 1/16 -3/16 1/4 1/16 -3/16) (1/4 1/2 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/4 1/4) (1/2 1/4 1/4) (1/4 1/4 1/2) (1/4 1/4 1/4 1/4) (1/2 1/4 1/4) (1/4 1/2 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/4 1/4) (1/2 1/4 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/2) (7/16 -3/16 1/16 -3/16 1/8) (1/8 1/16 -3/16 1/4 1/4 1/16 -1/16) (-1/8 1/4 1/16 -3/16 3/8) (1/8 1/16 -3/16 1/4 1/4 1/8) (1/8 1/2 1/4 1/8) (1/8 1/4 1/4 1/4 1/8) (3/8 1/4 1/4 1/8) (1/8 1/2 3/8) (1/16 -1/4 -1/16 1/4 1/4 1/8) (1/8 1/4 1/16 -3/16 3/8) (1/16 -1/16 1/4 1/4 1/4 1/8) (1/8 1/2 3/8) (1/8 1/4 1/4 1/4 1/16 -1/16) (-1/8 1/4 1/4 1/4 1/8) (5/16 -3/16 1/4 1/4) (1/4 1/16 -3/16 1/16 -3/16 1/4) (1/4 1/4 1/2) (7/16 -1/16 1/4 1/4) (1/4 1/4 1/4 1/4) (1/16 -3/16 1/2 1/4) (1/4 1/4 1/4 1/4) (1/4 1/2 1/4) (1/4 1/4 1/2) (1/4 1/4 1/2) (1/4 1/4 1/4 1/4) (1/4 1/4 1/4 1/4) (1/4 1/2 1/4) (3/16 -1/2 -1/16 1/16 -3/16) (1/16 -3/16 1/4 1/4 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/16 -7/16) (1/4 1/16 -3/16 7/16 -1/16) (-1/8 1/16 -3/16 1/4 1/4 1/16 -1/16) (-1/8 1/16 -3/16 1/4 1/4 1/8) (1/8 1/4 1/4 1/4 1/8) (3/8 1/4 1/4 1/8) (1/8 1/4 1/16 -7/16 1/16 -1/16) (-1/8 1/16 -3/16 1/4 1/4 1/16 -1/16) (-1/8 7/16 -1/4 -1/16 1/8) (1/8 1/4 1/4 1/4 1/8) (1/8 1/16 -3/16 1/4 1/16 -3/16 1/16 -1/16) (-1/8 1/4 1/4 1/16 -3/16 1/8) (1/8 1/4 1/4 1/4 1/8) (5/16 -3/16 1/4 1/16 -3/16) (1/16 -3/16 1/16 -3/16 1/16 -3/16 1/16 -3/16) (7/16 -1/16 1/4 1/4) (1/4 1/4 1/4 1/16 -3/16) (1/16 -3/16 1/16 -3/16 1/4 1/16 -3/16) (1/2 1/4 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/2) (1/4 1/4 1/4 1/4) (1/2 7/16)))

 

Not sure how to remove the extra parenthesis algorithmically though.

  • Author

OK, so this seems to be working:

 

(setf source "/Users/tomtolleson/OpusModus/Scores/The Bifurcated Fruit of a Mirror/MIDI/dominabi.mid")
(setf sourcelengths (midi-to-omn source :type :length))
(setf flatlengths (mcflatten sourcelengths))
(length-augmentation 4 flatlengths)

THT

Create an account or sign in to comment


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

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.