Search the Community
Showing results for tags 'gen-loop'.
I'm studying the Orchestral Example code from Opusmodus documentation. After changing the original melodic source (setf solo => setf elvis), compiling solovar1 and solovar2 functions produce error messages more than half the time. Does anyone know how to fix that? Thank you! ;;; MELODY ;; Basic melodic material (setf elvis (gen-repeat 2 '((h f4 c5) (h f4 -q e g4 a4) (h bb4 a4) (h g4 -q -e c4) (h d4 e4) (h f4 3h g4 a4 bb4) (h a4 g4 w f4) ))) (setf frag1 (gen-loop 14 (list (rnd-pick '(2 3 1 4)) (rnd-pick '(2 3))))) (setf frag2 (gen-loop 14 (list (rnd-pick '(2 3 1 4)) (rnd-pick '(2 3))))) ;; Melodic variations (setf solovar1 (gen-fragment frag1 elvis)) (setf solovar2 (gen-fragment frag2 elvis)) Here's one of the error messages: Error: Function nthcdr expected a non-negative integer, got -1. 1 (abort) Return to top loop level 0. Type :b for backtrace or :c <option number> to proceed. Type :bug-form "<subject>" for a bug report template or :? for other options.
I wonder if it's possible to evaluate a function (that has a seed argument) a set number of times (using gen-loop) with a predefined, custom seed list applied to the function. Something that I'm trying to achieve in the example below. Thank you! (setf seeds (vector-round 1 100 (gen-white-noise 8 :seed 13))) (setf rhythm (gen-loop 8 (euclidean-rhythm 16 4 16 's :type 2 :seed seeds)))
I find the permute function very useful, but I've some across the need to work with a very large number of permutations (all possible 12-note rows, but other situations as well). I think it would be great to have a companion function, something like nth-permutation, that returns the nth permutation of a list, as we know there will be (setq num-perms (factorial (length my-list))) permutations, and they can be traversed in a simple (loop from i upto num-perms (do-stuff (nth-permutation i))). For numbers beyond 10, the list is too large to store in memory. The Wikipedia article on permutations has some excellent strategies on cycling through all permutations one at a time and even offers some pseudo-code. I'm working on one in Common Lisp but I'm pretty much of a newbie. I'll gladly share it if I can get it working. Thanks! Paul