Skip to content
View in the app

A better way to browse. Learn more.

Learn more

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

You should use sourcelengths as variable:

(length-augmentation 2 sourcelengths)

Best!

 

  • 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

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.