# Help with combining lists

## Recommended Posts

Hello All

Can anyone help me develop a function which superimposes a rhythm onto a constant list of pitches?

For example, how would I go about superimposing a rhythm like (1/2 1/16 7/16 1/8 3/8 3/16 5/16 1/4 1/4 5/16 3/16 3/8)

on to list of pitches like (infinity-series 100 '(g4 gs4))

=> (g4 gs4 fs4 a4 gs4 g4 f4 bb4 fs4 a4 g4 gs4 a4 fs4 e4 b4 gs4 g4 f4 bb4 g4 gs4 fs4 a4 f4 bb4 gs4 g4 bb4 f4 eb4 c5 fs4 a4 g4 gs4 a4 fs4 e4 b4 g4 gs4 fs4 a4 gs4 g4 f4 bb4 a4 fs4 e4 b4 fs4 a4 g4 gs4 e4 b4 a4 fs4 b4 e4 d4 cs5 gs4 g4 f4 bb4 g4 gs4 fs4 a4 f4 bb4 gs4 g4 bb4 f4 eb4 c5 g4 gs4 fs4 a4 gs4 g4 f4 bb4 fs4 a4 g4 gs4 a4 fs4 e4 b4 f4 bb4 gs4 g4)

So that the melody would be:

=> (g4 gs4 fs4 a4 gs4 g4 f4 bb4 fs4 a4 g4 gs4 a4 fs4 e4 b4 gs4 g4 f4 bb4 g4 gs4 fs4 a4 f4 bb4 gs4 g4 bb4 f4 eb4 c5 fs4 a4 g4 gs4 a4 fs4 e4 b4 g4 gs4 fs4 a4 gs4 g4 f4 bb4

1/2                                        1/16 7/16                              1/8       3/8                             3/16          5/16                      1/4                  1/4                5/16                      3/16

=> (1/2 g4 1/16 fs4 7/16 a4 1/8 gs4 3/8 f4 3/16 f4 5/16 g4 1/4 fs4 1/4 a4 5/16 g4 3/16 g4)

I want to set each pitch to a constant value, for e.g 1/16 then superimpose the rhythm so that rather than span the rhythm to the pitches, the rhythm swallows the pitches leaving a resultant melody. I hope this makes sense.

Best wishes

Brian

##### Share on other sites

like that?

```(setf lengths  '(1/2 1/16 7/16 1/8 3/8 3/16 5/16 1/4 1/4 5/16  3/16))
(setf pitches '(g4 gs4 fs4 a4 gs4 g4 f4 bb4 fs4 a4 g4 gs4 a4 fs4 e4 b4
gs4 g4 f4 bb4 g4 gs4 fs4 a4 f4 bb4 gs4 g4 bb4 f4 eb4 c5
fs4 a4 g4 gs4 a4 fs4 e4 b4 g4 gs4 fs4 a4 gs4 g4 f4 bb4
a4 fs4 e4 b4 fs4 a4 g4 gs4 e4 b4 a4 fs4 b4 e4 d4 cs5 gs4
g4 f4 bb4 g4 gs4 fs4 a4 f4 bb4 gs4 g4 bb4 f4 eb4 c5 g4
gs4 fs4 a4 gs4 g4 f4 bb4 fs4 a4 g4 gs4 a4 fs4 e4 b4 f4
bb4 gs4 g4))

;;; get the pitches
(loop for i in (append (list 0)
(cumulative-sums (loop for k in lengths collect (/ k 1/16))))
collect (nth i pitches))

;;; a function which generates OMN-format
(defun superimpose (lengths pitches)
(make-omn :length lengths
:pitch (loop for i in (append (list 0)
(cumulative-sums (loop for k in lengths
collect (/ k 1/16))))
collect (nth i pitches))))

;;; evaluate -> OMN output
(superimpose '(1/2 1/16 7/16 1/8 3/8 3/16 5/16 1/4 1/4 5/16 3/16)
'(g4 gs4 fs4 a4 gs4 g4 f4 bb4 fs4 a4 g4 gs4 a4 fs4 e4
b4 gs4 g4 f4 bb4 g4 gs4 fs4 a4 f4 bb4 gs4 g4 bb4 f4
eb4 c5 fs4 a4 g4 gs4 a4 fs4 e4 b4 g4 gs4 fs4 a4 gs4
g4 f4 bb4 a4 fs4 e4 b4 fs4 a4 g4 gs4 e4 b4 a4 fs4
b4 e4 d4 cs5 gs4 g4 f4 bb4 g4 gs4 fs4 a4 f4 bb4 gs4
g4 bb4 f4 eb4 c5 g4 gs4 fs4 a4 gs4 g4 f4 bb4 fs4 a4
g4 gs4 a4 fs4 e4 b4 f4 bb4 gs4 g4))```

##### Share on other sites

Thank you, that's exactly what I was looking for!!  Much appreciated!

Brian

##### Share on other sites

you're welcome :-)

greetings

andré

##### Share on other sites

Hello, All

I'm trying to work out André's solution examples to make partitions out of tone rows or infinity series

(setf lengths  '(1/2 1/16 7/16 1/8 3/8 3/16 5/16 1/4 1/4 5/16  3/16))
(setf pitches '(g4 gs4 fs4 a4 gs4 g4 f4 bb4 fs4 a4 g4 gs4 a4 fs4 e4 b4 gs4 g4 f4 bb4 g4 gs4 fs4 a4 f4 bb4 gs4 g4 bb4 f4 eb4 c5 fs4 a4 g4 gs4 a4 fs4 e4 b4 g4 gs4 fs4 a4 gs4 g4 f4 bb4 a4 fs4 e4 b4 fs4 a4 g4 gs4 e4 b4 a4 fs4 b4 e4 d4 cs5 gs4 g4 f4 bb4 g4 gs4 fs4 a4 f4 bb4 gs4 g4 bb4 f4 eb4 c5 g4 gs4 fs4 a4 gs4 g4 f4 bb4 fs4 a4 g4 gs4 a4 fs4 e4 b4 f4 bb4 gs4 g4))

;;; get the pitches

(setf pitsublist (loop for i in (append (list 0) (cumulative-sums (loop for k in lengths collect (/ k 1/16)))) collect (nth i pitches))

; All ok but what I need next is to take the nth order sublist generated in André's solution to chordize it in partitions ala Babbitt.

chordize (gen-divide '(2 1 3) '(pitsublist) chordize-list (gen-divide '(2 1 3) '(pitsublist))))

Any hint ?

Thanks a lot !

##### Share on other sites

Have you check the TIME-POINT-SYSTEM function.

##### Share on other sites

Dear Janusz,

This is the closest I get. I suppose it isn't related to Time-point.

I'll try to explain.

1) There is a general list of pitches from a certain source (a row, for example)

2) From this list, we use the rhythm list as a skip list of pitches, picking the notes from a sequence.

3) The sequence of note picks is related to the lenght of note divided by the small quantized value, for example, the 16th note.

4) So, the lenght sequence

