Jump to content
Sign in to follow this  
AM

structural interferences

Recommended Posts

...an idea to manipulate lists of pitches/rhythms by "sampling"

 

;;; subfunction

(defun sampling-list (liste start-position seq-length)
  (loop repeat seq-length
    for cnt = start-position then (incf cnt)
    when (= cnt (length liste)) do (setf cnt 0)
    collect (nth cnt liste)))


;;; MAIN:
;;; an value-list will be sampled by start-pos-list in the length of seq-length-list

(defun structural-interferences (n value-list start-pos-list seq-length-list)
  (let ((start-pos-list (remove (length value-list) start-pos-list :test #'<)))
    (loop repeat n
      for start-pos = 0 then (incf start-pos)
      for seq-length  = 0 then (incf seq-length)
      when (= start-pos (length start-pos-list)) do (setf start-pos 1) 
      when (= seq-length (length seq-length-list)) do (setf seq-length 0)
      append (sampling-list value-list (nth start-pos start-pos-list) (nth seq-length seq-length-list)))))

;;something
(list-plot 
 (structural-interferences 21 '(1 2 3 4 5) '(0 1 2 3 4 5 6 7 8 9) '(1 3 2 4 1 2 2 3 1 1 1 1))
 :point-radius 1 :style :fill)
    
;;"self-similar"
(list-plot 
 (structural-interferences 21 '(3 2 1 5 4 2) '(2 1 0 4 3 1) '(3 2 1 5 4 2))
 :point-radius 1 :style :fill)

 

Share this post


Link to post
Share on other sites

... i think sometimes i'm faster when i code it for myself then to search in the library :-)

Share this post


Link to post
Share on other sites

i work in another way... the tools has to follow the ideas and not my ideas are "what the tools can do"   ;-)

 

Share this post


Link to post
Share on other sites

> I would advise to search the library, you might find thinks you never thought of 

 

What strategies do you suggest for searching the rather large library of existing functions. Though this question sounds a bit simple, it really mean it seriously. The search facility only searches through function names, AFAIK, and a name like gen-surround is not exactly easy to guess. What other strategies could be there for finding relevant functions?

 

Better support for finding relevant functions could perhaps be an important addition of version 2?

 

Best,

Torsten

 
added 8 minutes later

Dear André,

> sampling-list

BTW: The built-in Common Lisp function subseq is very similar, see http://www.lispworks.com/documentation/HyperSpec/Body/f_subseq.htm

 

subseq is likely much faster than sampling-list, if that is important: calling nth very often in sampling-list needs to go through the input list again and again.

 

Best,

Torsten

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  

×
×
  • Create New...