Jump to content

length-augmentation to fill rests


Recommended Posts

Hello,


I'm working with a plainchant as source material and I'd like to augment the lengths of the notes without augmenting the rest size.

 

For example in this example, I'm able to increase the source material

sourcemat

 

with the length-augmentation.

(setf augmat (length-augmentation 4 sourcemat))

 

I'm wondering if the exception parameter is the key here? Unfortunately the documentation doesn't include much for the use of exception. To better illustrate the issue I'm including an example below using a single instrument (tuba).

 

Thanks.

 

;;;---------------------------------------------------------
;;; Parameters

(setf size 8)
(setf bars (gen-repeat size '(4/4)))
(setf pause (length-span bars '(-q)))

(setf sourcemat '((s d3 ffff -e. s f3 mf -q.. s f3 ffff -e.) (s g3 -e. s f3 -e. q.. g3 -s) (s a3 -e. s f3 -e. s e3 -e. q f3 tie) (e. f3 - s as3 -e. s a3 -e. s as3 -) (-e s g3 -e. s f3 -e. s g3 -e. e g3 tie) (qs g3 -s d3 -e. s g3 -e. s as3 -) (-e s a3 -e. s as3 -e. s c4 -e. s a3 -) (-q. q.. g3 -e.) (-e s g3 -e. s g3 -e. s as3 -e. s a3 -) (-e s as3 -e. s c4 -e. s c4 -e. s g3 -) (-e s c4 -e. s a3 -e. s as3 -e. s a3 -) (-e s as3 -e. s g3 -e. q. g3 tie) (s g3 - e3 -e. s f3 -e. s g3 -e. s f3 -) (-e s g3 -e. s d3 -q.. e c3 tie) (qs c3 -q.. s c3 -e.) (s d3 -e. s f3 -e. s f3 -e. s d3 -e.) (s f3 -e. s d3 -e. s f3 -e. s e3 -e.) (s f3 -e. s g3 -e. s g3 -q..) (s f3 -e. s g3 -e. s d3 -e. s e3 -e.) (s f3 -e. s g3 -e. s f3 -e. s g3 -e.) (q.. f3 -s q.. e3 -s) (-q s g3 -e. s as3 -e. s a3 -e.) (s c4 -e. s a3 -q.. s g3 -e.) (-q s e3 -e. q.. f3 -s) (s d3 -e. s f3 -e. s e3 -e. s c3 -e.) (s d3 -e. s c3 -e. s c3 -e. q e3 tie) (e. e3 -s c3g3 q e3g3 tie) (z^e. e3 h.^z g3 q^s f3) (q^s d3 q^s c3 q^s e3 q^s d3) (q^s e3 h^s d3 q c3 tie) (e. c3 -hs q^s c3) (q^s g3 z^q.. h.^s f3) (q^s g3 q^s a3 q^s f3 q^s d3) (q^s g3 q^s f3 q^s e3 q^s c3) (q^s d3 h^s f3 q^s d3) (q^s e3 q^s d3 q^s c3 q^s d3) (q^s c3 q^s as2 z^h f3 tie q.. c3 -s) (h f3 tie e^z q^s e tie) (e^z f3 q^s q^s c3 q^s d3 e f3 tie) (e^z f3 q^s d3 q^s as2 q^s d3 e f3 tie) (e^z f3 q^s d3 q^s as2 q. c3f3 tie) (z^s c3 h.^z f3 q^s g3) (q^s as3 q^s q^s q^s g3) (q^s f3 z^s g3 q.. e3 -qs) (q^s a3 q^s g3 q^s f3 q^s e3) (z^q.. f3 h.^s g3 q g3a3 tie) (z a3 e. g3 -hs q as3c4 tie) (z^e. as3 h^z c4 q^s q^s as3) (z^s a3 q.. as3 -qs q a3as3 tie) (z^e. as3 h^z a3 q^s as3 q^s d4) (q^s c4 q^s h^s as3) (q^s g3 g3 tie s^5s q^s as3 e. g3 tie) (s^z g3 z^s as3 q - q^s g3 e. f3 tie) (s^z f3 z^q.. g3 h.^s a3 e. a3as3 tie) (z^h a3 tie q as3 - s^z a3 q^s as3 e. tie) (s^z as3 q^s q^s a3 q^s g3 e. a3 tie) (s^z a3 q^s f3 q^s g3 q^s f3 e. e3 tie) (s^z e3 q.. e3f3 -h) (-s h^s c3 q.. f3 tie) (s^z f3 q^s d3 q^s c3 q^s g3 e. f3 tie) (s^z f3 q^s g3 h^s e. e3 tie) (s^z e3 q^s f3 q^s g3 q^s f3 e. g3 tie) (s^z g3 h^s d3 q.. c3 tie) (h c3 tie s^z q^s d3 e. f3 tie) (s^z f3 q^s g3 q^s f3 q^s d3 e. g3 tie) (s^z g3 q^s f3 q^s g3 q^s a3 e. c3g3 tie) (z^q g3 h c3 tie e^z q^s d3 e f3 tie) (e^z f3 q^s g3 q^s f3 q^s d3 e g3 tie) (e^z g3 q^s f3 q^s g3 q^s a3 e c3g3 tie) (z c3 qs g3 -hs e g3 tie) (e^z g3 q^s as3 z^q.. g3 he a3 tie) (e^z a3 z^s g3 q.. as3 -qs e as3 tie) (q.^z as3 q^s g3 q. f3 tie) (e^z f3 q^s d3 q^s c3 q^s e3 e d3 tie) (e^z d3 he. c3)))


(setf augmat (length-augmentation 4 sourcemat))
(setf mat (pitch-transpose -12 augmat))
(setf tuba (flatten mat))

;;;---------------------------------------------------------
;;; Score and Layout

(def-score tuba
    (:title "Title"
     :composer "Composer Name"
     :copyright "Copyright © "
     :key-signature 'chromatic
     :time-signature '((1 1 1 1) 4)
     :tempo 100
     :layout (tuba-layout 'tuba))
  
  (tuba
   :omn tuba
   :channel 1
   :sound 'gm
   :program 'tuba
   :volume 95
   :pan 64
   :controllers (91 '(57))
   )
  )

 

Link to comment
Share on other sites

I'm getting an unexpected result when trying out my function (below).

I ran that on my source material's lengths (in their own list)  and the error I'm seeing is "Error: In oddp arguments should be of type integer." I assumed the fractional format of the lengths was the problem. However, when I tried the below I got the same type of error "Error: In oddp of ((1 2 3 4 5 6 7 -8 -7 -6 -5 -4)) arguments should be of type integer."

(defun split-rests (list &optional (rests '()))
  (if (oddp list)
      ((delete-if #'plusp list))))


(setf source '(1 2 3 4 5 6 7 -8 -7 -6 -5 -4))

(setf rests (split-rests source))

 

I can post this in stack overflow but I thought that any additional snags might be found better by posting it here.

Thanks!

 

Link to comment
Share on other sites

Thank you @Stephane Boussuge!

A huge help as always. I made a slight modification (for anyone reading this thread) to collect the rests (rather than the notes); essentially the inverse of what Stephane's code accomplishes. Mine is as follows (using "length-notep" in place of "length-restp"):

 

(setf len '(1/8 1/8 -1/4 1/16 1/16 1/16 1/16 1/4 -1/8 1/16 1/16 1/2))



(setf rest-only (remove-nils
                (loop for l in len
                      :collect (if (length-notep l) nil l ))))

 

Link to comment
Share on other sites

(setf mat (flatten '((s d3 ffff -e. s f3 mf -q.. s f3 ffff -e.)
                     (s g3 -e. s f3 -e. q.. g3 -s))))

(setf aug-length
      (loop for i in (omn :length mat)
            collect (if (length-restp i) i
                      (car (length-augmentation 4 (list i))))))

(setf augmat
      (make-omn
       :length aug-length
       :pitch (omn :pitch mat)
       :velocity (omn :velocity mat)
       :articulation (omn :articulation mat)))

(setf mat (pitch-transpose -12 augmat))
=> (q d2 ffff -e. q f2 mf -q.. q f2 ffff -e. q g2 -e. q f2 -e. w.. g2 -s)

 

Link to comment
Share on other sites

One additional technique I'm trying (using the above code). If I wanted to double the length of the notes by a number, but divide the length of the rests by a number, it seems that the below might get me part of the way there. However, I'm ending up with nil values. I'm sure there's a more elegant way to do this (like length-divide function) but I want to make sure that the score maintains the correct order of notes and rests in combination. That is, I don't want to randomly re-insert rests into the list of pitches.

(setf mat (flatten '((s d3 ffff -e. s f3 mf -q.. s f3 ffff -e.)
                     (s g3 -e. s f3 -e. q.. g3 -s))))


(setf aug-rest-length
      (loop for i in (omn :length mat)
            collect (if (length-restp i) (* 1/2 i))
            collect (if (length-notep i) (* 2 i))))

(setf augmat
      (make-omn
       :length aug-rest-length
       :pitch (omn :pitch mat)
       :velocity (omn :velocity mat)
       :articulation (omn :articulation mat)))

 

Link to comment
Share on other sites

(setf aug-rest-length
      (loop for i in (omn :length mat)
            when (length-restp i) collect (* 1/2 i)
            when (length-notep i) collect (* 2 i)))

 

or

(setf aug-rest-length
      (loop for i in (omn :length mat)
            when (minusp i) collect (* 1/2 i)
            when (plusp i) collect (* 2 i)))

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

Terms of Use Privacy Policy