(1/2 1/16 7/16 1/8 3/8 3/16 5/16 1/4 1/4 5/16  3/16))

Will result in a pick skip note sequence like (8, 1, 7, 2, 6, 3, 5, 4, 4, 5, 3)

5) The pick-skip note acts like

8 - means pick the first and skip 7 from the first list of pitches

1 - means pick the first and skip 0 from the first list of pitches

7 - means pick the first and skip 6 from the first list of pitches

and so on...

This will result in a sublist of first list of pitches, based on the skipped notes, taken every nth notes.

according to the sequence.

5) The missed step is that I want to chordize this sublist to an desired HARMONIC partition, like

for example 2 trichords, 1 dyad, 3 single notes and a tetrachord, using something like this:

(chordize (gen-divide '(3 3 2 1 1 1 4) 'pitches sublist))

Here is the closer I get.

Best,

Julio

(setf lengths  '(1/2 1/16 7/16 1/8 3/8 3/16 5/16 1/4 1/4 5/16  3/16))
(setf pitches '(g5 gs4 fs4 a4 gs4 g4 f4 bb4 fs4 a4 g4 gs4 a4 fs4 e4 b4 gs4 g4 f4 bb4 g4 gs4 fs4 a4 f4 bb4 gs4 g4 bb4 f4 eb4 c5 fs4 a4 g4 gs4 a4 fs4 e4 b4 g4 gs4 fs4 a4 gs4 g4 f4 bb4 a4 fs4 e4 b4 fs4 a4 g4 gs4 e4 b4 a4 fs4 b4 e4 d4 cs5 gs4 g4 f4 bb4 g4 gs4 fs4 a4 f4 bb4 gs4 g4 bb4 f4 eb4 c5 g4 gs4 fs4 a4 gs4 g4 f4 bb4 fs4 a4 g4 gs4 a4 fs4 e4 b4 f4 bb4 gs4 g4))

(def-score time
(
:key-signature 'chromatic
:time-signature time-sig
:tempo 112
:layout (clarinet-layout 'clarinet)
)

(clarinet
:length lengths
:pitch (loop for i in (append (list 0) (cumulative-sums (loop for k in lengths
collect (/ k 1/16))))
collect (nth i pitches))
:channel 1
:sound 'gm
:program 'piano
))

##### Share on other sites

something like this? don't know if it's like this...

you want to project a chord on these "filtered pitches"?

```(setf lengths  '(1/2 1/16 7/16 1/8 3/8 3/16 5/16 1/4 1/4 5/16 3/16))

(setf pitches '(g5 gs4 fs4 a4 gs4 g4 f4 bb4 fs4 a4 g4 gs4 a4 fs4 e4 b4
gs4 g4 f4 bb4 g4 gs4 fs4 a4 f4 bb4 gs4 g4 bb4 f4 eb4
c5 fs4 a4 g4 gs4 a4 fs4 e4 b4 g4 gs4 fs4 a4 gs4 g4 f4
bb4 a4 fs4 e4 b4 fs4 a4 g4 gs4 e4 b4 a4 fs4 b4 e4 d4
cs5 gs4 g4 f4 bb4 g4 gs4 fs4 a4 f4 bb4 gs4 g4 bb4 f4
eb4 c5 g4 gs4 fs4 a4 gs4 g4 f4 bb4 fs4 a4 g4 gs4 a4 fs4
e4 b4 f4 bb4 gs4 g4))

(setf chord-intervals '(3 1 2 2))

(make-omn :length lengths
:pitch (loop for i in (append (list 0)
(cumulative-sums
(loop for k in lengths
collect (/ k 1/16))))
append (chordize
(interval-to-pitch chord-intervals :start (nth i pitches)))))```

##### Share on other sites

I think you are looking for something like that:

```(setf length '(1/2 1/16 7/16 1/8 3/8 3/16 5/16 1/4 1/4 5/16 3/16 3/8))

(setf infinity (infinity-series 100 '(g4 gs4)))
=> (g4 gs4 fs4 a4 gs4 g4 f4 bb4 fs4 a4 g4 gs4 a4 fs4 e4 b4 gs4 g4
f4 bb4 g4 gs4 fs4 a4 f4 bb4 gs4 g4 bb4 f4 eb4 c5 fs4 a4 g4
gs4 a4 fs4 e4 b4 g4 gs4 fs4 a4 gs4 g4 f4 bb4 a4 fs4 e4 b4
fs4 a4 g4 gs4 e4 b4 a4 fs4 b4 e4 d4 cs5 gs4 g4 f4 bb4 g4
gs4 fs4 a4 f4 bb4 gs4 g4 bb4 f4 eb4 c5 g4 gs4 fs4 a4 gs4
g4 f4 bb4 fs4 a4 g4 gs4 a4 fs4 e4 b4 f4 bb4 gs4 g4)

(time-swallow 1/16 1 length pitch)
=> (g4 fs4 a4 gs4 f4 f4 g4 fs4 a4 g4 g4 a4)

(make-omn
:length length
:pitch (time-swallow 1/16 1 length pitch))
=> (h g4 s fs4 q.. a4 e gs4 q. f4 e. qs g4 q fs4 a4 qs g4 e. q. a4)

(make-omn
:length length
:pitch (time-swallow 1/16 '(3 3 2 1) length pitch))
=> (h g4gs4fs4 s fs4a4g4 q.. a4g4 e gs4 q. f4bb4g4 e. f4bb4gs4
qs g4bb4 q fs4 a4fs4e4 qs g4gs4fs4 e. g4f4 q. a4)

(make-omn
:length length
:pitch (time-swallow 1/16 '(3 3 2 1) length pitch :type 2))
=> (h g4gs4fs4 s g4gs4a4 q.. fs4e4 e gs4 q. a4f4bb4
e. c5fs4a4 qs a4fs4 q fs4 f4bb4a4 qs fs4a4g4 e. fs4b4 q. cs5)
```

I made some changes the function which allows you now to assign a chord size to the pitch output.

##### Share on other sites

Thanks a lot, Janusz.

This swallow function is already avaiable in Opusmodus?

Do I have to update ?

Best,

Julio

##### Share on other sites

The update will be released tomorrow. The final function name might be different.

##### Share on other sites

Dear André,

I´m going to check your solution soon. Thanks, friends !

Very inspiring !

Best,

Julio

##### Share on other sites

Thank you so much Janusz!! I love the way you creative lisp-coders can hear an idea and immediately create a lisp-realisation (with extensions)!!!

What am amazing community. I'll look forward to the update.

All the best

Brian

## Join the conversation

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

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

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

×
×

• Lessons
• #### GUI

• Clubs
×
• Create New...