Jump to content
Sign in to follow this  
JulioHerrlein

Help needed Binary Length values

Recommended Posts

Dear Friends,

 

1) How to convert a given length series in a binary series ? For example:

((1/16 -3/16 1/16 -1/8 1/16 -1/4)) with 1/16 as a base could be transformed in binary like:

(1 0 0 0 1 0 0 1 0 0 0 0)

 

and/or

2) How to convert a length  3/16 in 1/16 -1/16 -1/16, i.e. a kind of length conversion

 based on quantize.

 

3/16 could be converted in

 

1/16 -1/16 -1/16

or

1/32 -1/32 -1/32 -1/32 -1/32 -1/32

depending on the value regarded as the reference (1/16 in the first case or 1/32 in the second)

 

Thanks !

Julio

 

Code example

(setf ccpa1 (omn :length (length-staccato 1/16 (time-point-system (pitch-rotate 0 (pcs '3-11b :pitch))'s :start 0))))

;EXTRA FUNCTION NEEDED

;;;LENGTH-LEGATO (by ANDRE MEIER)

(defun length-staccato (n alist)
  (let ((newlengths)
        (new-omn (omn-merge-ties (flatten  alist)))
        (time-sign (get-time-signature alist)))
    (progn 
      (setf newlengths (loop for i in (omn :length new-omn)
                         when (> i 0)
                         append (if (= n i)
                                  (list i)
                                  (list n (* -1 (abs (- i n)))))
                         
                         else collect i))
      (if (omn-formp alist)
        (omn-to-time-signature (make-omn :length newlengths
                                         :pitch (omn :pitch new-omn)
                                         :velocity (omn :velocity new-omn)
                                         :articulation (omn :articulation new-omn))
                               time-sign)
        newlengths))))

 

 

Share this post


Link to post
Share on other sites

something like that?

 

(defun length-to-binary (lengthlist n)
  (let ((newlist (loop for i in (omn :length lengthlist)
                    collect (/ i n))))
    (loop for x in newlist
      when (> x 0)
      append (append (list 1) (gen-repeat (1- x) '0))
      else append  (gen-repeat (abs x) '0))))
    

(length-to-binary '(-q q e) 1/16)
=> (0 0 0 0 1 0 0 0 1 0)

(length-to-binary '(-q s s q e) 1/16)
=> (0 0 0 0 1 1 1 0 0 0 1 0)

 

Share this post


Link to post
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.

Sign in to follow this  

  • Similar Topics

    • By spuki
      In Lesson 4, it is statet that "You can see the LENGTH-WEIGHT replaces previously 'sounding' lengths with rest-lengths throughout the stream of pitches. "
      But  actually Length-Weight  INSERTS rests. Sounding pitches are not replaced, but shiftet.
      Is that correct?
       
    • By JulioHerrlein
      Dear All
       
      I'm studying some 4-note cells for Coltrane like jazz patterns from a video lesson of saxophonist Chad Lefkowitz-Brown.
      The idea is to use a limited number of cells (no more than 10, some diatonic and some chromatic) to create
      longer lines, like the line below.
       
      1) The idea is to connect the same fragments with different transpositions, adjusting the transpositions according
       to the construction of the line. I need a code where I can experiment the order and the transpositions of the
      fragments to create a longer line. Sometimes I can have two times the same pattern with different transposition.
       
      2) The possibility to rotate fragments would be interesting also.
      3) Lastly: a random assembling that automatically adjust the transpositions, in a way that each new fragment starts
      exactly a semitone up or down the preceeding fragment, making a cohesive line.
       
      Any help is welcome !!
      Looking forward to PLAY this patterns on the guitar and record some Videos (where I can mention Opusmodus, of course !)
       
      Best !
      Julio
       
       

       
      I tried the form below, but I'm not very happy with that.
      (setf xa (pitch-fragment 1 4 '(g4 gb4 f4 g4) :transpose '(0)) xb (pitch-fragment 2 3 '(c4 cs4 fs4) :transpose '(0 1 2 1)) xc (pitch-fragment 2 3 '(c4 cs4 fs4) :transpose '(0 1 2 1)) xd (pitch-fragment 2 3 '(c4 cs4 fs4) :transpose '(0 1 2 1)) xe (pitch-fragment 1 3 '(g4 g4 g4) :transpose '(0 1 2 1)) xf (pitch-fragment 4 3 '(c4 c4 c4) :transpose '(0 0 7 2))) (setf seq '(f a e)) (assemble-section 'x seq) (setf jazzline (flatten (assemble-section 'x seq))) (setf rhyjazz (gen-repeat 50 '(s))) (make-omn :length rhyjazz :pitch jazzline)  
      These are not the actual fragments, just some ideas do debug the code...
       
    • By terekita
      Hello,
       
      For various reasons, I need to start with rhythms defined in one time signature and remap them. I'm having trouble doing this because of what happens to ties when you use omn :length (though I realize they are being collected under :articulation).
       
      In this case, I'm taking bars of 4/4 regrouping into bars of 2/4.
       
      (setf myr '( (s s -s s -e s s -s s -e t t t t s s) (e e_q -h))) (setf tr (omn-to-time-signature myr '(2 4)))  
      Now I take the result of the above and assign it to a new variable ( this would be the same as (setf foo tr) ):
      (setf foo '((s c4 c4 - c4 -e s c4 c4) (-s c4 -e t c4 c4 c4 c4 s s) (e c4 c4 tie q) (-h)))  
      As you can see, there is a tie in the third bar.
       
      Now, how can I extract that rhythm so that I can apply to another set of pitches?
       
      If I do the following, I no longer have the tie represented in the rhythm:
      (omn :length foo) ;; results in ;; ((1/16 1/16 -1/16 1/16 -1/8 1/16 1/16) (-1/16 1/16 -1/8 1/32 1/32 1/32 1/32 1/16 1/16) (1/8 1/8 1/4) (-1/2)) ;; i.e., no tie in the third bar  
      Also, if I try to span the rhythm onto another set of pitches, I again get a result that is missing the tie:
      (setf my-pitches '(c4 d4 e4)) (make-omn :length foo :pitch my-pitches)  
      What I'd really love is to get back a list of lengths that is like my original list, just regrouped in new time signatures. So, ideally something like:
      (setf myr '( (s s -s s -e s s -s s -e t t t t s s) (e e_q -h))) ;; imaginary function (regroup-to-two-four myr) ;;would result in the following: ;; ((s s -s s -e s s)(-s s -e t t t t s s)(e e_q)(-h))  
      Finally, I should add that in a related problem, I need to extract the number of attacks in a bar after it has been regrouped. So, for this reason again, I need to figure out how to extract the rhythm while preserving ties and not re-attacking tied notes.
       
      I'd very appreciate and thank you kindly for any assistance in doing this.
       
      Thanks very much, Michael
×
×
  • Create New...