Jump to content

Using list variable instead of list in Counterpoint

Recommended Posts

Hello! I have a series of lists which are algorithmically generated:

(setf pitch-mat (vector-to-pitch '(e3 e5) (gen-noise 64 :seed 458 :type :gaussian)))
(setf pch1 (flatten (rnd-order (gen-divide 8 pitch-mat))))
(setf size 12)
(setf line1 (length-legato (gen-filter-euclidean size 12 1 12 pch1 's :seed 45 :velocity '(p))))

Under the code above, Line 1 evaluates as 

((e gs4 p s c5 a4 e s c5 e4 e f4 s gs3 b3) (e. g4 p f4 e4 fs3) (s b4 p e4 fs4 f4 gs4 d4 bb3 bb3 b3 bb3 gs4 c4) (e. d4 p e cs4 e. f4 e fs4 gs4) (e e3 p s b3 e e5 b3 s fs4 e a3 cs4) (s fs3 p cs4 g4 fs4 gs4 fs4 c5 a4 a4 e4 e c5) (e f4 p s gs3 b3 e g4 s eb4 f4 e d4 s e4 bb3) (e c4 p s b4 b3 b4 e4 e fs4 s gs4 d4 bb3 bb3) (e b3 p gs4 d4 c4 b4 cs5) (e fs4 p s gs4 e b3 s d5 e b3 s e s fs4) (s a3 p eb4 cs4 c5 fs3 cs4 g4 fs4 gs4 fs4 c5 a4) (e a4 p s c5 e4 f4 f4 e gs3 s g4 e4 eb4 f4))

If I use the 


feature with all of the lines as evaluated OMN, I can generate my musical piece. It works fine.

:omn '(#|1|# ((e fs4 p s a4 e4 e c5 s gs4 e4 e f4 s s g4) (e. f4 p e4 fs3 e4) (s bb3 p e4 bb3 d4 fs4 f4 gs4 b4 c4 d4 cs4 cs4) (e. c4 p e b3 e. eb4 e cs5 a3) (e b3 p s e e3 d5 s b3 e fs3 g4) (s eb4 p fs4 cs4 cs4 fs4 a4 a4 e4 c5 c5 e gs4) (e f4 p s s g4 e f4 s b3 e4 e c4 s fs3 b4) (e e4 p s bb3 d4 bb3 e4 e bb3 s fs4 f4 gs4 b4) (e c4 p cs4 c4 bb3 b4 fs4) (e cs5 p s a3 e b3 s e5 e b3 s eb4 e d5 s b3) (s fs3 p c5 g4 a3 eb4 fs4 cs4 cs4 fs4 a4 a4 e4) (e c5 p s gs4 e4 f4 gs3 e f4 s s eb4 b3 e4))  
   :channel 1
   :sound 'gm
   :program 0
   :volume 90
   :pan 64)

This works as expected. However, if I use the list variable/name instead of the explicit OMN:


:omn '(#|1|# line1)
   :channel 1
   :sound 'gm
   :program 0
   :volume 90
   :pan 64)

It does not work properly. This makes sense to me because we are listing the OMN as specified by the :omn reference.

My question is - will I be able to build my counterpoint without explicitly adding the OMN and merely using list names?

To be clear, I'm not blocked by this issue. I can easily evaluate each list by name and add the evaluated OMN into the counterpoint function. I'm just posting this as I'm curious if there's a more elegant way to reach my goal.


Using the list variable/name would be a more efficient workflow if I need to tweak the parameters of the algorithmically generated OMN. 




Link to comment
Share on other sites

just wondering?



'(#|1|# line1)

Why not

omn: line1


`(#|1|#, line1) is the same as (list line1 ) . Adds an extra level of () to line1


#|1|# is a comment and can be added anywhere: omn: #|1|#  line1


Link to comment
Share on other sites


But , why not. There is no harm in comments. If it helps for any reason.


The original problem seems to me, was:

:omn '(line1)

That does not work, because line1 is not evaluated, but given to :omn as a symbol.

:omn line1  should work.


If for any reason I can't see  there needs to be an extra () , (list line1) will do.

I didn't look into counterpoint yet. Maybe things have to be done differently.


Tom, could you try :omn line1 instead of :omn '(line1) and see if that solves the original posted problem?

Try with #|1|# or without. There is no difference. 

You probably know about comments:  ;   ignores everything to end of line.

                                                                 #|......|# ignores everything between #| and |#  . So you can comment several lines of code.

                                                                 #!......!# works in opusmodus. It is not mentioned in the Common-lisp-Hyperspec but handy on my German Apple keyboard.                                              




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.

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