Jump to content

Featured Replies

Posted

...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)

 

  • Author

edited now :-)

  • Author

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

  • Author

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

 

> 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

Create an account or sign in to comment


Copyright © 2014-2025 Opusmodus™ Ltd. All rights reserved.
Product features, specifications, system requirements and availability are subject to change without notice.
Opusmodus, the Opusmodus logo, and other Opusmodus trademarks are either registered trademarks or trademarks of Opusmodus Ltd.
All other trademarks contained herein are the property of their respective owners.

Powered by Invision Community

Important Information

Terms of Use Privacy Policy