TomTolleson Posted September 10, 2023 Share Posted September 10, 2023 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 Quote Link to comment Share on other sites More sharing options...
vpolajnar Posted September 10, 2023 Share Posted September 10, 2023 You should use sourcelengths as variable: (length-augmentation 2 sourcelengths) Best! TomTolleson 1 Quote Link to comment Share on other sites More sharing options...
TomTolleson Posted September 10, 2023 Author Share Posted September 10, 2023 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. vpolajnar 1 Quote Link to comment Share on other sites More sharing options...
TomTolleson Posted September 10, 2023 Author Share Posted September 10, 2023 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 vpolajnar 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.