Jump to content

Producing new lines of pitches of various lengths, all ending on the same bar.


TomTolleson

Recommended Posts

Hello!

 

I’m trying to span a list and produce new lines of pitches, by interval (or otherwise) and with varying rhythmic values but have all the lines end on the same beat in the same bar. 

To explain more specifically - I'm trying to span a list and perform an operation on each item in the list more than once.

 

For example, if I have two melodic lines (variables named "pitches" and "basspitches") they might look something like this:

 

(setf pitches '(fs3 e3 gs3 b2 a3 fs4 d4 b5 e4 gs4 fs4 gs4 cs4 fs4 b3 e4 fs4))

 

(setf basspitches '(fs2 cs3 a2 e3 fs3 d3 b3 gs3 cs4 e3 cs3 fs3 d3 b3 gs2 fs2))

 

I can play them together. However, if you notice, the first list “pitches” has 17 elements and “basspitches” has 16.

But - I want them to end at the same time.

 

So… I can have basspitches play with a variable “basslengths” set to 1/2 and then create an explicated lengths list for the “pitches” list called “lengths” as such:

 

(setf lengths '(1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/4 1/4 1/2 1/2 1/2 1/2 1/2 1/2))

 

Now they end at the same time. Great. However, this is a very clunky way to go about things.

 

Additionally, this kind of primitive solution will not scale if I add functions to it.

 

For example -

 

If I use interval-scale2 to generate two additional voices (one based on the list “pitches” and one on “bass pitches”) my solution above won’t work if I want interval-scale2 to product one new pitch per 1/2 beat (one new pitch per item in the list) and another list to produce pitches at a 1/8 interval (or over varying intervals).

 

The reason it won’t work is (obviously) because I’m spanning the “pitches” and “bass pitches” lists and operating on each item once.

 

My question is - how do I span lists of pitches, producing new lines of pitches with varying rhythmic values and have all of the voices end on the same beat in the same bar? 

 

Thanks!

 

Tom Tolleson

Link to comment
Share on other sites

Hi Tom,

hope this help...

 

(setf pitches '(fs3 e3 gs3 b2 a3 fs4 d4 b5 e4 gs4 fs4 gs4 cs4 fs4 b3 e4 fs4))
 
(setf basspitches '(fs2 cs3 a2 e3 fs3 d3 b3 gs3 cs4 e3 cs3 fs3 d3 b3 gs2 fs2))

;; generate some length for basspitches
(setf basslen (rnd-sample (length basspitches) '(1/2 1/4)))

;; get the span of basslen
(setf basspan (get-span basslen))

;; generate some length for pitches 
(setf pitcheslen (rnd-sample (length pitches) '(1/2 1/4)))

;; apply the span of basslength to pitchlen using the length-span function

(setf pitcheslen-spanned (length-span basspan pitcheslen))

;; Assemble the material into 2 OMN phrases

(setf ph1 (make-omn
           :pitch pitches
           :length pitcheslen-spanned
           ))

(setf ph2 (make-omn
           :pitch basspitches
           :length basslen
           ))

;; Output the 2 phrases
(ps 'gm :afl (list ph1) :bn (list ph2))

 

S.

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